diff -Nru swt4-gtk-4.5.0/atk.c swt4-gtk-4.6.0/atk.c --- swt4-gtk-4.5.0/atk.c 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/atk.c 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. All rights reserved. + * Copyright (c) 2000, 2015 IBM Corporation and others. All rights reserved. * The contents of this file are made available under the terms * of the GNU Lesser General Public License (LGPL) Version 2.1 that * accompanies this distribution (lgpl-v21.txt). The LGPL is also @@ -383,7 +383,15 @@ jint rc = 0; ATK_NATIVE_ENTER(env, that, _1atk_1role_1register_FUNC); if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; +/* rc = (jint)atk_role_register((const gchar *)lparg0); +*/ + { + ATK_LOAD_FUNCTION(fp, atk_role_register) + if (fp) { + rc = (jint)((jint (CALLING_CONVENTION*)(const gchar *))fp)((const gchar *)lparg0); + } + } fail: if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); ATK_NATIVE_EXIT(env, that, _1atk_1role_1register_FUNC); diff -Nru swt4-gtk-4.5.0/atk_custom.h swt4-gtk-4.6.0/atk_custom.h --- swt4-gtk-4.5.0/atk_custom.h 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/atk_custom.h 2016-07-06 19:11:33.000000000 +0000 @@ -16,3 +16,7 @@ /* Special sizeof's */ #define AtkObjectFactory_sizeof() sizeof(AtkObjectFactory) + +#include "os_custom.h" //Need LIB_ATK macro for dynamic function calling. + +#define atk_role_register_LIB LIB_ATK diff -Nru swt4-gtk-4.5.0/atk.h swt4-gtk-4.6.0/atk.h --- swt4-gtk-4.5.0/atk.h 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/atk.h 2016-07-06 19:11:33.000000000 +0000 @@ -17,6 +17,9 @@ #include #include "atk_custom.h" +//macro for loading functions dynamically +#define ATK_LOAD_FUNCTION LOAD_FUNCTION + #define SWT_AtkObjectClass_get_attributes get_attributes #define SWT_AtkObjectClass_get_attributes_cast AtkAttributeSet* (*)() diff -Nru swt4-gtk-4.5.0/build.sh swt4-gtk-4.6.0/build.sh --- swt4-gtk-4.5.0/build.sh 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/build.sh 2016-07-06 19:11:33.000000000 +0000 @@ -1,6 +1,6 @@ #!/bin/sh #******************************************************************************* -# Copyright (c) 2000, 2014 IBM Corporation and others. +# Copyright (c) 2000, 2016 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 @@ -55,16 +55,13 @@ PROC=`uname -i` MAKEFILE=make_solaris.mak if [ "${MODEL}" = "" ]; then - if uname -p > /dev/null 2>&1; then - MODEL=`uname -p` + MODEL=`isainfo -k` + if [ "${MODEL}" = "amd64" ]; then + MODEL=x86_64 + MAKEFILE=make_solaris_x86_64.mak + MAKE_TYPE=gmake fi fi - case $MODEL in - "i386" | "x86") - MAKEFILE=make_solaris_x86.mak - MAKE_TYPE=gmake - ;; - esac ;; "FreeBSD") SWT_OS=freebsd @@ -92,10 +89,6 @@ SWT_ARCH=x86_64 AWT_ARCH=amd64 ;; - "sparc64") - SWT_ARCH=$MODEL - AWT_ARCH=sparcv9 - ;; i?86) SWT_ARCH=x86 AWT_ARCH=i386 @@ -288,23 +281,52 @@ export XULRUNNER_LIBS="-L${XULRUNNER_SDK}/lib -lxpcomglue" fi ;; - "solaris.sparc64") -# export PATH="/export/home/SUNWspro/bin:/usr/ccs/bin:/usr/bin" + "solaris.x86_64") if [ "${CC}" = "" ]; then export CC="cc" - fi + fi if [ "${CXX}" = "" ]; then export CXX="CC" fi + if [ "${JAVA_HOME}" = "" ]; then + export JAVA_HOME="/bluebird/teamswt/swt-builddir/build/JRE/Solaris_x64/jdk1.8.0_71" + fi +# if [ "${MOZILLA_SDK}" = "" ]; then +# export MOZILLA_SDK="/bluebird/teamswt/bog/mozilla/solaris_x86/1.7/mozilla/dist/sdk" +# fi +# if [ "${XULRUNNER_SDK}" = "" ]; then +# export XULRUNNER_SDK="/bluebird/teamswt/swt-builddir/xulrunner/1.8.0.1/solaris-x86/mozilla/dist/sdk" +# fi +# if [ "${MOZILLA_INCLUDES}" = "" ]; then +# export MOZILLA_INCLUDES="-include ${MOZILLA_SDK}/include/mozilla-config.h -I${MOZILLA_SDK}/include" +# fi +# if [ "${MOZILLA_LIBS}" = "" ]; then +# export MOZILLA_LIBS="-L${MOZILLA_SDK}/lib -L${MOZILLA_SDK}/bin -lxpcom -lnspr4 -lplds4 -lplc4" +# fi +# if [ "${XULRUNNER_INCLUDES}" = "" ]; then +# export XULRUNNER_INCLUDES="-include ${XULRUNNER_SDK}/include/mozilla-config.h -I${XULRUNNER_SDK}/include" +# fi +# if [ "${XULRUNNER_LIBS}" = "" ]; then +# export XULRUNNER_LIBS="-L${XULRUNNER_SDK}/lib -lxpcomglue" +# fi + ;; + "solaris.sparcv9") + PATH="/usr/ccs/bin:/opt/csw/bin:$PATH" + if [ "${CC}" = "" ]; then + CC="cc" + fi + if [ "${CXX}" = "" ]; then + CXX="CC" + fi if [ "${CDE_HOME}" = "" ]; then - export CDE_HOME="/usr/dt" + CDE_HOME="/usr/dt" fi if [ "${JAVA_HOME}" = "" ]; then - export JAVA_HOME="/bluebird/teamswt/swt-builddir/JDKs/SOLARIS/SPARC64/jdk1.5.0_22" + JAVA_HOME="/bluebird/teamswt/swt-builddir/JDKs/SOLARIS/SPARC64/jdk1.5.0_22" + fi + if [ "${PKG_CONFIG_PATH}" = "" ]; then + PKG_CONFIG_PATH="/opt/csw/lib/pkgconfig" fi -# if [ "${PKG_CONFIG_PATH}" = "" ]; then -# export PKG_CONFIG_PATH="/usr/local/cairo-1.4.10/lib/pkgconfig" -# fi # if [ "${MOZILLA_SDK}" = "" ]; then # export MOZILLA_SDK="/bluebird/teamswt/swt-builddir/geckoSDK/1.4/gecko-sdk" # fi @@ -314,6 +336,7 @@ # if [ "${MOZILLA_LIBS}" = "" ]; then # export MOZILLA_LIBS="${MOZILLA_SDK}/embedstring/bin/libembedstring.a -L${MOZILLA_SDK}/xpcom/bin -L${MOZILLA_SDK}/nspr/bin -lxpcom -lnspr4 -lplds4 -lplc4" # fi + export PATH CC CXX CDE_HOME JAVA_HOME PKG_CONFIG_PATH; ;; "solaris.sparc") PATH="/export/home/SUNWspro/bin:/usr/ccs/bin:/usr/bin:$PATH" @@ -451,7 +474,7 @@ # For 64-bit CPUs, we have a switch -if [ ${MODEL} = 'x86_64' -o ${MODEL} = 'ppc64' -o ${MODEL} = 'ia64' -o ${MODEL} = 'sparc64' -o ${MODEL} = 's390x' -o ${MODEL} = 'ppc64le' -o ${MODEL} = 'aarch64' ]; then +if [ ${MODEL} = 'x86_64' -o ${MODEL} = 'ppc64' -o ${MODEL} = 'ia64' -o ${MODEL} = 'sparcv9' -o ${MODEL} = 's390x' -o ${MODEL} = 'ppc64le' -o ${MODEL} = 'aarch64' ]; then SWT_PTR_CFLAGS=-DJNI64 if [ -d /lib64 ]; then XLIB64=-L/usr/X11R6/lib64 @@ -476,9 +499,9 @@ export SWT_LFLAGS fi fi - if [ ${MODEL} = 'sparc64' ]; then - SWT_PTR_CFLAGS="${SWT_PTR_CFLAGS} -xarch=v9" - SWT_LFLAGS="-xarch=v9" + if [ ${OS} = 'SunOS' ]; then + SWT_PTR_CFLAGS="${SWT_PTR_CFLAGS} -m64" + SWT_LFLAGS=-m64 SWT_CDE_64SUFFIX="/64" export SWT_LFLAGS SWT_CDE_64SUFFIX fi @@ -495,9 +518,11 @@ export SWT_LFLAGS SWT_PTR_CFLAGS fi -if [ x`pkg-config --exists gnome-vfs-module-2.0 libgnome-2.0 libgnomeui-2.0 && echo YES` = "xYES" -a ${MODEL} != "sparc64" -a ${MODEL} != 'ia64' -a ${GTK_VERSION} != '3.0' ]; then - echo "libgnomeui-2.0 found, compiling SWT program support using GNOME" - MAKE_GNOME=make_gnome +if [ x`pkg-config --exists gnome-vfs-module-2.0 libgnome-2.0 libgnomeui-2.0 && echo YES` = "xYES" -a ${MODEL} != "sparcv9" -a ${MODEL} != 'ia64' -a ${GTK_VERSION} != '3.0' ]; then + if [ "${SWT_OS}" != "solaris" -o "${MODEL}" != "x86_64" ]; then + echo "libgnomeui-2.0 found, compiling SWT program support using GNOME" + MAKE_GNOME=make_gnome + fi else if [ ${GTK_VERSION} != '3.0' ]; then echo "libgnome-2.0 and libgnomeui-2.0 not found:" @@ -513,7 +538,7 @@ echo " *** Advanced graphics support using cairo will not be compiled." fi -if [ -z "${MOZILLA_INCLUDES}" -a -z "${MOZILLA_LIBS}" -a ${MODEL} != 'sparc64' ]; then +if [ -z "${MOZILLA_INCLUDES}" -a -z "${MOZILLA_LIBS}" -a ${SWT_OS} != 'solaris' ]; then if [ x`pkg-config --exists mozilla-xpcom && echo YES` = "xYES" ]; then MOZILLA_INCLUDES=`pkg-config --cflags mozilla-xpcom` MOZILLA_LIBS=`pkg-config --libs mozilla-xpcom` diff -Nru swt4-gtk-4.5.0/c.c swt4-gtk-4.6.0/c.c --- swt4-gtk-4.5.0/c.c 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/c.c 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -101,24 +101,10 @@ #else C_NATIVE_ENTER(env, that, memmove__J_3BJ_FUNC); #endif -#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)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; - } memmove((void *)arg0, (const void *)lparg1, (size_t)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)->ReleaseByteArrayElements(env, arg1, lparg1, JNI_ABORT); - } #ifndef JNI64 C_NATIVE_EXIT(env, that, memmove__I_3BI_FUNC); #else @@ -140,24 +126,10 @@ #else C_NATIVE_ENTER(env, that, memmove__J_3CJ_FUNC); #endif -#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; - } memmove((void *)arg0, (const void *)lparg1, (size_t)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); - } #ifndef JNI64 C_NATIVE_EXIT(env, that, memmove__I_3CI_FUNC); #else @@ -179,24 +151,10 @@ #else C_NATIVE_ENTER(env, that, memmove__J_3DJ_FUNC); #endif -#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)->GetDoubleArrayElements(env, arg1, NULL)) == NULL) goto fail; - } memmove((void *)arg0, (const void *)lparg1, (size_t)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)->ReleaseDoubleArrayElements(env, arg1, lparg1, JNI_ABORT); - } #ifndef JNI64 C_NATIVE_EXIT(env, that, memmove__I_3DI_FUNC); #else @@ -218,24 +176,10 @@ #else C_NATIVE_ENTER(env, that, memmove__J_3FJ_FUNC); #endif -#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)->GetFloatArrayElements(env, arg1, NULL)) == NULL) goto fail; - } memmove((void *)arg0, (const void *)lparg1, (size_t)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)->ReleaseFloatArrayElements(env, arg1, lparg1, JNI_ABORT); - } #ifndef JNI64 C_NATIVE_EXIT(env, that, memmove__I_3FI_FUNC); #else @@ -257,24 +201,10 @@ #else C_NATIVE_ENTER(env, that, memmove__J_3IJ_FUNC); #endif -#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)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail; - } memmove((void *)arg0, (const void *)lparg1, (size_t)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)->ReleaseIntArrayElements(env, arg1, lparg1, JNI_ABORT); - } #ifndef JNI64 C_NATIVE_EXIT(env, that, memmove__I_3II_FUNC); #else @@ -296,24 +226,10 @@ #else C_NATIVE_ENTER(env, that, memmove__J_3JJ_FUNC); #endif -#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)->GetLongArrayElements(env, arg1, NULL)) == NULL) goto fail; - } memmove((void *)arg0, (const void *)lparg1, (size_t)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)->ReleaseLongArrayElements(env, arg1, lparg1, JNI_ABORT); - } #ifndef JNI64 C_NATIVE_EXIT(env, that, memmove__I_3JI_FUNC); #else @@ -335,24 +251,10 @@ #else C_NATIVE_ENTER(env, that, memmove__J_3SJ_FUNC); #endif -#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)->GetShortArrayElements(env, arg1, NULL)) == NULL) goto fail; - } memmove((void *)arg0, (const void *)lparg1, (size_t)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)->ReleaseShortArrayElements(env, arg1, lparg1, JNI_ABORT); - } #ifndef JNI64 C_NATIVE_EXIT(env, that, memmove__I_3SI_FUNC); #else @@ -374,24 +276,10 @@ #else C_NATIVE_ENTER(env, that, memmove___3BJJ_FUNC); #endif -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail; - } else -#endif - { - if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; - } memmove((void *)lparg0, (const void *)arg1, (size_t)arg2); fail: -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, 0); - } else -#endif - { - if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); - } #ifndef JNI64 C_NATIVE_EXIT(env, that, memmove___3BII_FUNC); #else @@ -414,28 +302,12 @@ #else C_NATIVE_ENTER(env, that, memmove___3B_3CJ_FUNC); #endif -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail; if (arg1) if ((lparg1 = (*env)->GetPrimitiveArrayCritical(env, arg1, NULL)) == NULL) goto fail; - } else -#endif - { - if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; - if (arg1) if ((lparg1 = (*env)->GetCharArrayElements(env, arg1, NULL)) == NULL) goto fail; - } memmove((void *)lparg0, (const void *)lparg1, (size_t)arg2); fail: -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg1 && lparg1) (*env)->ReleasePrimitiveArrayCritical(env, arg1, lparg1, JNI_ABORT); if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, 0); - } else -#endif - { - if (arg1 && lparg1) (*env)->ReleaseCharArrayElements(env, arg1, lparg1, JNI_ABORT); - if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); - } #ifndef JNI64 C_NATIVE_EXIT(env, that, memmove___3B_3CI_FUNC); #else @@ -457,24 +329,10 @@ #else C_NATIVE_ENTER(env, that, memmove___3CJJ_FUNC); #endif -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail; - } else -#endif - { - if (arg0) if ((lparg0 = (*env)->GetCharArrayElements(env, arg0, NULL)) == NULL) goto fail; - } memmove((void *)lparg0, (const void *)arg1, (size_t)arg2); fail: -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, 0); - } else -#endif - { - if (arg0 && lparg0) (*env)->ReleaseCharArrayElements(env, arg0, lparg0, 0); - } #ifndef JNI64 C_NATIVE_EXIT(env, that, memmove___3CII_FUNC); #else @@ -496,24 +354,10 @@ #else C_NATIVE_ENTER(env, that, memmove___3DJJ_FUNC); #endif -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail; - } else -#endif - { - if (arg0) if ((lparg0 = (*env)->GetDoubleArrayElements(env, arg0, NULL)) == NULL) goto fail; - } memmove((void *)lparg0, (const void *)arg1, (size_t)arg2); fail: -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, 0); - } else -#endif - { - if (arg0 && lparg0) (*env)->ReleaseDoubleArrayElements(env, arg0, lparg0, 0); - } #ifndef JNI64 C_NATIVE_EXIT(env, that, memmove___3DII_FUNC); #else @@ -535,24 +379,10 @@ #else C_NATIVE_ENTER(env, that, memmove___3FJJ_FUNC); #endif -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail; - } else -#endif - { - if (arg0) if ((lparg0 = (*env)->GetFloatArrayElements(env, arg0, NULL)) == NULL) goto fail; - } memmove((void *)lparg0, (const void *)arg1, (size_t)arg2); fail: -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, 0); - } else -#endif - { - if (arg0 && lparg0) (*env)->ReleaseFloatArrayElements(env, arg0, lparg0, 0); - } #ifndef JNI64 C_NATIVE_EXIT(env, that, memmove___3FII_FUNC); #else @@ -574,24 +404,10 @@ #else C_NATIVE_ENTER(env, that, memmove___3IJJ_FUNC); #endif -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail; - } else -#endif - { - if (arg0) if ((lparg0 = (*env)->GetIntArrayElements(env, arg0, NULL)) == NULL) goto fail; - } memmove((void *)lparg0, (const void *)arg1, (size_t)arg2); fail: -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, 0); - } else -#endif - { - if (arg0 && lparg0) (*env)->ReleaseIntArrayElements(env, arg0, lparg0, 0); - } #ifndef JNI64 C_NATIVE_EXIT(env, that, memmove___3III_FUNC); #else @@ -615,24 +431,10 @@ C_NATIVE_ENTER(env, that, memmove___3I_3BJ_FUNC); #endif if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail; - } else -#endif - { - if (arg0) if ((lparg0 = (*env)->GetIntArrayElements(env, arg0, NULL)) == NULL) goto fail; - } memmove((void *)lparg0, (const void *)lparg1, (size_t)arg2); fail: -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, 0); - } else -#endif - { - if (arg0 && lparg0) (*env)->ReleaseIntArrayElements(env, arg0, lparg0, 0); - } if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); #ifndef JNI64 C_NATIVE_EXIT(env, that, memmove___3I_3BI_FUNC); @@ -655,24 +457,10 @@ #else C_NATIVE_ENTER(env, that, memmove___3JJJ_FUNC); #endif -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail; - } else -#endif - { - if (arg0) if ((lparg0 = (*env)->GetLongArrayElements(env, arg0, NULL)) == NULL) goto fail; - } memmove((void *)lparg0, (const void *)arg1, (size_t)arg2); fail: -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, 0); - } else -#endif - { - if (arg0 && lparg0) (*env)->ReleaseLongArrayElements(env, arg0, lparg0, 0); - } #ifndef JNI64 C_NATIVE_EXIT(env, that, memmove___3JII_FUNC); #else @@ -694,24 +482,10 @@ #else C_NATIVE_ENTER(env, that, memmove___3SJJ_FUNC); #endif -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail; - } else -#endif - { - if (arg0) if ((lparg0 = (*env)->GetShortArrayElements(env, arg0, NULL)) == NULL) goto fail; - } memmove((void *)lparg0, (const void *)arg1, (size_t)arg2); fail: -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, 0); - } else -#endif - { - if (arg0 && lparg0) (*env)->ReleaseShortArrayElements(env, arg0, lparg0, 0); - } #ifndef JNI64 C_NATIVE_EXIT(env, that, memmove___3SII_FUNC); #else @@ -731,6 +505,25 @@ return rc; } #endif + +#ifndef NO_setenv +JNIEXPORT jint JNICALL C_NATIVE(setenv) + (JNIEnv *env, jclass that, jbyteArray arg0, jbyteArray arg1, jint arg2) +{ + jbyte *lparg0=NULL; + jbyte *lparg1=NULL; + jint rc = 0; + C_NATIVE_ENTER(env, that, setenv_FUNC); + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; + rc = (jint)setenv((const char *)lparg0, (const char *)lparg1, arg2); +fail: + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + C_NATIVE_EXIT(env, that, setenv_FUNC); + return rc; +} +#endif #ifndef NO_strlen JNIEXPORT jint JNICALL C_NATIVE(strlen) diff -Nru swt4-gtk-4.5.0/c_stats.c swt4-gtk-4.6.0/c_stats.c --- swt4-gtk-4.5.0/c_stats.c 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/c_stats.c 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -105,6 +105,7 @@ "memmove___3SJJ", #endif "memset", + "setenv", "strlen", }; #define NATIVE_FUNCTION_COUNT sizeof(C_nativeFunctionNames) / sizeof(char*) diff -Nru swt4-gtk-4.5.0/c_stats.h swt4-gtk-4.6.0/c_stats.h --- swt4-gtk-4.5.0/c_stats.h 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/c_stats.h 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -115,5 +115,6 @@ memmove___3SJJ_FUNC, #endif memset_FUNC, + setenv_FUNC, strlen_FUNC, } C_FUNCS; diff -Nru swt4-gtk-4.5.0/debian/changelog swt4-gtk-4.6.0/debian/changelog --- swt4-gtk-4.5.0/debian/changelog 2016-05-01 14:45:16.000000000 +0000 +++ swt4-gtk-4.6.0/debian/changelog 2016-07-26 04:53:04.000000000 +0000 @@ -1,3 +1,19 @@ +swt4-gtk (4.6.0-2) unstable; urgency=medium + + * Team upload. + * Upload of version 4.6.0 to unstable. + + -- tony mancill Mon, 25 Jul 2016 21:52:32 -0700 + +swt4-gtk (4.6.0-1) experimental; urgency=medium + + * New upstream release. + * Drop d/patches/format-security.diff + - fixed upstream. + * Bump minimum Java version to 1.7. + + -- Jakub Adam Wed, 06 Jul 2016 21:03:55 +0200 + swt4-gtk (4.5.0-3) unstable; urgency=medium * Enable compatibility with GTK 2.0 diff -Nru swt4-gtk-4.5.0/debian/libswt-gtk-4-java.links swt4-gtk-4.6.0/debian/libswt-gtk-4-java.links --- swt4-gtk-4.5.0/debian/libswt-gtk-4-java.links 2016-04-15 04:18:14.000000000 +0000 +++ swt4-gtk-4.6.0/debian/libswt-gtk-4-java.links 2016-07-07 17:48:10.000000000 +0000 @@ -1,2 +1,2 @@ -usr/lib/java/swt-gtk-4.5.0.jar usr/share/java/swt-gtk-4.5.jar -usr/share/java/swt-gtk-4.5.jar usr/share/java/swt4.jar +usr/lib/java/swt-gtk-4.6.0.jar usr/share/java/swt-gtk-4.6.jar +usr/share/java/swt-gtk-4.6.jar usr/share/java/swt4.jar diff -Nru swt4-gtk-4.5.0/debian/Makefile swt4-gtk-4.6.0/debian/Makefile --- swt4-gtk-4.5.0/debian/Makefile 2016-05-01 14:44:48.000000000 +0000 +++ swt4-gtk-4.6.0/debian/Makefile 2016-07-07 17:48:10.000000000 +0000 @@ -3,7 +3,7 @@ CLEANFILES=*.files *.jar *-stamp JAR=fastjar -JAVAC=javac -classpath . -source 1.5 -target 1.5 +JAVAC=javac -classpath . -source 1.7 -target 1.7 RM=rm -f all: $(JAVA) diff -Nru swt4-gtk-4.5.0/debian/manifest swt4-gtk-4.6.0/debian/manifest --- swt4-gtk-4.5.0/debian/manifest 2015-08-29 19:57:49.000000000 +0000 +++ swt4-gtk-4.6.0/debian/manifest 2016-07-07 17:48:10.000000000 +0000 @@ -1,4 +1,4 @@ -usr/share/java/swt-gtk-4.5.jar: +usr/share/java/swt4.jar: Bundle-ManifestVersion: 2 Bundle-Name: Standard Widget Toolkit Bundle-SymbolicName: org.eclipse.swt diff -Nru swt4-gtk-4.5.0/debian/patches/format-security.diff swt4-gtk-4.6.0/debian/patches/format-security.diff --- swt4-gtk-4.5.0/debian/patches/format-security.diff 2015-08-29 03:00:14.000000000 +0000 +++ swt4-gtk-4.6.0/debian/patches/format-security.diff 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -Description: Fix FTBFS with -Werror=format-security compiler flag set -Author: أحمد المحمودي (Ahmed El-Mahmoudy) -Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=359538 -Forwarded: https://bugs.eclipse.org/bugs/attachment.cgi?id=204356 ---- a/os.c -+++ b/os.c -@@ -10830,7 +10830,7 @@ - jintLong rc = 0; - OS_NATIVE_ENTER(env, that, _1gtk_1message_1dialog_1new_FUNC); - if (arg4) if ((lparg4 = (*env)->GetByteArrayElements(env, arg4, NULL)) == NULL) goto fail; -- rc = (jintLong)gtk_message_dialog_new((GtkWindow *)arg0, (GtkDialogFlags)arg1, (GtkMessageType)arg2, (GtkButtonsType)arg3, (const gchar *)lparg4); -+ rc = (jintLong)gtk_message_dialog_new((GtkWindow *)arg0, (GtkDialogFlags)arg1, (GtkMessageType)arg2, (GtkButtonsType)arg3, "%s", (const gchar *)lparg4); - fail: - if (arg4 && lparg4) (*env)->ReleaseByteArrayElements(env, arg4, lparg4, 0); - OS_NATIVE_EXIT(env, that, _1gtk_1message_1dialog_1new_FUNC); diff -Nru swt4-gtk-4.5.0/debian/patches/series swt4-gtk-4.6.0/debian/patches/series --- swt4-gtk-4.5.0/debian/patches/series 2015-08-29 03:00:14.000000000 +0000 +++ swt4-gtk-4.6.0/debian/patches/series 2016-07-07 17:48:10.000000000 +0000 @@ -1,3 +1,2 @@ 01-make_linux.patch -format-security.diff search-usr-lib-jni.diff diff -Nru swt4-gtk-4.5.0/make_common.mak swt4-gtk-4.6.0/make_common.mak --- swt4-gtk-4.5.0/make_common.mak 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/make_common.mak 2016-07-06 19:11:33.000000000 +0000 @@ -10,5 +10,5 @@ #******************************************************************************* maj_ver=4 -min_ver=527 -comma_ver=4,5,2,7 +min_ver=623 +comma_ver=4,6,2,3 diff -Nru swt4-gtk-4.5.0/make_solaris_x86_64.mak swt4-gtk-4.6.0/make_solaris_x86_64.mak --- swt4-gtk-4.5.0/make_solaris_x86_64.mak 1970-01-01 00:00:00.000000000 +0000 +++ swt4-gtk-4.6.0/make_solaris_x86_64.mak 2016-07-06 19:11:33.000000000 +0000 @@ -0,0 +1,295 @@ +#******************************************************************************* +# Copyright (c) 2000, 2016 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 +#******************************************************************************* + +# Makefile for creating SWT libraries for Solaris GTK (x86_64) + +include make_common.mak + +SWT_VERSION=$(maj_ver)$(min_ver) +GTK_VERSION?=2.0 + +# Define the various shared libraries to be build. +WS_PREFIX = gtk +SWT_PREFIX = swt +CDE_PREFIX = swt-cde +AWT_PREFIX = swt-awt +SWTPI_PREFIX = swt-pi +CAIRO_PREFIX = swt-cairo +ATK_PREFIX = swt-atk +GNOME_PREFIX = swt-gnome +MOZILLA_PREFIX = swt-mozilla$(GCC_VERSION) +XULRUNNER_PREFIX = swt-xulrunner +XPCOMINIT_PREFIX = swt-xpcominit +GLX_PREFIX = swt-glx + +SWT_LIB = lib$(SWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so +CDE_LIB = lib$(CDE_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so +AWT_LIB = lib$(AWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so +SWTPI_LIB = lib$(SWTPI_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so +CAIRO_LIB = lib$(CAIRO_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so +ATK_LIB = lib$(ATK_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so +GNOME_LIB = lib$(GNOME_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so +MOZILLA_LIB = lib$(MOZILLA_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so +XULRUNNER_LIB = lib$(XULRUNNER_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so +XPCOMINIT_LIB = lib$(XPCOMINIT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so +GLX_LIB = lib$(GLX_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so + +CAIROCFLAGS = `pkg-config --cflags cairo` +CAIROLIBS = `pkg-config --libs-only-L cairo` -lcairo + +# Do not use pkg-config to get libs because it includes unnecessary dependencies (i.e. pangoxft-1.0) +GTKCFLAGS = `pkg-config --cflags gtk+-2.0 gtk+-unix-print-$(GTK_VERSION)` +GTKLIBS = `pkg-config --libs-only-L gtk+-2.0 gthread-2.0` -lgtk-x11-2.0 -lgthread-2.0 -L/usr/X11R6/lib $(XLIB64) -lXtst + +CDE_LIBS = -L$(CDE_HOME)/lib -R$(CDE_HOME)/lib -lXt -lX11 -lDtSvc + +AWT_LFLAGS = -G ${SWT_PTR_CFLAGS} +AWT_LIBS = -L$(AWT_LIB_PATH) -ljawt + +ATKCFLAGS = `pkg-config --cflags atk gtk+-2.0 gtk+-unix-print-$(GTK_VERSION)` +ATKLIBS = `pkg-config --libs-only-L atk gtk+-2.0` -latk-1.0 -lgtk-x11-2.0 + +GNOMECFLAGS = `pkg-config --cflags gnome-vfs-module-2.0 libgnome-2.0 libgnomeui-2.0` +GNOMELIBS = `pkg-config --libs-only-L gnome-vfs-module-2.0 libgnome-2.0 libgnomeui-2.0` -lgnomevfs-2 -lgnome-2 -lgnomeui-2 + +GLXLIBS = -L/usr/X11R6/lib -lGL -lGLU -lm + +# Uncomment for Native Stats tool +#NATIVE_STATS = -DNATIVE_STATS + +MOZILLACFLAGS = -O \ + -DSWT_VERSION=$(SWT_VERSION) \ + $(NATIVE_STATS) \ + -DMOZILLA_STRICT_API=1 \ + -KPIC \ + +w \ + -I. \ + -I$(JAVA_HOME)/include \ + -I$(JAVA_HOME)/include/solaris \ + ${SWT_PTR_CFLAGS} +MOZILLALFLAGS = -G +MOZILLAEXCLUDES = -DNO__1XPCOMGlueShutdown \ + -DNO__1XPCOMGlueStartup \ + -DNO__1XPCOMGlueLoadXULFunctions \ + -DNO_memmove__ILorg_eclipse_swt_internal_mozilla_nsDynamicFunctionLoad_2I \ + -DNO_memmove__JLorg_eclipse_swt_internal_mozilla_nsDynamicFunctionLoad_2J \ + -DNO_nsDynamicFunctionLoad_1sizeof \ + -DNO__1Call__IIIIII \ + -DNO__1Call__JJJJJI \ + -DNO_nsDynamicFunctionLoad +XULRUNNEREXCLUDES = -DNO__1NS_1InitXPCOM2 + +SWT_OBJECTS = swt.o c.o c_stats.o callback.o +CDE_OBJECTS = swt.o cde.o cde_structs.o cde_stats.o +AWT_OBJECTS = swt_awt.o +SWTPI_OBJECTS = swt.o os.o os_structs.o os_custom.o os_stats.o +CAIRO_OBJECTS = swt.o cairo.o cairo_structs.o cairo_stats.o +ATK_OBJECTS = swt.o atk.o atk_structs.o atk_custom.o atk_stats.o +GNOME_OBJECTS = swt.o gnome.o gnome_structs.o gnome_stats.o +MOZILLA_OBJECTS = swt.o xpcom.o xpcom_custom.o xpcom_structs.o xpcom_stats.o +XULRUNNER_OBJECTS = swt.o xpcomxul.o xpcomxul_custom.o xpcomxul_structs.o xpcomxul_stats.o +XPCOMINIT_OBJECTS = swt.o xpcominit.o xpcominit_structs.o xpcominit_stats.o +GLX_OBJECTS = swt.o glx.o glx_structs.o glx_stats.o + +CFLAGS = -O +w \ + -DSWT_VERSION=$(SWT_VERSION) \ + $(NATIVE_STATS) \ + -DLINUX -DGTK \ + -I$(JAVA_HOME)/include \ + -I$(JAVA_HOME)/include/solaris \ + -KPIC \ + ${SWT_PTR_CFLAGS} +LFLAGS = -G -KPIC ${SWT_LFLAGS} + +ifndef NO_STRIP + AWT_LFLAGS := $(AWT_LFLAGS) -s + MOZILLALFLAGS := $(MOZILLALFLAGS) -s + LFLAGS := $(LFLAGS) -s +endif + +all: make_swt make_atk make_glx + +# +# SWT libs +# +make_swt: $(SWT_LIB) $(SWTPI_LIB) + +$(SWT_LIB): $(SWT_OBJECTS) + $(CC) $(LFLAGS) -o $(SWT_LIB) $(SWT_OBJECTS) + +callback.o: callback.c callback.h + $(CC) $(CFLAGS) -DUSE_ASSEMBLER -c callback.c + +$(SWTPI_LIB): $(SWTPI_OBJECTS) + $(CC) $(LFLAGS) -o $(SWTPI_LIB) $(SWTPI_OBJECTS) $(GTKLIBS) + +swt.o: swt.c swt.h + $(CC) $(CFLAGS) -c swt.c +os.o: os.c os.h swt.h os_custom.h + $(CC) $(CFLAGS) $(GTKCFLAGS) -c os.c +os_structs.o: os_structs.c os_structs.h os.h swt.h + $(CC) $(CFLAGS) $(GTKCFLAGS) -c os_structs.c +os_custom.o: os_custom.c os_structs.h os.h swt.h + $(CC) $(CFLAGS) $(GTKCFLAGS) -c os_custom.c +os_stats.o: os_stats.c os_structs.h os.h os_stats.h swt.h + $(CC) $(CFLAGS) $(GTKCFLAGS) -c os_stats.c + +# +# CAIRO libs +# +make_cairo: $(CAIRO_LIB) + +$(CAIRO_LIB): $(CAIRO_OBJECTS) + $(CC) $(LFLAGS) -o $(CAIRO_LIB) $(CAIRO_OBJECTS) $(CAIROLIBS) + +cairo.o: cairo.c cairo.h swt.h + $(CC) $(CFLAGS) $(CAIROCFLAGS) -c cairo.c +cairo_structs.o: cairo_structs.c cairo_structs.h cairo.h swt.h + $(CC) $(CFLAGS) $(CAIROCFLAGS) -c cairo_structs.c +cairo_stats.o: cairo_stats.c cairo_structs.h cairo.h cairo_stats.h swt.h + $(CC) $(CFLAGS) $(CAIROCFLAGS) -c cairo_stats.c + +# +# CDE lib +# + +make_cde: $(CDE_LIB) + +$(CDE_LIB): $(CDE_OBJECTS) + $(CC) $(LFLAGS) -o $(CDE_LIB) $(CDE_OBJECTS) $(CDE_LIBS) + +# +# AWT lib +# +make_awt:$(AWT_LIB) + +$(AWT_LIB): $(AWT_OBJECTS) + $(CC) $(AWT_LFLAGS) -o $(AWT_LIB) $(AWT_OBJECTS) $(AWT_LIBS) + +# +# Atk lib +# +make_atk: $(ATK_LIB) + +$(ATK_LIB): $(ATK_OBJECTS) + $(CC) $(LFLAGS) -o $(ATK_LIB) $(ATK_OBJECTS) $(ATKLIBS) + +atk.o: atk.c atk.h + $(CC) $(CFLAGS) $(ATKCFLAGS) -c atk.c +atk_structs.o: atk_structs.c atk_structs.h atk.h + $(CC) $(CFLAGS) $(ATKCFLAGS) -c atk_structs.c +atk_custom.o: atk_custom.c atk_structs.h atk.h + $(CC) $(CFLAGS) $(ATKCFLAGS) -c atk_custom.c +atk_stats.o: atk_stats.c atk_structs.h atk_stats.h atk.h + $(CC) $(CFLAGS) $(ATKCFLAGS) -c atk_stats.c + +# +# Gnome lib +# +make_gnome: $(GNOME_LIB) + +$(GNOME_LIB): $(GNOME_OBJECTS) + $(CC) $(LFLAGS) -o $(GNOME_LIB) $(GNOME_OBJECTS) $(GNOMELIBS) + +gnome.o: gnome.c + $(CC) $(CFLAGS) $(GNOMECFLAGS) -c gnome.c + +gnome_structs.o: gnome_structs.c + $(CC) $(CFLAGS) $(GNOMECFLAGS) -c gnome_structs.c + +gnome_stats.o: gnome_stats.c gnome_stats.h + $(CC) $(CFLAGS) $(GNOMECFLAGS) -c gnome_stats.c + +# +# Mozilla lib +# +make_mozilla:$(MOZILLA_LIB) + +$(MOZILLA_LIB): $(MOZILLA_OBJECTS) + $(CXX) -o $(MOZILLA_LIB) $(MOZILLA_OBJECTS) $(MOZILLALFLAGS) ${MOZILLA_LIBS} + +xpcom.o: xpcom.cpp + $(CXX) $(MOZILLACFLAGS) $(MOZILLAEXCLUDES) ${MOZILLA_INCLUDES} -c xpcom.cpp + +xpcom_structs.o: xpcom_structs.cpp + $(CXX) $(MOZILLACFLAGS) $(MOZILLAEXCLUDES) ${MOZILLA_INCLUDES} -c xpcom_structs.cpp + +xpcom_custom.o: xpcom_custom.cpp + $(CXX) $(MOZILLACFLAGS) $(MOZILLAEXCLUDES) ${MOZILLA_INCLUDES} -c xpcom_custom.cpp + +xpcom_stats.o: xpcom_stats.cpp + $(CXX) $(MOZILLACFLAGS) $(MOZILLAEXCLUDES) ${MOZILLA_INCLUDES} -c xpcom_stats.cpp + +# +# XULRunner lib +# +make_xulrunner:$(XULRUNNER_LIB) + +$(XULRUNNER_LIB): $(XULRUNNER_OBJECTS) + $(CXX) -o $(XULRUNNER_LIB) $(XULRUNNER_OBJECTS) $(MOZILLALFLAGS) ${XULRUNNER_LIBS} + +xpcomxul.o: xpcom.cpp + $(CXX) -o xpcomxul.o $(MOZILLACFLAGS) $(XULRUNNEREXCLUDES) ${XULRUNNER_INCLUDES} -c xpcom.cpp + +xpcomxul_structs.o: xpcom_structs.cpp + $(CXX) -o xpcomxul_structs.o $(MOZILLACFLAGS) $(XULRUNNEREXCLUDES) ${XULRUNNER_INCLUDES} -c xpcom_structs.cpp + +xpcomxul_custom.o: xpcom_custom.cpp + $(CXX) -o xpcomxul_custom.o $(MOZILLACFLAGS) $(XULRUNNEREXCLUDES) ${XULRUNNER_INCLUDES} -c xpcom_custom.cpp + +xpcomxul_stats.o: xpcom_stats.cpp + $(CXX) -o xpcomxul_stats.o $(MOZILLACFLAGS) $(XULRUNNEREXCLUDES) ${XULRUNNER_INCLUDES} -c xpcom_stats.cpp + +# +# XPCOMInit lib +# +make_xpcominit:$(XPCOMINIT_LIB) + +$(XPCOMINIT_LIB): $(XPCOMINIT_OBJECTS) + $(CXX) -o $(XPCOMINIT_LIB) $(XPCOMINIT_OBJECTS) $(MOZILLALFLAGS) ${XULRUNNER_LIBS} + +xpcominit.o: xpcominit.cpp + $(CXX) $(MOZILLACFLAGS) ${XULRUNNER_INCLUDES} -c xpcominit.cpp + +xpcominit_structs.o: xpcominit_structs.cpp + $(CXX) $(MOZILLACFLAGS) ${XULRUNNER_INCLUDES} -c xpcominit_structs.cpp + +xpcominit_stats.o: xpcominit_stats.cpp + $(CXX) $(MOZILLACFLAGS) ${XULRUNNER_INCLUDES} -c xpcominit_stats.cpp + +# +# GLX lib +# +make_glx: $(GLX_LIB) + +$(GLX_LIB): $(GLX_OBJECTS) + $(CC) $(LFLAGS) -o $(GLX_LIB) $(GLX_OBJECTS) $(GLXLIBS) + +glx.o: glx.c + $(CC) $(CFLAGS) $(GLXCFLAGS) -c glx.c + +glx_structs.o: glx_structs.c + $(CC) $(CFLAGS) $(GLXCFLAGS) -c glx_structs.c + +glx_stats.o: glx_stats.c glx_stats.h + $(CC) $(CFLAGS) $(GLXCFLAGS) -c glx_stats.c + +# +# Install +# +install: all + cp *.so $(OUTPUT_DIR) + +# +# Clean +# +clean: + rm -f *.o *.so diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleActionAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleActionAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleActionAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleActionAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 2016 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 @@ -31,33 +31,36 @@ * If there are more than one, the first one (index 0) is considered the * "default" action of the object. *

- * + * * @param e an event object containing the following fields:
    *
  • [out] count - the number of actions, or zero if there are no actions
  • *
*/ + @Override public void getActionCount(AccessibleActionEvent e) {} /** * Performs the specified action on the object. - * + * * @param e an event object containing the following fields:
    *
  • [in] index - a 0 based index specifying the action to perform. * If the index lies outside the valid range no action is performed.
  • *
  • [out] result - set to {@link ACC#OK} if the action was performed.
  • *
*/ + @Override public void doAction(AccessibleActionEvent e) {} /** * Returns a description of the specified action. - * + * * @param e an event object containing the following fields:
    *
  • [in] index - a 0 based index specifying which action's description to return
  • *
  • [out] result - a localized string describing the specified action, * or null if the index lies outside the valid range
  • *
*/ + @Override public void getDescription(AccessibleActionEvent e) {} /** @@ -67,13 +70,14 @@ * The returned string is of the following form: mnemonic;accelerator * for example: "C;CTRL+C" for the Copy item in a typical Edit menu. *

- * + * * @param e an event object containing the following fields:
    *
  • [in] index - a 0 based index specifying which action's key bindings to return
  • *
  • [out] result - a semicolon-delimited string of localized key bindings * (example: "C;CTRL+C"), or null if the index lies outside the valid range
  • *
*/ + @Override public void getKeyBinding(AccessibleActionEvent e) {} /** @@ -82,7 +86,7 @@ * There is no need to implement this method for single action controls * since that would be redundant with AccessibleControlListener.getDefaultAction. *

- * + * * @param e an event object containing the following fields:
    *
  • [in] index - a 0 based index specifying which action's name to return
  • *
  • [in] localized - a boolean indicating whether or not to return a localized name
  • @@ -90,5 +94,6 @@ * or null if the index lies outside the valid range *
*/ + @Override public void getName(AccessibleActionEvent e) {} } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleActionListener.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleActionListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleActionListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleActionListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -34,7 +34,7 @@ * If there are more than one, the first one (index 0) is considered the * "default" action of the object. *

- * + * * @param e an event object containing the following fields:
    *
  • [out] count - the number of actions, or zero if there are no actions
  • *
@@ -43,7 +43,7 @@ /** * Performs the specified action on the object. - * + * * @param e an event object containing the following fields:
    *
  • [in] index - a 0 based index specifying the action to perform. * If the index lies outside the valid range no action is performed.
  • @@ -54,7 +54,7 @@ /** * Returns a description of the specified action. - * + * * @param e an event object containing the following fields:
      *
    • [in] index - a 0 based index specifying which action's description to return
    • *
    • [out] result - a localized string describing the specified action, @@ -70,7 +70,7 @@ * The returned string is of the following form: mnemonic;accelerator * for example: "C;CTRL+C" for the Copy item in a typical Edit menu. *

      - * + * * @param e an event object containing the following fields:
        *
      • [in] index - a 0 based index specifying which action's key bindings to return
      • *
      • [out] result - a semicolon-delimited string of localized key bindings @@ -85,7 +85,7 @@ * There is no need to implement this method for single action controls * since that would be redundant with AccessibleControlListener.getDefaultAction. *

        - * + * * @param e an event object containing the following fields:
          *
        • [in] index - a 0 based index specifying which action's name to return
        • *
        • [in] localized - a boolean indicating whether or not to return a localized name
        • diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -28,7 +28,7 @@ * @see AccessibleListener * @see AccessibleEvent * @see Sample code and further information - * + * * @since 2.0 */ public abstract class AccessibleAdapter implements AccessibleListener { @@ -50,9 +50,10 @@ *
        • result [OUT] - the requested name string, or null
        • *
        */ + @Override public void getName(AccessibleEvent e) { } - + /** * Sent when an accessibility client requests the help string * of the control, or the help string of a child of the control. @@ -75,9 +76,10 @@ *
      • result [OUT] - the requested help string, or null
      • *
      */ + @Override public void getHelp(AccessibleEvent e) { } - + /** * Sent when an accessibility client requests the keyboard shortcut * of the control, or the keyboard shortcut of a child of the control. @@ -100,9 +102,10 @@ *
    • result [OUT] - the requested keyboard shortcut string (example: "ALT+N"), or null
    • *
    */ + @Override public void getKeyboardShortcut(AccessibleEvent e) { } - + /** * Sent when an accessibility client requests a description * of the control, or a description of a child of the control. @@ -124,6 +127,7 @@ *
  • result [OUT] - the requested description string, or null
  • *
*/ + @Override public void getDescription(AccessibleEvent e) { } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleAttributeAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleAttributeAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleAttributeAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleAttributeAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2013 IBM Corporation and others. + * Copyright (c) 2009, 2016 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 @@ -28,7 +28,7 @@ public class AccessibleAttributeAdapter implements AccessibleAttributeListener { /** * Returns attributes specific to this Accessible object. - * + * * @param e an event object containing the following fields:
    *
  • [out] topMargin - the top margin in pixels
  • *
  • [out] bottomMargin - the bottom margin in pixels
  • @@ -45,11 +45,12 @@ * which represent additional (i.e. non predefined) attributes *
*/ + @Override public void getAttributes(AccessibleAttributeEvent e) {} /** * Returns text attributes specific to this Accessible object. - * + * * @param e an event object containing the following fields:
    *
  • [in] offset - the 0 based text offset for which to return attribute information
  • *
  • [out] start - the 0 based starting offset of the character range @@ -61,5 +62,6 @@ * that represent additional attributes that do not correspond to TextStyle fields
  • *
*/ + @Override public void getTextAttributes(AccessibleTextAttributeEvent e) {} } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleAttributeEvent.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleAttributeEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleAttributeEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleAttributeEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -24,65 +24,65 @@ public class AccessibleAttributeEvent extends SWTEventObject { /** - * [out] the top margin in pixels - * + * [out] the top margin in pixels + * * @see AccessibleAttributeListener#getAttributes */ public int topMargin; /** - * [out] the bottom margin in pixels - * + * [out] the bottom margin in pixels + * * @see AccessibleAttributeListener#getAttributes */ public int bottomMargin; /** - * [out] the left margin in pixels - * + * [out] the left margin in pixels + * * @see AccessibleAttributeListener#getAttributes */ public int leftMargin; /** - * [out] the right margin in pixels - * + * [out] the right margin in pixels + * * @see AccessibleAttributeListener#getAttributes */ public int rightMargin; /** * [out] an array of pixel locations representing tab stops - * + * * @see AccessibleAttributeListener#getAttributes */ public int[] tabStops; /** - * [out] whether or not to justify the text - * + * [out] whether or not to justify the text + * * @see AccessibleAttributeListener#getAttributes */ public boolean justify; /** - * [out] the alignment, which is one of SWT#LEFT, SWT#RIGHT or SWT#CENTER - * + * [out] the alignment, which is one of SWT#LEFT, SWT#RIGHT or SWT#CENTER + * * @see AccessibleAttributeListener#getAttributes */ public int alignment; /** - * [out] the indent in pixels - * + * [out] the indent in pixels + * * @see AccessibleAttributeListener#getAttributes */ public int indent; - + /** * [out] the 1-based level of this accessible in its group * (0 means "not applicable") - * + * * @see AccessibleAttributeListener#getAttributes * @since 3.102 */ @@ -90,7 +90,7 @@ /** * [out] the 1-based number of similar children in this accessible's group, * including this accessible (0 means "not applicable") - * + * * @see AccessibleAttributeListener#getAttributes * @since 3.102 */ @@ -98,16 +98,16 @@ /** * [out] the 1-based index of this accessible in its group * (0 means "not applicable") - * + * * @see AccessibleAttributeListener#getAttributes * @since 3.102 */ public int groupIndex; - + /** * [out] an array of alternating key and value Strings which - * represent additional (i.e. non predefined) attributes - * + * represent additional (i.e. non predefined) attributes + * * @see AccessibleAttributeListener#getAttributes */ public String [] attributes; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleAttributeListener.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleAttributeListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleAttributeListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleAttributeListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -31,7 +31,7 @@ public interface AccessibleAttributeListener extends SWTEventListener { /** * Returns attributes specific to this Accessible object. - * + * * @param e an event object containing the following fields:
    *
  • [out] topMargin - the top margin in pixels
  • *
  • [out] bottomMargin - the bottom margin in pixels
  • @@ -52,7 +52,7 @@ /** * Returns text attributes specific to this Accessible object. - * + * * @param e an event object containing the following fields:
      *
    • [in] offset - the 0 based text offset for which to return attribute information
    • *
    • [out] start - the 0 based starting offset of the character range diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleControlAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleControlAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleControlAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleControlAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -34,7 +34,7 @@ * @see AccessibleControlListener * @see AccessibleControlEvent * @see Sample code and further information - * + * * @since 2.0 */ public abstract class AccessibleControlAdapter implements AccessibleControlListener { @@ -57,9 +57,10 @@ *
    • accessible [Optional OUT] - the accessible object for the control or child may be returned instead of the childID
    • *
    */ + @Override public void getChildAtPoint(AccessibleControlEvent e) { } - + /** * Sent when an accessibility client requests the location * of the control, or the location of a child of the control. @@ -75,9 +76,10 @@ *
  • x, y, width, height [OUT] - the control or child location in display coordinates
  • *
*/ + @Override public void getLocation(AccessibleControlEvent e) { } - + /** * Sent when an accessibility client requests the accessible object * for a child of the control by index or childID, or when a client @@ -98,9 +100,10 @@ *
  • accessible [Optional OUT] - an Accessible for the specified childID or index, or null if one does not exist
  • * */ + @Override public void getChild(AccessibleControlEvent e) { } - + /** * Sent when an accessibility client requests the number of * children in the control. @@ -114,9 +117,10 @@ *
  • detail [OUT] - the number of child items in this control
  • * */ + @Override public void getChildCount(AccessibleControlEvent e) { } - + /** * Sent when an accessibility client requests the default action * of the control, or the default action of a child of the control. @@ -136,9 +140,10 @@ *
  • result [OUT] - the requested default action string, or null
  • * */ + @Override public void getDefaultAction(AccessibleControlEvent e) { } - + /** * Sent when an accessibility client requests the identity of * the child or control that has keyboard focus. @@ -155,9 +160,10 @@ *
  • accessible [Optional OUT] - the accessible object for a child may be returned instead of its childID
  • * */ + @Override public void getFocus(AccessibleControlEvent e) { } - + /** * Sent when an accessibility client requests the role * of the control, or the role of a child of the control. @@ -173,9 +179,10 @@ *
  • detail [OUT] - a role constant describing the role of the control or child
  • * */ + @Override public void getRole(AccessibleControlEvent e) { } - + /** * Sent when an accessibility client requests the identity of * the child or control that is currently selected. @@ -194,9 +201,10 @@ *
  • accessible [Optional OUT] - the accessible object for the control or child may be returned instead of the childID
  • * */ + @Override public void getSelection(AccessibleControlEvent e) { } - + /** * Sent when an accessibility client requests the state * of the control, or the state of a child of the control. @@ -212,9 +220,10 @@ *
  • detail [OUT] - a state mask describing the current state of the control or child
  • * */ + @Override public void getState(AccessibleControlEvent e) { } - + /** * Sent when an accessibility client requests the value * of the control, or the value of a child of the control. @@ -236,9 +245,10 @@ *
  • result [OUT] - the requested value string, or null
  • * */ + @Override public void getValue(AccessibleControlEvent e) { } - + /** * Sent when an accessibility client requests the children, or visible children, * of the control. The default behavior is to do nothing. @@ -256,6 +266,7 @@ *
  • children [Optional OUT] - an array of accessible objects for the children may be returned instead of the childIDs
  • * */ + @Override public void getChildren(AccessibleControlEvent e) { } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleControlEvent.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleControlEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleControlEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleControlEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -27,7 +27,7 @@ * @see AccessibleControlListener * @see AccessibleControlAdapter * @see Sample code and further information - * + * * @since 2.0 */ public class AccessibleControlEvent extends SWTEventObject { @@ -38,9 +38,9 @@ public int detail; // IN/OUT public String result; // OUT public Object children[]; // [OUT] - + static final long serialVersionUID = 3257281444169529141L; - + /** * Constructs a new instance of this class. * @@ -67,5 +67,5 @@ " detail=" + detail + //$NON-NLS-1$ " result=" + result + //$NON-NLS-1$ "}"; //$NON-NLS-1$ -} +} } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleControlListener.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleControlListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleControlListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleControlListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -37,7 +37,7 @@ * * @see AccessibleControlAdapter * @see AccessibleControlEvent - * + * * @since 2.0 */ public interface AccessibleControlListener extends SWTEventListener { @@ -76,7 +76,7 @@ * */ public void getLocation(AccessibleControlEvent e); - + /** * Sent when an accessibility client requests the accessible object * for a child of the control by index or childID, or when a client @@ -98,7 +98,7 @@ * */ public void getChild(AccessibleControlEvent e); - + /** * Sent when an accessibility client requests the number of * children in the control. @@ -112,7 +112,7 @@ * */ public void getChildCount(AccessibleControlEvent e); - + /** * Sent when an accessibility client requests the default action * of the control, or the default action of a child of the control. @@ -132,7 +132,7 @@ * */ public void getDefaultAction(AccessibleControlEvent e); - + /** * Sent when an accessibility client requests the identity of * the child or control that has keyboard focus. @@ -149,7 +149,7 @@ * */ public void getFocus(AccessibleControlEvent e); - + /** * Sent when an accessibility client requests the role * of the control, or the role of a child of the control. @@ -165,7 +165,7 @@ * */ public void getRole(AccessibleControlEvent e); - + /** * Sent when an accessibility client requests the identity of * the child or control that is currently selected. @@ -184,7 +184,7 @@ * */ public void getSelection(AccessibleControlEvent e); - + /** * Sent when an accessibility client requests the state * of the control, or the state of a child of the control. @@ -200,7 +200,7 @@ * */ public void getState(AccessibleControlEvent e); - + /** * Sent when an accessibility client requests the value * of the control, or the value of a child of the control. @@ -222,7 +222,7 @@ * */ public void getValue(AccessibleControlEvent e); - + /** * Sent when an accessibility client requests the children, or visible children, * of the control. diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleEditableTextAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleEditableTextAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleEditableTextAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleEditableTextAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2011 IBM Corporation and others. + * Copyright (c) 2010, 2016 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 @@ -29,7 +29,7 @@ /** * Copies the substring beginning at the specified start offset * and extending to the character at offset end - 1 to the clipboard. - * + * * @param e an event object containing the following information:
      *
    • [in] start - the 0 based offset of the first character of the substring * to be copied to the clipboard
    • @@ -38,12 +38,13 @@ *
    • [out] result - set to {@link ACC#OK} if the operation was completed successfully
    • *
    */ + @Override public void copyText(AccessibleEditableTextEvent e) {} /** * Moves the substring beginning at the specified start offset * and extending to the character at offset end - 1 to the clipboard. - * + * * @param e an event object containing the following information:
      *
    • [in] start - the 0 based offset of the first character of the substring * to be moved to the clipboard
    • @@ -52,17 +53,19 @@ *
    • [out] result - set to {@link ACC#OK} if the operation was completed successfully
    • *
    */ + @Override public void cutText(AccessibleEditableTextEvent e) {} /** * Inserts the text in the clipboard at the leading edge of the specified start offset. - * + * * @param e an event object containing the following information:
      *
    • [in] start - the offset at which to insert the text from the clipboard. * The valid range is 0..length
    • *
    • [out] result - set to {@link ACC#OK} if the operation was completed successfully
    • *
    */ + @Override public void pasteText(AccessibleEditableTextEvent e) {} /** @@ -72,7 +75,7 @@ * This event notification is also used to delete text if string is an empty string, * or to insert text at the leading edge of the specified offset if start and end are equal. *

    - * + * * @param e an event object containing the following information:
      *
    • [in] start - the 0 based offset of the first character of the substring * to be replaced
    • @@ -83,12 +86,13 @@ *
    • [out] result - set to {@link ACC#OK} if the operation was completed successfully
    • *
    */ + @Override public void replaceText(AccessibleEditableTextEvent e) {} /** * Replaces the set of attributes of the substring beginning at the specified start offset * and extending to the character at offset end - 1 by the specified set of attributes. - * + * * @param e an event object containing the following information:
      *
    • [in] start - the 0 based offset of the first character of the substring * whose attributes are modified
    • @@ -103,5 +107,6 @@ *
    • [out] result - set to {@link ACC#OK} if the operation was completed successfully
    • *
    */ + @Override public void setTextAttributes(AccessibleTextAttributeEvent e) {} } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleEditableTextEvent.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleEditableTextEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleEditableTextEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleEditableTextEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -26,27 +26,27 @@ /** * [in] 0-based start offset of the character range to perform * the operation on - * + * * @see AccessibleEditableTextListener#copyText * @see AccessibleEditableTextListener#cutText * @see AccessibleEditableTextListener#pasteText * @see AccessibleEditableTextListener#replaceText */ public int start; - + /** * [in] 0-based ending offset of the character range to perform * the operation on - * + * * @see AccessibleEditableTextListener#copyText * @see AccessibleEditableTextListener#cutText * @see AccessibleEditableTextListener#replaceText */ public int end; - + /** * [in] a string that will replace the specified character range - * + * * @see AccessibleEditableTextListener#replaceText */ public String string; @@ -54,7 +54,7 @@ /** * [out] Set this field to {@link ACC#OK} if the operation * was completed successfully, and null otherwise. - * + * * @see AccessibleEditableTextListener#copyText * @see AccessibleEditableTextListener#cutText * @see AccessibleEditableTextListener#pasteText diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleEditableTextListener.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleEditableTextListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleEditableTextListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleEditableTextListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -32,7 +32,7 @@ /** * Copies the substring beginning at the specified start offset * and extending to the character at offset end - 1 to the clipboard. - * + * * @param e an event object containing the following information:
      *
    • [in] start - the 0 based offset of the first character of the substring * to be copied to the clipboard
    • @@ -46,7 +46,7 @@ /** * Moves the substring beginning at the specified start offset * and extending to the character at offset end - 1 to the clipboard. - * + * * @param e an event object containing the following information:
        *
      • [in] start - the 0 based offset of the first character of the substring * to be moved to the clipboard
      • @@ -59,7 +59,7 @@ /** * Inserts the text in the clipboard at the leading edge of the specified start offset. - * + * * @param e an event object containing the following information:
          *
        • [in] start - the offset at which to insert the text from the clipboard. * The valid range is 0..length
        • @@ -75,7 +75,7 @@ * This event notification is also used to delete text if string is an empty string, * or to insert text at the leading edge of the specified offset if start and end are equal. *

          - * + * * @param e an event object containing the following information:
            *
          • [in] start - the 0 based offset of the first character of the substring * to be replaced
          • @@ -91,7 +91,7 @@ /** * Replaces the set of attributes of the substring beginning at the specified start offset * and extending to the character at offset end - 1 by the specified set of attributes. - * + * * @param e an event object containing the following information:
              *
            • [in] start - the 0 based offset of the first character of the substring * whose attributes are modified
            • diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleEvent.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -25,7 +25,7 @@ * @see AccessibleListener * @see AccessibleAdapter * @see Sample code and further information - * + * * @since 2.0 */ public class AccessibleEvent extends SWTEventObject { @@ -36,7 +36,7 @@ * or a 0-based integer representing a specific child of the control. */ public int childID; - + /** * The value of this field must be set in the accessible listener * method before returning. @@ -44,9 +44,9 @@ * the childID specified by the client. */ public String result; - + static final long serialVersionUID = 3257567304224026934L; - + /** * Constructs a new instance of this class. * @@ -65,5 +65,5 @@ @Override public String toString () { return "AccessibleEvent {childID=" + childID + " result=" + result + "}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ -} +} } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleFactory.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleFactory.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleFactory.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleFactory.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -18,8 +18,8 @@ import org.eclipse.swt.*; class AccessibleFactory { - static final Hashtable Accessibles = new Hashtable (9); - static final Hashtable Factories = new Hashtable (9); + static final Map Accessibles = new HashMap<> (9); + static final Map Factories = new HashMap<> (9); static final String SWT_TYPE_PREFIX = "SWTAccessible"; //$NON-NLS-1$ static final String CHILD_TYPENAME = "Child"; //$NON-NLS-1$ static final String FACTORY_TYPENAME = "SWTFactory"; //$NON-NLS-1$ @@ -51,17 +51,17 @@ /* Action callbacks */ static final Callback AtkActionCB_do_action; - static final Callback AtkActionCB_get_n_actions; + static final Callback AtkActionCB_get_n_actions; static final Callback AtkActionCB_get_description; static final Callback AtkActionCB_get_keybinding; - static final Callback AtkActionCB_get_name; - + static final Callback AtkActionCB_get_name; + /* Component callbacks */ static final Callback AtkComponentCB_get_extents; static final Callback AtkComponentCB_get_position; static final Callback AtkComponentCB_get_size; static final Callback AtkComponentCB_ref_accessible_at_point; - + /* EditableText callbacks */ static final Callback AtkEditableTextCB_set_run_attributes; static final Callback AtkEditableTextCB_set_text_contents; @@ -75,18 +75,18 @@ static final Callback AtkHypertextCB_get_link; static final Callback AtkHypertextCB_get_n_links; static final Callback AtkHypertextCB_get_link_index; - + /* Object callbacks */ static final Callback AtkObjectCB_get_description; static final Callback AtkObjectCB_get_index_in_parent; static final Callback AtkObjectCB_get_n_children; static final Callback AtkObjectCB_get_name; - static final Callback AtkObjectCB_get_parent; + static final Callback AtkObjectCB_get_parent; static final Callback AtkObjectCB_get_role; static final Callback AtkObjectCB_ref_child; static final Callback AtkObjectCB_ref_state_set; static final Callback AtkObjectCB_get_attributes; - + /* Selection callbacks */ static final Callback AtkSelectionCB_is_child_selected; static final Callback AtkSelectionCB_ref_selection; @@ -115,7 +115,7 @@ static final Callback AtkTableCB_add_row_selection; static final Callback AtkTableCB_remove_column_selection; static final Callback AtkTableCB_remove_row_selection; - + /* Text callbacks */ static final Callback AtkTextCB_get_character_extents; static final Callback AtkTextCB_get_range_extents; @@ -135,18 +135,18 @@ static final Callback AtkTextCB_get_character_at_offset; static final Callback AtkTextCB_get_character_count; static final Callback AtkTextCB_get_bounded_ranges; - + /* Value callbacks */ static final Callback AtkValueCB_get_current_value; static final Callback AtkValueCB_get_maximum_value; static final Callback AtkValueCB_get_minimum_value; static final Callback AtkValueCB_set_current_value; - + static final Callback GObjectClass_finalize; static final Callback AtkObjectFactoryCB_create_accessible; - + /* interface initialization callbacks */ - static final Callback InitActionIfaceCB; + static final Callback InitActionIfaceCB; static final Callback InitComponentIfaceCB; static final Callback InitEditableTextIfaceCB; static final Callback InitHypertextIfaceCB; @@ -249,7 +249,7 @@ InitActionIfaceCB = newCallback (AccessibleFactory.class, "initActionIfaceCB", 1); //$NON-NLS-1$ GInterfaceInfo interfaceInfo = new GInterfaceInfo (); interfaceInfo.interface_init = InitActionIfaceCB.getAddress (); - ActionIfaceDefinition = OS.g_malloc (GInterfaceInfo.sizeof); + ActionIfaceDefinition = OS.g_malloc (GInterfaceInfo.sizeof); OS.memmove (ActionIfaceDefinition, interfaceInfo, GInterfaceInfo.sizeof); /* Component interface */ InitComponentIfaceCB = newCallback (AccessibleFactory.class, "initComponentIfaceCB", 1); //$NON-NLS-1$ @@ -261,37 +261,37 @@ InitEditableTextIfaceCB = newCallback (AccessibleFactory.class, "initEditableTextIfaceCB", 1); //$NON-NLS-1$ interfaceInfo = new GInterfaceInfo (); interfaceInfo.interface_init = InitEditableTextIfaceCB.getAddress (); - EditableTextIfaceDefinition = OS.g_malloc (GInterfaceInfo.sizeof); + EditableTextIfaceDefinition = OS.g_malloc (GInterfaceInfo.sizeof); OS.memmove (EditableTextIfaceDefinition, interfaceInfo, GInterfaceInfo.sizeof); /* Hypertext interface */ InitHypertextIfaceCB = newCallback (AccessibleFactory.class, "initHypertextIfaceCB", 1); //$NON-NLS-1$ interfaceInfo = new GInterfaceInfo (); interfaceInfo.interface_init = InitHypertextIfaceCB.getAddress (); - HypertextIfaceDefinition = OS.g_malloc (GInterfaceInfo.sizeof); + HypertextIfaceDefinition = OS.g_malloc (GInterfaceInfo.sizeof); OS.memmove (HypertextIfaceDefinition, interfaceInfo, GInterfaceInfo.sizeof); /* Selection interface */ InitSelectionIfaceCB = newCallback (AccessibleFactory.class, "initSelectionIfaceCB", 1); //$NON-NLS-1$ interfaceInfo = new GInterfaceInfo (); interfaceInfo.interface_init = InitSelectionIfaceCB.getAddress (); - SelectionIfaceDefinition = OS.g_malloc (GInterfaceInfo.sizeof); + SelectionIfaceDefinition = OS.g_malloc (GInterfaceInfo.sizeof); OS.memmove (SelectionIfaceDefinition, interfaceInfo, GInterfaceInfo.sizeof); /* Text interface */ InitTableIfaceCB = newCallback (AccessibleFactory.class, "initTableIfaceCB", 1); //$NON-NLS-1$ interfaceInfo = new GInterfaceInfo (); interfaceInfo.interface_init = InitTableIfaceCB.getAddress (); - TableIfaceDefinition = OS.g_malloc (GInterfaceInfo.sizeof); + TableIfaceDefinition = OS.g_malloc (GInterfaceInfo.sizeof); OS.memmove (TableIfaceDefinition, interfaceInfo, GInterfaceInfo.sizeof); /* Text interface */ InitTextIfaceCB = newCallback (AccessibleFactory.class, "initTextIfaceCB", 1); //$NON-NLS-1$ interfaceInfo = new GInterfaceInfo (); interfaceInfo.interface_init = InitTextIfaceCB.getAddress (); - TextIfaceDefinition = OS.g_malloc (GInterfaceInfo.sizeof); + TextIfaceDefinition = OS.g_malloc (GInterfaceInfo.sizeof); OS.memmove (TextIfaceDefinition, interfaceInfo, GInterfaceInfo.sizeof); /* Value interface */ InitValueIfaceCB = newCallback (AccessibleFactory.class, "initValueIfaceCB", 1); //$NON-NLS-1$ interfaceInfo = new GInterfaceInfo (); interfaceInfo.interface_init = InitValueIfaceCB.getAddress (); - ValueIfaceDefinition = OS.g_malloc (GInterfaceInfo.sizeof); + ValueIfaceDefinition = OS.g_malloc (GInterfaceInfo.sizeof); OS.memmove (ValueIfaceDefinition, interfaceInfo, GInterfaceInfo.sizeof); } @@ -308,7 +308,7 @@ OS.memmove (buffer, typeName, widgetTypeNameLength); return new String(Converter.mbcsToWcs(null, buffer)); } - + static int /*long*/ getParentType (int /*long*/ widgetType) { LONG type = null; while (widgetType != 0 && (type = Factories.get(new LONG(widgetType))) == null) { @@ -323,8 +323,8 @@ if (accessible == null) { /* * we don't care about this control, so create it with the parent's - * type so that its accessibility callbacks will not pass though here - */ + * type so that its accessibility callbacks will not pass though here + */ int /*long*/ result = OS.g_object_new (getParentType(OS.G_OBJECT_TYPE (widget)), 0); ATK.atk_object_initialize (result, widget); return result; @@ -342,12 +342,12 @@ accessible.addRelations (); return object.handle; } - + static AccessibleObject createChildAccessible (Accessible accessible, int childId) { int /*long*/ childType = getType (CHILD_TYPENAME, accessible, ATK.GTK_TYPE_ACCESSIBLE(), childId); return new AccessibleObject(childType, 0, accessible, true); } - + static void createAccessible (Accessible accessible) { int /*long*/ controlHandle = accessible.getControlHandle (); OS.gtk_widget_get_accessible(controlHandle); @@ -431,7 +431,7 @@ typeInfo.base_init = GTypeInfo_base_init_type.getAddress (); typeInfo.class_size = (short) query.class_size; typeInfo.instance_size = (short) query.instance_size; - int /*long*/ definition = OS.g_malloc (GTypeInfo.sizeof); + int /*long*/ definition = OS.g_malloc (GTypeInfo.sizeof); OS.memmove (definition, typeInfo, GTypeInfo.sizeof); type = OS.g_type_register_static (parentType, nameBytes, definition, 0); OS.g_type_add_interface_static (type, ATK.ATK_TYPE_COMPONENT(), ComponentIfaceDefinition); @@ -450,10 +450,10 @@ AtkObjectFactoryClass objectClass = new AtkObjectFactoryClass (); ATK.memmove (objectClass, klass); objectClass.create_accessible = AtkObjectFactoryCB_create_accessible.getAddress (); - ATK.memmove (klass, objectClass); + ATK.memmove (klass, objectClass); return 0; } - + static int /*long*/ gTypeInfo_base_init_type (int /*long*/ klass) { AtkObjectClass objectClass = new AtkObjectClass (); ATK.memmove (objectClass, klass); @@ -470,23 +470,23 @@ GObjectClass objectClassStruct = new GObjectClass (); OS.memmove (objectClassStruct, gObjectClass); objectClassStruct.finalize = GObjectClass_finalize.getAddress (); - OS.memmove (gObjectClass, objectClassStruct); + OS.memmove (gObjectClass, objectClassStruct); ATK.memmove (klass, objectClass); return 0; } - + static int /*long*/ initActionIfaceCB (int /*long*/ iface) { AtkActionIface inter = new AtkActionIface (); ATK.memmove (inter, iface); - inter.do_action = AtkActionCB_do_action.getAddress (); + inter.do_action = AtkActionCB_do_action.getAddress (); inter.get_n_actions = AtkActionCB_get_n_actions.getAddress (); inter.get_description = AtkActionCB_get_description.getAddress (); - inter.get_keybinding = AtkActionCB_get_keybinding.getAddress (); + inter.get_keybinding = AtkActionCB_get_keybinding.getAddress (); inter.get_name = AtkActionCB_get_name.getAddress (); ATK.memmove (iface, inter); return 0; } - + static int /*long*/ initComponentIfaceCB (int /*long*/ iface) { AtkComponentIface inter = new AtkComponentIface (); ATK.memmove (inter, iface); @@ -515,7 +515,7 @@ static int /*long*/ initHypertextIfaceCB (int /*long*/ iface) { AtkHypertextIface inter = new AtkHypertextIface (); ATK.memmove (inter, iface); - inter.get_link = AtkHypertextCB_get_link.getAddress (); + inter.get_link = AtkHypertextCB_get_link.getAddress (); inter.get_link_index = AtkHypertextCB_get_link_index.getAddress (); inter.get_n_links = AtkHypertextCB_get_n_links.getAddress (); ATK.memmove (iface, inter); @@ -613,8 +613,8 @@ typeInfo.base_init = GTypeInfo_base_init_factory.getAddress (); typeInfo.class_size = (short)ATK.AtkObjectFactoryClass_sizeof (); typeInfo.instance_size = (short)ATK.AtkObjectFactory_sizeof (); - int /*long*/ info = OS.g_malloc (GTypeInfo.sizeof); - OS.memmove (info, typeInfo, GTypeInfo.sizeof); + int /*long*/ info = OS.g_malloc (GTypeInfo.sizeof); + OS.memmove (info, typeInfo, GTypeInfo.sizeof); int /*long*/ swtFactoryType = OS.g_type_register_static (ATK.ATK_TYPE_OBJECT_FACTORY(), factoryName, info, 0); int /*long*/ parentType = ATK.atk_object_factory_get_accessible_type(factory); ATK.atk_registry_set_factory_type (registry, widgetType, swtFactoryType); @@ -623,7 +623,7 @@ if (AccessibleObject.DEBUG) AccessibleObject.print("-->Register=" + accessible.control + " " + widget); //$NON-NLS-1$ Accessibles.put (new LONG (widget), accessible); } - + static void unregisterAccessible (Accessible accessible) { int /*long*/ widget = accessible.getControlHandle (); Accessibles.remove (new LONG (widget)); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleHyperlinkAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleHyperlinkAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleHyperlinkAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleHyperlinkAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 2016 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 @@ -27,7 +27,7 @@ public class AccessibleHyperlinkAdapter implements AccessibleHyperlinkListener { /** * Returns the anchor for the link at the specified index. - * + * * @param e an event object containing the following fields:
                *
              • [in] index - a 0 based index identifying the anchor if this object * has more than one link, as in the case of an image map
              • @@ -39,11 +39,12 @@ * the accessible for the image. *
              */ + @Override public void getAnchor(AccessibleHyperlinkEvent e) {} /** * Returns the target of the link at the specified index. - * + * * @param e an event object containing the following fields:
                *
              • [in] index - a 0 based index identifying the anchor if this object * has more than one link, as in the case of an image map
              • @@ -54,6 +55,7 @@ * object to be activated when the link is activated. *
              */ + @Override public void getAnchorTarget(AccessibleHyperlinkEvent e) {} /** @@ -62,11 +64,12 @@ * The returned value is related to the AccessibleTextExtended interface of the object that * owns this hyperlink. *

              - * + * * @param e an event object containing the following fields:
                *
              • [out] index
              • *
              */ + @Override public void getStartIndex(AccessibleHyperlinkEvent e) {} /** @@ -75,10 +78,11 @@ * The returned value is related to the AccessibleTextExtended interface of the object that * owns this hyperlink. The character at the index is not part of the hypertext. *

              - * + * * @param e an event object containing the following fields:
                *
              • [out] index
              • *
              */ + @Override public void getEndIndex(AccessibleHyperlinkEvent e) {} } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleHyperlinkListener.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleHyperlinkListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleHyperlinkListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleHyperlinkListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -30,7 +30,7 @@ public interface AccessibleHyperlinkListener extends SWTEventListener { /** * Returns the anchor for the link at the specified index. - * + * * @param e an event object containing the following fields:
                *
              • [in] index - a 0 based index identifying the anchor if this object * has more than one link, as in the case of an image map
              • @@ -46,7 +46,7 @@ /** * Returns the target of the link at the specified index. - * + * * @param e an event object containing the following fields:
                  *
                • [in] index - a 0 based index identifying the anchor if this object * has more than one link, as in the case of an image map
                • @@ -65,7 +65,7 @@ * The returned value is related to the AccessibleTextExtended interface of the object that * owns this hyperlink. *

                  - * + * * @param e an event object containing the following fields:
                    *
                  • [out] index
                  • *
                  @@ -78,7 +78,7 @@ * The returned value is related to the AccessibleTextExtended interface of the object that * owns this hyperlink. The character at the index is not part of the hypertext. *

                  - * + * * @param e an event object containing the following fields:
                    *
                  • [out] index
                  • *
                  diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/Accessible.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/Accessible.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/Accessible.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/Accessible.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -12,6 +12,7 @@ import java.util.*; +import java.util.List; import org.eclipse.swt.*; import org.eclipse.swt.internal.gtk.*; @@ -29,7 +30,7 @@ * As a rule of thumb, an application would only want to use the * accessible control listener to implement accessibility for a * custom control. - * + * * @see Control#getAccessible * @see AccessibleListener * @see AccessibleEvent @@ -37,31 +38,31 @@ * @see AccessibleControlEvent * @see Accessibility snippets * @see Sample code and further information - * + * * @since 2.0 */ public class Accessible { - Vector accessibleListeners; - Vector accessibleControlListeners; - Vector accessibleTextListeners; - Vector accessibleActionListeners; - Vector accessibleEditableTextListeners; - Vector accessibleHyperlinkListeners; - Vector accessibleTableListeners; - Vector accessibleTableCellListeners; - Vector accessibleTextExtendedListeners; - Vector accessibleValueListeners; - Vector accessibleAttributeListeners; + List accessibleListeners; + List accessibleControlListeners; + List accessibleTextListeners; + List accessibleActionListeners; + List accessibleEditableTextListeners; + List accessibleHyperlinkListeners; + List accessibleTableListeners; + List accessibleTableCellListeners; + List accessibleTextExtendedListeners; + List accessibleValueListeners; + List accessibleAttributeListeners; Accessible parent; AccessibleObject accessibleObject; Control control; - Vector relations; - Vector children; - + List relations; + List children; + static class Relation { int type; Accessible target; - + public Relation(int type, Accessible target) { this.type = type; this.target = target; @@ -75,26 +76,26 @@ return (relation.type == this.type) && (relation.target == this.target); } } - + /** * Constructs a new instance of this class given its parent. - * + * * @param parent the Accessible parent, which must not be null - * + * * @exception IllegalArgumentException
                    *
                  • ERROR_NULL_ARGUMENT - if the parent is null
                  • *
                  - * + * * @see #dispose * @see Control#getAccessible - * + * * @since 3.6 */ public Accessible(Accessible parent) { this.parent = checkNull(parent); this.control = parent.control; - if (parent.children == null) parent.children = new Vector(); - parent.children.addElement(this); + if (parent.children == null) parent.children = new ArrayList<>(); + parent.children.add(this); } /** @@ -114,8 +115,8 @@ super (); this.control = control; AccessibleFactory.registerAccessible (this); - } - + } + /** * Adds the listener to the collection of listeners who will * be notified when an accessible client asks for certain strings, @@ -140,8 +141,8 @@ public void addAccessibleListener (AccessibleListener listener) { checkWidget (); if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - if (accessibleListeners == null) accessibleListeners = new Vector(); - accessibleListeners.addElement (listener); + if (accessibleListeners == null) accessibleListeners = new ArrayList<>(); + accessibleListeners.add (listener); } /** @@ -168,8 +169,8 @@ public void addAccessibleControlListener (AccessibleControlListener listener) { checkWidget (); if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - if (accessibleControlListeners == null) accessibleControlListeners = new Vector(); - accessibleControlListeners.addElement (listener); + if (accessibleControlListeners == null) accessibleControlListeners = new ArrayList<>(); + accessibleControlListeners.add (listener); } /** @@ -193,21 +194,21 @@ * @see AccessibleTextListener * @see AccessibleTextExtendedListener * @see #removeAccessibleTextListener - * + * * @since 3.0 */ public void addAccessibleTextListener (AccessibleTextListener listener) { checkWidget (); if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); if (listener instanceof AccessibleTextExtendedListener) { - if (accessibleTextExtendedListeners == null) accessibleTextExtendedListeners = new Vector(); - accessibleTextExtendedListeners.addElement ((AccessibleTextExtendedListener)listener); + if (accessibleTextExtendedListeners == null) accessibleTextExtendedListeners = new ArrayList<>(); + accessibleTextExtendedListeners.add ((AccessibleTextExtendedListener)listener); } else { - if (accessibleTextListeners == null) accessibleTextListeners = new Vector(); - accessibleTextListeners.addElement (listener); + if (accessibleTextListeners == null) accessibleTextListeners = new ArrayList<>(); + accessibleTextListeners.add (listener); } } - + /** * Adds the listener to the collection of listeners that will be * notified when an accessible client asks for any of the properties @@ -226,14 +227,14 @@ * * @see AccessibleActionListener * @see #removeAccessibleActionListener - * + * * @since 3.6 */ public void addAccessibleActionListener(AccessibleActionListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (accessibleActionListeners == null) accessibleActionListeners = new Vector(); - accessibleActionListeners.addElement(listener); + if (accessibleActionListeners == null) accessibleActionListeners = new ArrayList<>(); + accessibleActionListeners.add(listener); } /** @@ -254,14 +255,14 @@ * * @see AccessibleEditableTextListener * @see #removeAccessibleEditableTextListener - * + * * @since 3.7 */ public void addAccessibleEditableTextListener(AccessibleEditableTextListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (accessibleEditableTextListeners == null) accessibleEditableTextListeners = new Vector(); - accessibleEditableTextListeners.addElement(listener); + if (accessibleEditableTextListeners == null) accessibleEditableTextListeners = new ArrayList<>(); + accessibleEditableTextListeners.add(listener); } /** @@ -282,14 +283,14 @@ * * @see AccessibleHyperlinkListener * @see #removeAccessibleHyperlinkListener - * + * * @since 3.6 */ public void addAccessibleHyperlinkListener(AccessibleHyperlinkListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (accessibleHyperlinkListeners == null) accessibleHyperlinkListeners = new Vector(); - accessibleHyperlinkListeners.addElement(listener); + if (accessibleHyperlinkListeners == null) accessibleHyperlinkListeners = new ArrayList<>(); + accessibleHyperlinkListeners.add(listener); } /** @@ -310,14 +311,14 @@ * * @see AccessibleTableListener * @see #removeAccessibleTableListener - * + * * @since 3.6 */ public void addAccessibleTableListener(AccessibleTableListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (accessibleTableListeners == null) accessibleTableListeners = new Vector(); - accessibleTableListeners.addElement(listener); + if (accessibleTableListeners == null) accessibleTableListeners = new ArrayList<>(); + accessibleTableListeners.add(listener); } /** @@ -338,14 +339,14 @@ * * @see AccessibleTableCellListener * @see #removeAccessibleTableCellListener - * + * * @since 3.6 */ public void addAccessibleTableCellListener(AccessibleTableCellListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (accessibleTableCellListeners == null) accessibleTableCellListeners = new Vector(); - accessibleTableCellListeners.addElement(listener); + if (accessibleTableCellListeners == null) accessibleTableCellListeners = new ArrayList<>(); + accessibleTableCellListeners.add(listener); } /** @@ -366,14 +367,14 @@ * * @see AccessibleValueListener * @see #removeAccessibleValueListener - * + * * @since 3.6 */ public void addAccessibleValueListener(AccessibleValueListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (accessibleValueListeners == null) accessibleValueListeners = new Vector(); - accessibleValueListeners.addElement(listener); + if (accessibleValueListeners == null) accessibleValueListeners = new ArrayList<>(); + accessibleValueListeners.add(listener); } /** @@ -394,43 +395,43 @@ * * @see AccessibleAttributeListener * @see #removeAccessibleAttributeListener - * + * * @since 3.6 */ public void addAccessibleAttributeListener(AccessibleAttributeListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (accessibleAttributeListeners == null) accessibleAttributeListeners = new Vector(); - accessibleAttributeListeners.addElement(listener); + if (accessibleAttributeListeners == null) accessibleAttributeListeners = new ArrayList<>(); + accessibleAttributeListeners.add(listener); } /** * Adds a relation with the specified type and target * to the receiver's set of relations. - * + * * @param type an ACC constant beginning with RELATION_* indicating the type of relation * @param target the accessible that is the target for this relation - * + * * @since 3.6 */ public void addRelation(int type, Accessible target) { checkWidget(); - if (relations == null) relations = new Vector(); + if (relations == null) relations = new ArrayList<>(); Relation relation = new Relation(type, target); if (relations.indexOf(relation) != -1) return; relations.add(relation); if (accessibleObject != null) accessibleObject.addRelation(type, target); } - + void addRelations () { if (relations == null) return; if (accessibleObject == null) return; for (int i = 0; i < relations.size(); i++) { - Relation relation = relations.elementAt(i); + Relation relation = relations.get(i); accessibleObject.addRelation(relation.type, relation.target); } } - + /** * Disposes of the operating system resources associated with * the receiver, and removes the receiver from its parent's @@ -444,18 +445,18 @@ * It is also not necessary to call this for instances of Accessible * that were retrieved with Control.getAccessible(). *

                  - * + * * @since 3.6 */ public void dispose () { if (parent == null) return; release(); - parent.children.removeElement(this); + parent.children.remove(this); parent = null; } /** - * Returns the control for this Accessible object. + * Returns the control for this Accessible object. * * @return the receiver's control * @since 3.0 @@ -469,7 +470,7 @@ if (!isValidThread ()) SWT.error (SWT.ERROR_THREAD_INVALID_ACCESS); if (control.isDisposed ()) SWT.error (SWT.ERROR_WIDGET_DISPOSED); } - + AccessibleObject getAccessibleObject () { if (accessibleObject == null) { if (parent == null) { @@ -511,14 +512,14 @@ * available on all platforms, and should never be called from * application code. *

                  - * + * * @noreference This method is not intended to be referenced by clients. */ public void internal_dispose_Accessible() { AccessibleFactory.unregisterAccessible (Accessible.this); release (); } - + /** * Invokes platform specific functionality to allocate a new accessible object. *

                  @@ -531,7 +532,7 @@ * * @param control the control to get the accessible object for * @return the platform specific accessible object - * + * * @noreference This method is not intended to be referenced by clients. */ public static Accessible internal_new_Accessible (Control control) { @@ -542,11 +543,11 @@ boolean isValidThread () { return control.getDisplay ().getThread () == Thread.currentThread (); } - + void release () { if (children != null) { for (int i = 0; i < children.size(); i++) { - Accessible child = children.elementAt(i); + Accessible child = children.get(i); child.dispose(); } } @@ -555,7 +556,7 @@ accessibleObject = null; } } - + /** * Removes the listener from the collection of listeners who will * be notified when an accessible client asks for custom control @@ -579,7 +580,7 @@ checkWidget (); if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); if (accessibleControlListeners != null) { - accessibleControlListeners.removeElement(listener); + accessibleControlListeners.remove(listener); if (accessibleControlListeners.isEmpty()) accessibleControlListeners = null; } } @@ -607,7 +608,7 @@ checkWidget (); if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); if (accessibleListeners != null) { - accessibleListeners.removeElement(listener); + accessibleListeners.remove(listener); if (accessibleListeners.isEmpty()) accessibleListeners = null; } } @@ -631,7 +632,7 @@ * @see AccessibleTextListener * @see AccessibleTextExtendedListener * @see #addAccessibleTextListener - * + * * @since 3.0 */ public void removeAccessibleTextListener (AccessibleTextListener listener) { @@ -639,17 +640,17 @@ if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); if (listener instanceof AccessibleTextExtendedListener) { if (accessibleTextExtendedListeners != null) { - accessibleTextExtendedListeners.removeElement (listener); + accessibleTextExtendedListeners.remove (listener); if (accessibleTextExtendedListeners.isEmpty()) accessibleTextExtendedListeners = null; } } else { if (accessibleTextListeners != null) { - accessibleTextListeners.removeElement (listener); + accessibleTextListeners.remove (listener); if (accessibleTextListeners.isEmpty()) accessibleTextListeners = null; } } } - + /** * Removes the listener from the collection of listeners that will be * notified when an accessible client asks for any of the properties @@ -668,14 +669,14 @@ * * @see AccessibleActionListener * @see #addAccessibleActionListener - * + * * @since 3.6 */ public void removeAccessibleActionListener(AccessibleActionListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (accessibleActionListeners != null) { - accessibleActionListeners.removeElement(listener); + accessibleActionListeners.remove(listener); if (accessibleActionListeners.isEmpty()) accessibleActionListeners = null; } } @@ -698,18 +699,18 @@ * * @see AccessibleEditableTextListener * @see #addAccessibleEditableTextListener - * + * * @since 3.7 */ public void removeAccessibleEditableTextListener(AccessibleEditableTextListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (accessibleEditableTextListeners != null) { - accessibleEditableTextListeners.removeElement(listener); + accessibleEditableTextListeners.remove(listener); if (accessibleEditableTextListeners.isEmpty()) accessibleEditableTextListeners = null; } } - + /** * Removes the listener from the collection of listeners that will be * notified when an accessible client asks for any of the properties @@ -728,14 +729,14 @@ * * @see AccessibleHyperlinkListener * @see #addAccessibleHyperlinkListener - * + * * @since 3.6 */ public void removeAccessibleHyperlinkListener(AccessibleHyperlinkListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (accessibleHyperlinkListeners != null) { - accessibleHyperlinkListeners.removeElement(listener); + accessibleHyperlinkListeners.remove(listener); if (accessibleHyperlinkListeners.isEmpty()) accessibleHyperlinkListeners = null; } } @@ -758,14 +759,14 @@ * * @see AccessibleTableListener * @see #addAccessibleTableListener - * + * * @since 3.6 */ public void removeAccessibleTableListener(AccessibleTableListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (accessibleTableListeners != null) { - accessibleTableListeners.removeElement(listener); + accessibleTableListeners.remove(listener); if (accessibleTableListeners.isEmpty()) accessibleTableListeners = null; } } @@ -788,14 +789,14 @@ * * @see AccessibleTableCellListener * @see #addAccessibleTableCellListener - * + * * @since 3.6 */ public void removeAccessibleTableCellListener(AccessibleTableCellListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (accessibleTableCellListeners != null) { - accessibleTableCellListeners.removeElement(listener); + accessibleTableCellListeners.remove(listener); if (accessibleTableCellListeners.isEmpty()) accessibleTableCellListeners = null; } } @@ -818,14 +819,14 @@ * * @see AccessibleValueListener * @see #addAccessibleValueListener - * + * * @since 3.6 */ public void removeAccessibleValueListener(AccessibleValueListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (accessibleValueListeners != null) { - accessibleValueListeners.removeElement(listener); + accessibleValueListeners.remove(listener); if (accessibleValueListeners.isEmpty()) accessibleValueListeners = null; } } @@ -848,14 +849,14 @@ * * @see AccessibleAttributeListener * @see #addAccessibleAttributeListener - * + * * @since 3.6 */ public void removeAccessibleAttributeListener(AccessibleAttributeListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (accessibleAttributeListeners != null) { - accessibleAttributeListeners.removeElement(listener); + accessibleAttributeListeners.remove(listener); if (accessibleAttributeListeners.isEmpty()) accessibleAttributeListeners = null; } } @@ -863,10 +864,10 @@ /** * Removes the relation with the specified type and target * from the receiver's set of relations. - * + * * @param type an ACC constant beginning with RELATION_* indicating the type of relation * @param target the accessible that is the target for this relation - * + * * @since 3.6 */ public void removeRelation(int type, Accessible target) { @@ -886,12 +887,12 @@ * @param event an ACC constant beginning with EVENT_* indicating the message to send * @param eventData an object containing event-specific data, or null if there is no event-specific data * (eventData is specified in the documentation for individual ACC.EVENT_* constants) - * + * * @exception SWTException

                    *
                  • ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed
                  • *
                  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control
                  • *
                  - * + * * @see ACC#EVENT_ACTION_CHANGED * @see ACC#EVENT_ATTRIBUTE_CHANGED * @see ACC#EVENT_DESCRIPTION_CHANGED @@ -924,7 +925,7 @@ * @see ACC#EVENT_TEXT_COLUMN_CHANGED * @see ACC#EVENT_TEXT_SELECTION_CHANGED * @see ACC#EVENT_VALUE_CHANGED - * + * * @since 3.6 */ public void sendEvent(int event, Object eventData) { @@ -933,12 +934,12 @@ accessibleObject.sendEvent(event, eventData); } } - + /** * Sends a message with event-specific data and a childID * to accessible clients, indicating that something has changed * within a custom control. - * + * * NOTE: This API is intended for applications that are still using childIDs. * Moving forward, applications should use accessible objects instead of childIDs. * @@ -946,12 +947,12 @@ * @param eventData an object containing event-specific data, or null if there is no event-specific data * (eventData is specified in the documentation for individual ACC.EVENT_* constants) * @param childID an identifier specifying a child of the control - * + * * @exception SWTException
                    *
                  • ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed
                  • *
                  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control
                  • *
                  - * + * * @see ACC#EVENT_DESCRIPTION_CHANGED * @see ACC#EVENT_LOCATION_CHANGED * @see ACC#EVENT_NAME_CHANGED @@ -959,7 +960,7 @@ * @see ACC#EVENT_STATE_CHANGED * @see ACC#EVENT_TEXT_SELECTION_CHANGED * @see ACC#EVENT_VALUE_CHANGED - * + * * @since 3.8 */ public void sendEvent(int event, Object eventData, int childID) { @@ -977,7 +978,7 @@ } } } - + /** * Sends a message to accessible clients that the child selection * within a custom container control has changed. @@ -986,7 +987,7 @@ *
                • ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed
                • *
                • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control
                • *
                - * + * * @since 3.0 */ public void selectionChanged () { @@ -1001,7 +1002,7 @@ * has changed within a custom control. * * @param childID an identifier specifying a child of the control - * + * * @exception SWTException
                  *
                • ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed
                • *
                • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control
                • @@ -1013,13 +1014,13 @@ accessibleObject.setFocus (childID); } } - + /** * Sends a message to accessible clients that the text * caret has moved within a custom control. * * @param index the new caret index within the control - * + * * @exception SWTException
                    *
                  • ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed
                  • *
                  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control
                  • @@ -1047,10 +1048,10 @@ *
                  • ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed
                  • *
                  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control
                  • *
                  - * + * * @see ACC#TEXT_INSERT * @see ACC#TEXT_DELETE - * + * * @since 3.0 */ public void textChanged (int type, int startIndex, int length) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleListener.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -33,7 +33,7 @@ * * @see AccessibleAdapter * @see AccessibleEvent - * + * * @since 2.0 */ public interface AccessibleListener extends SWTEventListener { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleObject.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleObject.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleObject.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleObject.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -10,16 +10,15 @@ *******************************************************************************/ package org.eclipse.swt.accessibility; -import java.util.Collection; -import java.util.Hashtable; +import java.util.*; import java.util.List; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.*; +import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.accessibility.gtk.*; import org.eclipse.swt.internal.gtk.*; +import org.eclipse.swt.widgets.*; class AccessibleObject { int /*long*/ handle; @@ -30,20 +29,26 @@ /* * a lightweight object does not correspond to a concrete gtk widget, but * to a logical child of a widget (eg.- a CTabItem, which is simply drawn) - */ + */ boolean isLightweight = false; static int /*long*/ actionNamePtr = -1; static int /*long*/ descriptionPtr = -1; static int /*long*/ keybindingPtr = -1; static int /*long*/ namePtr = -1; - static final Hashtable AccessibleObjects = new Hashtable (9); + static final Map AccessibleObjects = new HashMap<> (9); static final boolean DEBUG = Device.DEBUG; - - static final int ROW_ROLE, COLUMN_ROLE; + + static final int ROW_ROLE; static { - ROW_ROLE = ATK.atk_role_register(Converter.wcsToMbcs(null, "row", true)); //$NON-NLS-1$ - COLUMN_ROLE = ATK.atk_role_register(Converter.wcsToMbcs(null, "column", true)); //$NON-NLS-1$ + + // Gtk3.2 has a minimum requirement of ATK 2.1.5 + // ATK_ROLE_TABLE_ROW was introduced in ATK 2.1.0. See Bug 470629 for details. + if (OS.GTK_VERSION >= OS.VERSION(3, 2, 0)) { + ROW_ROLE = ATK.ATK_ROLE_TABLE_ROW; + } else { + ROW_ROLE = ATK.atk_role_register(Converter.wcsToMbcs(null, "row", true)); //$NON-NLS-1$ + } } AccessibleObject (int /*long*/ type, int /*long*/ widget, Accessible accessible, boolean isLightweight) { @@ -55,11 +60,11 @@ AccessibleObjects.put (new LONG (handle), this); if (DEBUG) print("new AccessibleObject: " + handle + " control=" + accessible.control + " lw=" + isLightweight); } - + static void print (String str) { System.out.println (str); } - + static int size(Collection listeners) { return listeners == null ? 0 : listeners.size(); } @@ -72,7 +77,7 @@ } return null; } - + static int /*long*/ atkAction_do_action (int /*long*/ atkObject, int /*long*/ index) { if (DEBUG) print ("-->atkAction_do_action"); AccessibleObject object = getAccessibleObject (atkObject); @@ -95,7 +100,7 @@ if (iface != null && iface.do_action != 0) { parentResult = ATK.call (iface.do_action, atkObject, index); } - return parentResult; + return parentResult; } static int /*long*/ atkAction_get_n_actions (int /*long*/ atkObject) { @@ -119,9 +124,9 @@ if (iface != null && iface.get_n_actions != 0) { parentResult = ATK.call (iface.get_n_actions, atkObject); } - return parentResult; + return parentResult; } - + static int /*long*/ atkAction_get_description (int /*long*/ atkObject, int /*long*/ index) { if (DEBUG) print ("-->atkAction_get_description"); AccessibleObject object = getAccessibleObject (atkObject); @@ -146,9 +151,9 @@ if (iface != null && iface.get_description != 0) { parentResult = ATK.call (iface.get_description, atkObject, index); } - return parentResult; + return parentResult; } - + static int /*long*/ atkAction_get_keybinding (int /*long*/ atkObject, int /*long*/ index) { if (DEBUG) print ("-->atkAction_get_keybinding"); AccessibleObject object = getAccessibleObject (atkObject); @@ -170,7 +175,7 @@ } if (event.result != null) { if (keybindingPtr != -1) OS.g_free (keybindingPtr); - return keybindingPtr = getStringPtr (event.result); + return keybindingPtr = getStringPtr (event.result); } } List listeners2 = accessible.accessibleListeners; @@ -181,11 +186,11 @@ if (parentResult != 0) event.result = getString (parentResult); for (int i = 0; i < length; i++) { AccessibleListener listener = listeners2.get(i); - listener.getKeyboardShortcut (event); - } + listener.getKeyboardShortcut (event); + } if (event.result != null) { if (keybindingPtr != -1) OS.g_free (keybindingPtr); - return keybindingPtr = getStringPtr (event.result); + return keybindingPtr = getStringPtr (event.result); } } } @@ -225,8 +230,8 @@ if (parentResult != 0) event.result = getString (parentResult); for (int i = 0; i < length; i++) { AccessibleControlListener listener = listeners2.get(i); - listener.getDefaultAction (event); - } + listener.getDefaultAction (event); + } if (event.result != null) { if (actionNamePtr != -1) OS.g_free (actionNamePtr); return actionNamePtr = getStringPtr (event.result); @@ -236,7 +241,7 @@ } return parentResult; } - + static AtkComponentIface getComponentIface (int /*long*/ atkObject) { if (ATK.g_type_is_a (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject)), ATK.ATK_TYPE_COMPONENT())) { AtkComponentIface iface = new AtkComponentIface (); @@ -276,7 +281,7 @@ if (coord_type == ATK.ATK_XY_WINDOW) { windowPoint (object, topWindowX, topWindowY); event.x += topWindowX [0]; - event.y += topWindowY [0]; + event.y += topWindowY [0]; } for (int i = 0; i < length; i++) { AccessibleControlListener listener = listeners.get (i); @@ -320,7 +325,7 @@ if (coord_type == ATK.ATK_XY_WINDOW) { windowPoint (object, topWindowX, topWindowY); event.x += topWindowX [0]; - event.y += topWindowY [0]; + event.y += topWindowY [0]; } for (int i = 0; i < length; i++) { AccessibleControlListener listener = listeners.get (i); @@ -383,17 +388,17 @@ if (coord_type == ATK.ATK_XY_WINDOW) { windowPoint (object, topWindowX, topWindowY); event.x += topWindowX [0]; - event.y += topWindowY [0]; + event.y += topWindowY [0]; } for (int i = 0; i < length; i++) { AccessibleControlListener listener = listeners.get (i); - listener.getChildAtPoint (event); + listener.getChildAtPoint (event); } if (event.childID == object.id) event.childID = ACC.CHILDID_SELF; Accessible result = event.accessible; AccessibleObject accObj = result != null ? result.getAccessibleObject() : object.getChildByID (event.childID); if (accObj != null) { - return OS.g_object_ref (accObj.handle); + return OS.g_object_ref (accObj.handle); } } } @@ -403,9 +408,9 @@ parentResult = ATK.call (iface.ref_accessible_at_point, atkObject, x, y, coord_type); } return parentResult; - } + } + - static AtkEditableTextIface getEditableTextIface (int /*long*/ atkObject) { if (ATK.g_type_is_a (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject)), ATK.ATK_TYPE_EDITABLE_TEXT())) { AtkEditableTextIface iface = new AtkEditableTextIface (); @@ -414,7 +419,7 @@ } return null; } - + // gboolean atk_editable_text_set_run_attributes(AtkEditableText *text, AtkAttributeSet *attrib_set, gint start_offset, gint end_offset); static int /*long*/ atkEditableText_set_run_attributes (int /*long*/ atkObject, int /*long*/ attrib_set, int /*long*/ start_offset, int /*long*/ end_offset) { if (DEBUG) print ("-->atkEditableText_set_run_attributes"); @@ -497,7 +502,7 @@ createFont = true; } } else if (name.equals(getString(ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_STRETCH)))) { - //"ultra_condensed", "extra_condensed", "condensed", "semi_condensed", "normal", "semi_expanded", "expanded", "extra_expanded" or "ultra_expanded" + //"ultra_condensed", "extra_condensed", "condensed", "semi_condensed", "normal", "semi_expanded", "expanded", "extra_expanded" or "ultra_expanded" int stretch = -1; if (value.equals("ultra_condensed")) stretch = OS.PANGO_STRETCH_ULTRA_CONDENSED; else if (value.equals("extra_condensed")) stretch = OS.PANGO_STRETCH_EXTRA_CONDENSED; @@ -691,7 +696,7 @@ } return parentResult; } - + // void atk_editable_text_delete_text (AtkEditableText *text, gint start_pos, gint end_pos); static int /*long*/ atkEditableText_delete_text (int /*long*/ atkObject, int /*long*/ start_pos, int /*long*/ end_pos) { if (DEBUG) print ("-->atkEditableText_delete_text"); @@ -745,7 +750,7 @@ } return parentResult; } - + static AtkHypertextIface getHypertextIface (int /*long*/ atkObject) { if (ATK.g_type_is_a (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject)), ATK.ATK_TYPE_HYPERTEXT())) { AtkHypertextIface iface = new AtkHypertextIface (); @@ -754,7 +759,7 @@ } return null; } - + static int /*long*/ atkHypertext_get_link (int /*long*/ atkObject, int /*long*/ link_index) { if (DEBUG) print ("-->atkHypertext_get_link"); AccessibleObject object = getAccessibleObject (atkObject); @@ -830,7 +835,7 @@ } return parentResult; } - + static AtkObjectClass getObjectClass (int /*long*/ atkObject) { AtkObjectClass objectClass = new AtkObjectClass (); ATK.memmove (objectClass, ATK.g_type_class_peek (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject)))); @@ -942,7 +947,7 @@ parentResult = OS.g_slist_append(parentResult, attrPtr); } //TODO - tabStops - + /* Check for group attributes. */ int level = (event.groupLevel != -1) ? event.groupLevel : 0; int setsize = (event.groupCount != -1) ? event.groupCount : 0; @@ -984,7 +989,7 @@ ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); parentResult = OS.g_slist_append(parentResult, attrPtr); } - + if (event.attributes != null) { int end = event.attributes.length / 2 * 2; for (int i = 0; i < end; i+= 2) { @@ -1018,7 +1023,7 @@ if (parentResult != 0) event.result = getString (parentResult); for (int i = 0; i < length; i++) { AccessibleListener listener = listeners.get (i); - listener.getName (event); + listener.getName (event); } if (DEBUG) print ("---> " + event.result); if (event.result == null) return parentResult; @@ -1027,14 +1032,14 @@ } } return parentResult; - } + } static int /*long*/ atkObject_get_n_children (int /*long*/ atkObject) { if (DEBUG) print ("-->atkObject_get_n_children: " + atkObject); AccessibleObject object = getAccessibleObject (atkObject); int /*long*/ parentResult = 0; AtkObjectClass objectClass = getObjectClass (atkObject); - if (objectClass.get_n_children != 0) { + if (objectClass.get_n_children != 0) { parentResult = ATK.call (objectClass.get_n_children, atkObject); } if (object != null && object.id == ACC.CHILDID_SELF) { @@ -1114,7 +1119,7 @@ event.detail = -1; for (int i = 0; i < length; i++) { AccessibleControlListener listener = listeners.get (i); - listener.getRole (event); + listener.getRole (event); } if (DEBUG) print ("---> " + event.detail); if (event.detail != -1) { @@ -1151,7 +1156,7 @@ case ACC.ROLE_SPLITBUTTON: return ATK.ATK_ROLE_PUSH_BUTTON; case ACC.ROLE_WINDOW: return ATK.ATK_ROLE_WINDOW; case ACC.ROLE_ROW: return ROW_ROLE; - case ACC.ROLE_COLUMN: return COLUMN_ROLE; + case ACC.ROLE_COLUMN: return ATK.ATK_ROLE_UNKNOWN; //Column role doesn't exist on Gtk. case ACC.ROLE_ALERT: return ATK.ATK_ROLE_ALERT; case ACC.ROLE_ANIMATION: return ATK.ATK_ROLE_ANIMATION; case ACC.ROLE_CANVAS: return ATK.ATK_ROLE_CANVAS; @@ -1199,14 +1204,14 @@ if (event.accessible != null) { AccessibleObject accObject = event.accessible.getAccessibleObject(); if (accObject != null) { - return OS.g_object_ref (accObject.handle); + return OS.g_object_ref (accObject.handle); } } } object.updateChildren (); - AccessibleObject accObject = object.getChildByIndex ((int)/*64*/index); + AccessibleObject accObject = object.getChildByIndex ((int)/*64*/index); if (accObject != null) { - return OS.g_object_ref (accObject.handle); + return OS.g_object_ref (accObject.handle); } } AtkObjectClass objectClass = getObjectClass (atkObject); @@ -1219,7 +1224,7 @@ AccessibleObject object = getAccessibleObject (atkObject); int /*long*/ parentResult = 0; AtkObjectClass objectClass = getObjectClass (atkObject); - if (objectClass.ref_state_set != 0) { + if (objectClass.ref_state_set != 0) { parentResult = ATK.call (objectClass.ref_state_set, atkObject); } if (object != null) { @@ -1234,7 +1239,7 @@ for (int i = 0; i < length; i++) { AccessibleControlListener listener = listeners.get (i); listener.getState (event); - } + } if (event.detail != -1) { /* Convert from win32 state values to atk state values */ int state = event.detail; @@ -1246,7 +1251,7 @@ if ((state & ACC.STATE_HOTTRACKED) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_ARMED); if ((state & ACC.STATE_INVISIBLE) == 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_VISIBLE); if ((state & ACC.STATE_MULTISELECTABLE) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_MULTISELECTABLE); - if ((state & ACC.STATE_OFFSCREEN) == 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_SHOWING); + if ((state & ACC.STATE_OFFSCREEN) == 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_SHOWING); if ((state & ACC.STATE_PRESSED) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_PRESSED); if ((state & ACC.STATE_READONLY) == 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_EDITABLE); if ((state & ACC.STATE_SELECTABLE) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_SELECTABLE); @@ -1266,7 +1271,7 @@ } return parentResult; } - + static AtkSelectionIface getSelectionIface (int /*long*/ atkObject) { if (ATK.g_type_is_a (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject)), ATK.ATK_TYPE_SELECTION())) { AtkSelectionIface iface = new AtkSelectionIface (); @@ -1275,7 +1280,7 @@ } return null; } - + static int /*long*/ atkSelection_is_child_selected (int /*long*/ atkObject, int /*long*/ index) { if (DEBUG) print ("-->atkSelection_is_child_selected"); AccessibleObject object = getAccessibleObject (atkObject); @@ -1288,7 +1293,7 @@ Accessible accessible = object.accessible; List listeners = accessible.accessibleControlListeners; int length = size(listeners); - if (length > 0) { + if (length > 0) { AccessibleControlEvent event = new AccessibleControlEvent (accessible); event.childID = object.id; for (int i = 0; i < length; i++) { @@ -1297,7 +1302,7 @@ } Accessible result = event.accessible; AccessibleObject accessibleObject = result != null ? result.getAccessibleObject() : object.getChildByID (event.childID); - if (accessibleObject != null) { + if (accessibleObject != null) { return accessibleObject.index == index ? 1 : 0; } } @@ -1317,17 +1322,17 @@ Accessible accessible = object.accessible; List listeners = accessible.accessibleControlListeners; int length = size(listeners); - if (length > 0) { + if (length > 0) { AccessibleControlEvent event = new AccessibleControlEvent (accessible); event.childID = object.id; for (int i = 0; i < length; i++) { AccessibleControlListener listener = listeners.get (i); listener.getSelection (event); - } + } AccessibleObject accObj = object.getChildByID (event.childID); if (accObj != null) { if (parentResult != 0) OS.g_object_unref (parentResult); - OS.g_object_ref (accObj.handle); + OS.g_object_ref (accObj.handle); return accObj.handle; } } @@ -1343,7 +1348,7 @@ } return null; } - + static int /*long*/ atkTable_ref_at (int /*long*/ atkObject, int /*long*/ row, int /*long*/ column) { if (DEBUG) print ("-->atkTable_ref_at"); AccessibleObject object = getAccessibleObject (atkObject); @@ -1637,7 +1642,7 @@ } return parentResult; } - + static int /*long*/ atkTable_get_column_description (int /*long*/ atkObject, int /*long*/ column) { if (DEBUG) print ("-->atkTable_get_column_description"); AccessibleObject object = getAccessibleObject (atkObject); @@ -1665,7 +1670,7 @@ } return parentResult; } - + static int /*long*/ atkTable_get_column_header (int /*long*/ atkObject, int /*long*/ column) { if (DEBUG) print ("-->atkTable_get_column_header"); AccessibleObject object = getAccessibleObject (atkObject); @@ -1694,7 +1699,7 @@ } return parentResult; } - + static int /*long*/ atkTable_get_row_description (int /*long*/ atkObject, int /*long*/ row) { if (DEBUG) print ("-->atkTable_get_row_description"); AccessibleObject object = getAccessibleObject (atkObject); @@ -2007,7 +2012,7 @@ } return null; } - + static int /*long*/ atkText_get_character_extents (int /*long*/ atkObject, int /*long*/ offset, int /*long*/ x, int /*long*/ y, int /*long*/ width, int /*long*/ height, int /*long*/ coords) { if (DEBUG) print ("-->atkText_get_character_extents"); AccessibleObject object = getAccessibleObject (atkObject); @@ -2032,7 +2037,7 @@ OS.memmove (x, new int[]{event.x}, 4); OS.memmove (y, new int[]{event.y}, 4); OS.memmove (width, new int[]{event.width}, 4); - OS.memmove (height, new int[]{event.height}, 4); + OS.memmove (height, new int[]{event.height}, 4); return 0; } } @@ -2042,21 +2047,21 @@ } return 0; } - + static String getString (int /*long*/ strPtr) { int length = OS.strlen (strPtr); byte [] buffer = new byte [length]; OS.memmove (buffer, strPtr, length); return new String (Converter.mbcsToWcs (null, buffer)); } - + static int /*long*/ getStringPtr (String str) { - byte [] buffer = Converter.wcsToMbcs(null, str != null ? str : "", true); + byte [] buffer = Converter.wcsToMbcs(null, str != null ? str : "", true); int /*long*/ ptr = OS.g_malloc(buffer.length); OS.memmove(ptr, buffer, buffer.length); return ptr; } - + static int /*long*/ atkText_get_range_extents (int /*long*/ atkObject, int /*long*/ start_offset, int /*long*/ end_offset, int /*long*/ coord_type, int /*long*/ rect) { if (DEBUG) print ("-->atkText_get_range_extents"); AccessibleObject object = getAccessibleObject (atkObject); @@ -2093,7 +2098,7 @@ } return 0; } - + static int /*long*/ atkText_get_run_attributes (int /*long*/ atkObject, int /*long*/ offset, int /*long*/ start_offset, int /*long*/ end_offset) { if (DEBUG) print ("-->atkText_get_run_attributes"); AccessibleObject object = getAccessibleObject (atkObject); @@ -2151,31 +2156,31 @@ attr.value = ATK.g_strdup (OS.pango_font_description_get_family (font.handle)); ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); result = OS.g_slist_append(result, attrPtr); - + attrPtr = OS.g_malloc(AtkAttribute.sizeof); attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_SIZE)); attr.value = getStringPtr (String.valueOf (OS.pango_font_description_get_size(font.handle) / OS.PANGO_SCALE)); ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); result = OS.g_slist_append(result, attrPtr); - + attrPtr = OS.g_malloc(AtkAttribute.sizeof); attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_STYLE)); attr.value = ATK.g_strdup (ATK.atk_text_attribute_get_value(ATK.ATK_TEXT_ATTR_STYLE, OS.pango_font_description_get_style(font.handle))); ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); result = OS.g_slist_append(result, attrPtr); - + attrPtr = OS.g_malloc(AtkAttribute.sizeof); attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_VARIANT)); attr.value = ATK.g_strdup (ATK.atk_text_attribute_get_value(ATK.ATK_TEXT_ATTR_VARIANT, OS.pango_font_description_get_variant(font.handle))); ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); result = OS.g_slist_append(result, attrPtr); - + attrPtr = OS.g_malloc(AtkAttribute.sizeof); attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_STRETCH)); attr.value = ATK.g_strdup (ATK.atk_text_attribute_get_value(ATK.ATK_TEXT_ATTR_STRETCH, OS.pango_font_description_get_stretch(font.handle))); ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); result = OS.g_slist_append(result, attrPtr); - + attrPtr = OS.g_malloc(AtkAttribute.sizeof); attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_WEIGHT)); attr.value = getStringPtr (String.valueOf (OS.pango_font_description_get_weight(font.handle))); @@ -2235,7 +2240,7 @@ if (coords == ATK.ATK_XY_WINDOW) { windowPoint (object, topWindowX, topWindowY); event.x += topWindowX [0]; - event.y += topWindowY [0]; + event.y += topWindowY [0]; } for (int i = 0; i < length; i++) { AccessibleTextExtendedListener listener = listeners.get(i); @@ -2302,7 +2307,7 @@ } return parentResult; } - + static int /*long*/ atkText_set_caret_offset (int /*long*/ atkObject, int /*long*/ offset) { if (DEBUG) print ("-->atkText_set_caret_offset"); AccessibleObject object = getAccessibleObject (atkObject); @@ -2382,14 +2387,14 @@ event.offset = (int)/*64*/parentResult; for (int i = 0; i < length; i++) { AccessibleTextListener listener = listeners2.get(i); - listener.getCaretOffset (event); + listener.getCaretOffset (event); } return event.offset; } } - return parentResult; + return parentResult; } - + static int /*long*/ atkText_get_bounded_ranges (int /*long*/ atkObject, int /*long*/ rect, int /*long*/ coord_type, int /*long*/ x_clip_type, int /*long*/ y_clip_type) { if (DEBUG) print ("-->atkText_get_bounded_ranges"); AccessibleObject object = getAccessibleObject (atkObject); @@ -2450,7 +2455,7 @@ } return parentResult; } - + static int /*long*/ atkText_get_character_at_offset (int /*long*/ atkObject, int /*long*/ offset) { if (DEBUG) print ("-->atkText_get_character_at_offset"); AccessibleObject object = getAccessibleObject (atkObject); @@ -2632,7 +2637,7 @@ if (end_offset == -1) { end_offset = text.length (); } else { - end_offset = Math.min (end_offset, text.length ()); + end_offset = Math.min (end_offset, text.length ()); } start_offset = Math.min (start_offset, end_offset); text = text.substring ((int)/*64*/start_offset, (int)/*64*/end_offset); @@ -2659,13 +2664,13 @@ event.start = event.end = (int)/*64*/offset_value; event.count = 1; switch ((int)/*64*/boundary_type) { - case ATK.ATK_TEXT_BOUNDARY_CHAR: event.type = ACC.TEXT_BOUNDARY_CHAR; break; - case ATK.ATK_TEXT_BOUNDARY_WORD_START: event.type = ACC.TEXT_BOUNDARY_WORD; break; - case ATK.ATK_TEXT_BOUNDARY_WORD_END: event.type = ACC.TEXT_BOUNDARY_WORD; break; - case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break; - case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break; - case ATK.ATK_TEXT_BOUNDARY_LINE_START: event.type = ACC.TEXT_BOUNDARY_LINE; break; - case ATK.ATK_TEXT_BOUNDARY_LINE_END: event.type = ACC.TEXT_BOUNDARY_LINE; break; + case ATK.ATK_TEXT_BOUNDARY_CHAR: event.type = ACC.TEXT_BOUNDARY_CHAR; break; + case ATK.ATK_TEXT_BOUNDARY_WORD_START: event.type = ACC.TEXT_BOUNDARY_WORD; break; + case ATK.ATK_TEXT_BOUNDARY_WORD_END: event.type = ACC.TEXT_BOUNDARY_WORD; break; + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break; + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break; + case ATK.ATK_TEXT_BOUNDARY_LINE_START: event.type = ACC.TEXT_BOUNDARY_LINE; break; + case ATK.ATK_TEXT_BOUNDARY_LINE_END: event.type = ACC.TEXT_BOUNDARY_LINE; break; } int eventStart = event.start; int eventEnd = event.end; @@ -2674,8 +2679,8 @@ listener.getText(event); } switch ((int)/*64*/boundary_type) { - case ATK.ATK_TEXT_BOUNDARY_WORD_START: - case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: + case ATK.ATK_TEXT_BOUNDARY_WORD_START: + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: case ATK.ATK_TEXT_BOUNDARY_LINE_START: if (event.end < charCount) { int start = event.start; @@ -2696,8 +2701,8 @@ } } break; - case ATK.ATK_TEXT_BOUNDARY_WORD_END: - case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: + case ATK.ATK_TEXT_BOUNDARY_WORD_END: + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: case ATK.ATK_TEXT_BOUNDARY_LINE_END: if (0 < event.start) { int end = event.end; @@ -2756,7 +2761,7 @@ break; } case ATK.ATK_TEXT_BOUNDARY_WORD_END: { - int previousWordEnd = previousIndexOfNotChar (text, " \n", offset); + int previousWordEnd = previousIndexOfNotChar (text, " \n", offset); if (previousWordEnd == -1 || previousWordEnd != offset - 1) { offset = nextIndexOfNotChar (text, " \n", offset); } @@ -2885,7 +2890,7 @@ OS.memmove (end_offset, new int[] {endBounds}, 4); text = text.substring (startBounds, endBounds); return getStringPtr (text); - } + } } AtkTextIface iface = getTextIface (atkObject); if (iface != null && iface.get_text_after_offset != 0) { @@ -2907,13 +2912,13 @@ event.start = event.end = (int)/*64*/offset_value; event.count = 0; switch ((int)/*64*/boundary_type) { - case ATK.ATK_TEXT_BOUNDARY_CHAR: event.type = ACC.TEXT_BOUNDARY_CHAR; break; - case ATK.ATK_TEXT_BOUNDARY_WORD_START: event.type = ACC.TEXT_BOUNDARY_WORD; break; - case ATK.ATK_TEXT_BOUNDARY_WORD_END: event.type = ACC.TEXT_BOUNDARY_WORD; break; - case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break; - case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break; - case ATK.ATK_TEXT_BOUNDARY_LINE_START: event.type = ACC.TEXT_BOUNDARY_LINE; break; - case ATK.ATK_TEXT_BOUNDARY_LINE_END: event.type = ACC.TEXT_BOUNDARY_LINE; break; + case ATK.ATK_TEXT_BOUNDARY_CHAR: event.type = ACC.TEXT_BOUNDARY_CHAR; break; + case ATK.ATK_TEXT_BOUNDARY_WORD_START: event.type = ACC.TEXT_BOUNDARY_WORD; break; + case ATK.ATK_TEXT_BOUNDARY_WORD_END: event.type = ACC.TEXT_BOUNDARY_WORD; break; + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break; + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break; + case ATK.ATK_TEXT_BOUNDARY_LINE_START: event.type = ACC.TEXT_BOUNDARY_LINE; break; + case ATK.ATK_TEXT_BOUNDARY_LINE_END: event.type = ACC.TEXT_BOUNDARY_LINE; break; } int eventStart = event.start; int eventEnd = event.end; @@ -2922,8 +2927,8 @@ listener.getText(event); } switch ((int)/*64*/boundary_type) { - case ATK.ATK_TEXT_BOUNDARY_WORD_START: - case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: + case ATK.ATK_TEXT_BOUNDARY_WORD_START: + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: case ATK.ATK_TEXT_BOUNDARY_LINE_START: if (event.end < charCount) { int start = event.start; @@ -2944,8 +2949,8 @@ } } break; - case ATK.ATK_TEXT_BOUNDARY_WORD_END: - case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: + case ATK.ATK_TEXT_BOUNDARY_WORD_END: + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: case ATK.ATK_TEXT_BOUNDARY_LINE_END: if (0 < event.start) { int end = event.end; @@ -3076,7 +3081,7 @@ OS.memmove (end_offset, new int[] {endBounds}, 4); text = text.substring (startBounds, endBounds); return getStringPtr (text); - } + } } AtkTextIface iface = getTextIface (atkObject); if (iface != null && iface.get_text_at_offset != 0) { @@ -3098,13 +3103,13 @@ event.start = event.end = (int)/*64*/offset_value; event.count = -1; switch ((int)/*64*/boundary_type) { - case ATK.ATK_TEXT_BOUNDARY_CHAR: event.type = ACC.TEXT_BOUNDARY_CHAR; break; - case ATK.ATK_TEXT_BOUNDARY_WORD_START: event.type = ACC.TEXT_BOUNDARY_WORD; break; - case ATK.ATK_TEXT_BOUNDARY_WORD_END: event.type = ACC.TEXT_BOUNDARY_WORD; break; - case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break; - case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break; - case ATK.ATK_TEXT_BOUNDARY_LINE_START: event.type = ACC.TEXT_BOUNDARY_LINE; break; - case ATK.ATK_TEXT_BOUNDARY_LINE_END: event.type = ACC.TEXT_BOUNDARY_LINE; break; + case ATK.ATK_TEXT_BOUNDARY_CHAR: event.type = ACC.TEXT_BOUNDARY_CHAR; break; + case ATK.ATK_TEXT_BOUNDARY_WORD_START: event.type = ACC.TEXT_BOUNDARY_WORD; break; + case ATK.ATK_TEXT_BOUNDARY_WORD_END: event.type = ACC.TEXT_BOUNDARY_WORD; break; + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break; + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break; + case ATK.ATK_TEXT_BOUNDARY_LINE_START: event.type = ACC.TEXT_BOUNDARY_LINE; break; + case ATK.ATK_TEXT_BOUNDARY_LINE_END: event.type = ACC.TEXT_BOUNDARY_LINE; break; } int eventStart = event.start; int eventEnd = event.end; @@ -3115,8 +3120,8 @@ OS.memmove (start_offset, new int[] {event.start}, 4); OS.memmove (end_offset, new int[] {event.end}, 4); switch ((int)/*64*/boundary_type) { - case ATK.ATK_TEXT_BOUNDARY_WORD_START: - case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: + case ATK.ATK_TEXT_BOUNDARY_WORD_START: + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: case ATK.ATK_TEXT_BOUNDARY_LINE_START: if (event.end < charCount) { int start = event.start; @@ -3137,8 +3142,8 @@ } } break; - case ATK.ATK_TEXT_BOUNDARY_WORD_END: - case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: + case ATK.ATK_TEXT_BOUNDARY_WORD_END: + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: case ATK.ATK_TEXT_BOUNDARY_LINE_END: if (0 < event.start) { int end = event.end; @@ -3280,7 +3285,7 @@ } return 0; } - + static void setGValue (int /*long*/ value, Number number) { if (number == null) return; if (OS.G_VALUE_TYPE(value) != 0) OS.g_value_unset(value); @@ -3305,9 +3310,9 @@ if (type == OS.G_TYPE_DOUBLE()) return new Double(OS.g_value_get_double(value)); if (type == OS.G_TYPE_FLOAT()) return new Float(OS.g_value_get_float(value)); if (type == OS.G_TYPE_INT64()) return new Long(OS.g_value_get_int64(value)); - return new Integer(OS.g_value_get_int(value)); + return Integer.valueOf(OS.g_value_get_int(value)); } - + static AtkValueIface getValueIface (int /*long*/ atkObject) { if (ATK.g_type_is_a (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject)), ATK.ATK_TYPE_VALUE())) { AtkValueIface iface = new AtkValueIface (); @@ -3421,7 +3426,7 @@ if (control == null || control.isDisposed()) return null; return object; } - + AccessibleObject getChildByID (int childId) { if (childId == ACC.CHILDID_SELF) return this; if (childId == ACC.CHILDID_NONE || childId == ACC.CHILDID_MULTIPLE) return null; @@ -3433,12 +3438,12 @@ } return null; } - + AccessibleObject getChildByIndex (int childIndex) { if (children != null && childIndex < children.length) return children [childIndex]; return null; } - + String getText () { List listeners = accessible.accessibleControlListeners; int length = size(listeners); @@ -3460,7 +3465,7 @@ event.result = parentText; for (int i = 0; i < length; i++) { AccessibleControlListener listener = listeners.get (i); - listener.getValue (event); + listener.getValue (event); } return event.result; } @@ -3501,7 +3506,7 @@ } return 0; } - + static void windowPoint (AccessibleObject object, int [] x, int [] y) { int /*long*/ widget; if (OS.GTK_VERSION >= OS.VERSION(2, 22, 0)) { @@ -3526,7 +3531,7 @@ int /*long*/ window = OS.gtk_widget_get_window (topLevel); OS.gdk_window_get_origin (window, x, y); } - + static int nextIndexOfChar (String string, String searchChars, int startIndex) { int result = string.length (); for (int i = 0; i < searchChars.length (); i++) { @@ -3539,10 +3544,10 @@ static int nextIndexOfNotChar (String string, String searchChars, int startIndex) { int length = string.length (); - int index = startIndex; + int index = startIndex; while (index < length) { char current = string.charAt (index); - if (searchChars.indexOf (current) == -1) break; + if (searchChars.indexOf (current) == -1) break; index++; } return index; @@ -3562,15 +3567,15 @@ static int previousIndexOfNotChar (String string, String searchChars, int startIndex) { if (startIndex < 0) return -1; - int index = startIndex - 1; + int index = startIndex - 1; while (index >= 0) { char current = string.charAt (index); - if (searchChars.indexOf (current) == -1) break; + if (searchChars.indexOf (current) == -1) break; index--; } return index; } - + void addRelation (int type, Accessible target) { OS.atk_object_add_relationship(handle, toATKRelation(type), target.getAccessibleObject().handle); } @@ -3590,15 +3595,15 @@ OS.g_object_unref(handle); } } - + void removeRelation (int type, Accessible target) { OS.atk_object_remove_relationship (handle, toATKRelation(type), target.getAccessibleObject().handle); } - + void selectionChanged () { OS.g_signal_emit_by_name (handle, ATK.selection_changed); } - + void sendEvent(int event, Object eventData) { switch (event) { case ACC.EVENT_SELECTION_CHANGED: @@ -3770,7 +3775,7 @@ e.childID = id; for (int i = 0; i < length; i++) { AccessibleTextListener listener = listeners2.get(i); - listener.getCaretOffset (e); + listener.getCaretOffset (e); } } } @@ -3796,7 +3801,7 @@ } } } - + void sendEvent(int event, Object eventData, int childID) { updateChildren (); AccessibleObject accObject = getChildByID (childID); @@ -3804,7 +3809,7 @@ accObject.sendEvent(event, eventData); } } - + void setFocus (int childID) { updateChildren (); AccessibleObject accObject = getChildByID (childID); @@ -3813,7 +3818,7 @@ ATK.atk_object_notify_state_change(accObject.handle, ATK.ATK_STATE_FOCUSED, true); } } - + void textCaretMoved(int index) { OS.g_signal_emit_by_name (handle, ATK.text_caret_moved, index); } @@ -3829,7 +3834,7 @@ void textSelectionChanged() { OS.g_signal_emit_by_name (handle, ATK.text_selection_changed); } - + void updateChildren () { List listeners = accessible.accessibleControlListeners; int length = size(listeners); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleTableAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleTableAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleTableAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleTableAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 2016 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 @@ -32,36 +32,39 @@ public class AccessibleTableAdapter implements AccessibleTableListener { /** * Deselects one column, leaving other selected columns selected (if any). - * + * * @param e an event object containing the following fields:
                    *
                  • [in] column - 0 based index of the column to be unselected.
                  • *
                  • [out] result - set to {@link ACC#OK} if the column was deselected.
                  • *
                  */ + @Override public void deselectColumn(AccessibleTableEvent e) {} /** * Deselects one row, leaving other selected rows selected (if any). - * + * * @param e an event object containing the following fields:
                    *
                  • [in] row - 0 based index of the row to be unselected
                  • *
                  • [out] result - set to {@link ACC#OK} if the row was deselected.
                  • *
                  */ + @Override public void deselectRow(AccessibleTableEvent e) {} /** * Returns the caption for the table. - * + * * @param e an event object containing the following fields:
                    *
                  • [out] accessible - the caption for the table, or null if the table does not have a caption
                  • *
                  */ + @Override public void getCaption(AccessibleTableEvent e) {} /** * Returns the accessible object at the specified row and column in the table. - * + * * @param e an event object containing the following fields:
                    *
                  • [in] row - the 0 based row index for which to retrieve the accessible cell
                  • *
                  • [in] column - the 0 based column index for which to retrieve the accessible cell
                  • @@ -69,273 +72,301 @@ * or null if the row or column index are not valid *
                  */ + @Override public void getCell(AccessibleTableEvent e) {} /** * Returns the accessible object for the specified column in the table. - * + * * @param e an event object containing the following fields:
                    *
                  • [in] column - the 0 based column index for which to retrieve the accessible column
                  • *
                  • [out] accessible - the table column at the specified column index, * or null if the column index is not valid
                  • *
                  */ + @Override public void getColumn(AccessibleTableEvent e) {} /** * Returns the total number of columns in the table. - * + * * @param e an event object containing the following fields:
                    *
                  • [out] count - the number of columns in the table
                  • *
                  */ + @Override public void getColumnCount(AccessibleTableEvent e) {} /** * Returns the description text of the specified column in the table. - * + * * @param e an event object containing the following fields:
                    *
                  • [in] column - the 0 based index of the column for which to retrieve the description
                  • *
                  • [out] result - the description text of the specified column in the table, * or null if the column does not have a description
                  • *
                  */ + @Override public void getColumnDescription(AccessibleTableEvent e) {} /** * Returns the accessible object for the column header. - * + * * @param e an event object containing the following fields:
                    *
                  • [out] accessible - an accessible object representing the column header, * or null if there is no column header
                  • *
                  */ + @Override public void getColumnHeader(AccessibleTableEvent e) {} /** * Returns the column header cells as an array of accessible objects. - * + * * @param e an event object containing the following fields:
                    *
                  • [out] accessibles - an array of accessible objects representing column header cells, * or null if there are no column header cells
                  • *
                  */ + @Override public void getColumnHeaderCells(AccessibleTableEvent e) {} /** * Returns the columns as an array of accessible objects. - * + * * @param e an event object containing the following fields:
                    *
                  • [out] accessibles - an array of accessible objects representing columns, * or null if there are no columns
                  • *
                  */ + @Override public void getColumns(AccessibleTableEvent e) {} /** * Returns the accessible object for the specified row in the table. - * + * * @param e an event object containing the following fields:
                    *
                  • [in] row - the 0 based row index for which to retrieve the accessible row
                  • *
                  • [out] accessible - the table row at the specified row index, * or null if the row index is not valid
                  • *
                  */ + @Override public void getRow(AccessibleTableEvent e) {} /** * Returns the total number of rows in the table. - * + * * @param e an event object containing the following fields:
                    *
                  • [out] count - the number of rows in the table
                  • *
                  */ + @Override public void getRowCount(AccessibleTableEvent e) {} /** * Returns the description text of the specified row in the table. - * + * * @param e an event object containing the following fields:
                    *
                  • [in] row - the 0 based index of the row for which to retrieve the description
                  • *
                  • [out] result - the description text of the specified row in the table, * or null if the row does not have a description
                  • *
                  */ + @Override public void getRowDescription(AccessibleTableEvent e) {} /** * Returns the accessible object for the row header. - * + * * @param e an event object containing the following fields:
                    *
                  • [out] accessible - an accessible object representing the row header, * or null if there is no row header
                  • *
                  */ + @Override public void getRowHeader(AccessibleTableEvent e) {} /** * Returns the row header cells as an array of accessible objects. - * + * * @param e an event object containing the following fields:
                    *
                  • [out] accessibles - an array of accessible objects representing row header cells, * or null if there are no row header cells
                  • *
                  */ + @Override public void getRowHeaderCells(AccessibleTableEvent e) {} /** * Returns the rows as an array of accessible objects. - * + * * @param e an event object containing the following fields:
                    *
                  • [out] accessibles - an array of accessible objects representing rows, * or null if there are no rows
                  • *
                  */ + @Override public void getRows(AccessibleTableEvent e) {} /** * Returns the number of selected cells. - * + * * @param e an event object containing the following fields:
                    *
                  • [out] count - the number of cells currently selected
                  • *
                  */ + @Override public void getSelectedCellCount(AccessibleTableEvent e) {} /** * Returns the currently selected cells. - * + * * @param e an event object containing the following fields:
                    *
                  • [out] accessibles - array containing the selected accessible cells
                  • *
                  */ + @Override public void getSelectedCells(AccessibleTableEvent e) {} /** * Returns the number of selected columns. - * + * * @param e an event object containing the following fields:
                    *
                  • [out] count - the number of columns currently selected
                  • *
                  */ + @Override public void getSelectedColumnCount(AccessibleTableEvent e) {} /** * Returns the column indexes that are currently selected. - * + * * @param e an event object containing the following fields:
                    *
                  • [out] selected - an array of 0 based column indexes of selected columns
                  • *
                  */ + @Override public void getSelectedColumns(AccessibleTableEvent e) {} /** * Returns the number of selected rows. - * + * * @param e an event object containing the following fields:
                    *
                  • [out] count - the number of rows currently selected
                  • *
                  */ + @Override public void getSelectedRowCount(AccessibleTableEvent e) {} /** * Returns the row indexes that are currently selected. - * + * * @param e an event object containing the following fields:
                    *
                  • [out] selected - an array of 0 based row indexes of selected rows
                  • *
                  */ + @Override public void getSelectedRows(AccessibleTableEvent e) {} /** * Returns the summary description of the table. - * + * * @param e an event object containing the following fields:
                    *
                  • [out] accessible - the summary for the table, * or null if the table does not have a summary
                  • *
                  */ + @Override public void getSummary(AccessibleTableEvent e) {} /** * Returns the visible columns as an array of accessible objects. - * + * * @param e an event object containing the following fields:
                    *
                  • [out] accessibles - an array of accessible objects representing visible columns, * or null if there are no visible columns
                  • *
                  */ + @Override public void getVisibleColumns(AccessibleTableEvent e) {} /** * Returns the visible rows as an array of accessible objects. - * + * * @param e an event object containing the following fields:
                    *
                  • [out] accessibles - an array of accessible objects representing visible rows, * or null if there are no visible rows
                  • *
                  */ + @Override public void getVisibleRows(AccessibleTableEvent e) {} /** * Returns a boolean value indicating whether the specified column is * completely selected. - * + * * @param e an event object containing the following fields:
                    *
                  • [in] column - 0 based index of the column for which to determine whether it is selected
                  • *
                  • [out] isSelected - true if the specified column is selected completely, and false otherwise
                  • *
                  */ + @Override public void isColumnSelected(AccessibleTableEvent e) {} /** * Returns a boolean value indicating whether the specified row is * completely selected. - * + * * @param e an event object containing the following fields:
                    *
                  • [in] row - 0 based index of the row for which to determine whether it is selected
                  • *
                  • [out] isSelected - true if the specified row is selected completely, and false otherwise
                  • *
                  */ + @Override public void isRowSelected(AccessibleTableEvent e) {} /** * Selects a column. - * + * * @param e an event object containing the following fields:
                    *
                  • [in] column - 0 based index of the column to be selected
                  • *
                  • [out] result - set to {@link ACC#OK} if the column was selected.
                  • *
                  */ + @Override public void selectColumn(AccessibleTableEvent e) {} /** * Selects a row. - * + * * @param e an event object containing the following fields:
                    *
                  • [in] row - 0 based index of the row to be selected
                  • *
                  • [out] result - set to {@link ACC#OK} if the row was selected.
                  • *
                  */ + @Override public void selectRow(AccessibleTableEvent e) {} /** * Selects a column and deselects all previously selected columns. - * + * * @param e an event object containing the following fields:
                    *
                  • [in] column - 0 based index of the column to be selected
                  • *
                  • [out] result - set to {@link ACC#OK} if the column was selected.
                  • *
                  */ + @Override public void setSelectedColumn(AccessibleTableEvent e) {} /** * Selects a row and deselects all previously selected rows. - * + * * @param e an event object containing the following fields:
                    *
                  • [in] row - 0 based index of the row to be selected
                  • *
                  • [out] result - set to {@link ACC#OK} if the row was selected.
                  • *
                  */ + @Override public void setSelectedRow(AccessibleTableEvent e) {} } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleTableCellAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleTableCellAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleTableCellAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleTableCellAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 2016 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 @@ -31,31 +31,34 @@ * This is 1 if the specified cell is only in one column, or * more than 1 if the specified cell spans multiple columns. *

                  - * + * * @param e an event object containing the following fields:
                    *
                  • [out] count - the 1 based number of columns spanned by the specified cell *
                  */ + @Override public void getColumnSpan(AccessibleTableCellEvent e) {} /** * Returns the column headers as an array of cell accessibles. * TODO: doc that this is a more efficient way to get headers of a cell than TableListener.getRow/ColHeaders - * + * * @param e an event object containing the following fields:
                    *
                  • [out] accessibles - an array of cell accessibles, or null if there are no column headers *
                  */ + @Override public void getColumnHeaders(AccessibleTableCellEvent e) {} /** * Translates this cell accessible into the corresponding column index. - * + * * @param e an event object containing the following fields:
                    *
                  • [out] index - the 0 based column index of the specified cell, * or the index of the first column if the cell spans multiple columns *
                  */ + @Override public void getColumnIndex(AccessibleTableCellEvent e) {} /** @@ -64,48 +67,53 @@ * This is 1 if the specified cell is only in one row, or * more than 1 if the specified cell spans multiple rows. *

                  - * + * * @param e an event object containing the following fields:
                    *
                  • [out] count - the 1 based number of rows spanned by the specified cell *
                  */ + @Override public void getRowSpan(AccessibleTableCellEvent e) {} /** * Returns the row headers as an array of cell accessibles. * TODO: doc that this is a more efficient way to get headers of a cell than TableListener.getRow/ColHeaders - * + * * @param e an event object containing the following fields:
                    *
                  • [out] accessibles - an array of cell accessibles, or null if there are no row headers *
                  */ + @Override public void getRowHeaders(AccessibleTableCellEvent e) {} /** * Translates this cell accessible into the corresponding row index. - * + * * @param e an event object containing the following fields:
                    *
                  • [out] index - the 0 based row index of the specified cell, * or the index of the first row if the cell spans multiple rows *
                  */ + @Override public void getRowIndex(AccessibleTableCellEvent e) {} /** * Returns the accessible for the table containing this cell. - * + * * @param e an event object containing the following fields:
                    *
                  • [out] accessible - the accessible for the containing table *
                  */ + @Override public void getTable(AccessibleTableCellEvent e) {} /** * Returns a boolean value indicating whether this cell is selected. - * + * * @param e an event object containing the following fields:
                    *
                  • [out] isSelected - true if the specified cell is selected and false otherwise *
                  */ + @Override public void isSelected(AccessibleTableCellEvent e) {} } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleTableCellListener.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleTableCellListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleTableCellListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleTableCellListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -34,7 +34,7 @@ * This is 1 if the specified cell is only in one column, or * more than 1 if the specified cell spans multiple columns. *

                  - * + * * @param e an event object containing the following fields:
                    *
                  • [out] count - the 1 based number of columns spanned by the specified cell *
                  @@ -44,7 +44,7 @@ /** * Returns the column headers as an array of cell accessibles. * TODO: doc that this is a more efficient way to get headers of a cell than TableListener.getRow/ColHeaders - * + * * @param e an event object containing the following fields:
                    *
                  • [out] accessibles - an array of cell accessibles, or null if there are no column headers *
                  @@ -53,7 +53,7 @@ /** * Translates this cell accessible into the corresponding column index. - * + * * @param e an event object containing the following fields:
                    *
                  • [out] index - the 0 based column index of the specified cell, * or the index of the first column if the cell spans multiple columns @@ -67,7 +67,7 @@ * This is 1 if the specified cell is only in one row, or * more than 1 if the specified cell spans multiple rows. *

                    - * + * * @param e an event object containing the following fields:
                      *
                    • [out] count - the 1 based number of rows spanned by the specified cell *
                    @@ -77,7 +77,7 @@ /** * Returns the row headers as an array of cell accessibles. * TODO: doc that this is a more efficient way to get headers of a cell than TableListener.getRow/ColHeaders - * + * * @param e an event object containing the following fields:
                      *
                    • [out] accessibles - an array of cell accessibles, or null if there are no row headers *
                    @@ -86,7 +86,7 @@ /** * Translates this cell accessible into the corresponding row index. - * + * * @param e an event object containing the following fields:
                      *
                    • [out] index - the 0 based row index of the specified cell, * or the index of the first row if the cell spans multiple rows @@ -96,7 +96,7 @@ /** * Returns the accessible for the table containing this cell. - * + * * @param e an event object containing the following fields:
                        *
                      • [out] accessible - the accessible for the containing table *
                      @@ -105,7 +105,7 @@ /** * Returns a boolean value indicating whether this cell is selected. - * + * * @param e an event object containing the following fields:
                        *
                      • [out] isSelected - true if the specified cell is selected and false otherwise *
                      diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleTableEvent.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleTableEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleTableEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleTableEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -25,13 +25,13 @@ public Accessible accessible; public Accessible[] accessibles; - + /** * The value of this field must be set in the accessible table listener method * before returning. What to set it to depends on the listener method called. */ public String result; - + public int column; public int row; public int count; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleTableListener.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleTableListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleTableListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleTableListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -35,7 +35,7 @@ public interface AccessibleTableListener extends SWTEventListener { /** * Deselects one column, leaving other selected columns selected (if any). - * + * * @param e an event object containing the following fields:
                        *
                      • [in] column - 0 based index of the column to be unselected.
                      • *
                      • [out] result - set to {@link ACC#OK} if the column was deselected.
                      • @@ -45,7 +45,7 @@ /** * Deselects one row, leaving other selected rows selected (if any). - * + * * @param e an event object containing the following fields:
                          *
                        • [in] row - 0 based index of the row to be unselected
                        • *
                        • [out] result - set to {@link ACC#OK} if the row was deselected.
                        • @@ -55,7 +55,7 @@ /** * Returns the caption for the table. - * + * * @param e an event object containing the following fields:
                            *
                          • [out] accessible - the caption for the table, or null if the table does not have a caption
                          • *
                          @@ -64,7 +64,7 @@ /** * Returns the accessible object at the specified row and column in the table. - * + * * @param e an event object containing the following fields:
                            *
                          • [in] row - the 0 based row index for which to retrieve the accessible cell
                          • *
                          • [in] column - the 0 based column index for which to retrieve the accessible cell
                          • @@ -76,7 +76,7 @@ /** * Returns the accessible object for the specified column in the table. - * + * * @param e an event object containing the following fields:
                              *
                            • [in] column - the 0 based column index for which to retrieve the accessible column
                            • *
                            • [out] accessible - the table column at the specified column index, @@ -87,7 +87,7 @@ /** * Returns the total number of columns in the table. - * + * * @param e an event object containing the following fields:
                                *
                              • [out] count - the number of columns in the table
                              • *
                              @@ -96,7 +96,7 @@ /** * Returns the description text of the specified column in the table. - * + * * @param e an event object containing the following fields:
                                *
                              • [in] column - the 0 based index of the column for which to retrieve the description
                              • *
                              • [out] result - the description text of the specified column in the table, @@ -107,7 +107,7 @@ /** * Returns the accessible object for the column header. - * + * * @param e an event object containing the following fields:
                                  *
                                • [out] accessible - an accessible object representing the column header, * or null if there is no column header
                                • @@ -117,7 +117,7 @@ /** * Returns the column header cells as an array of accessible objects. - * + * * @param e an event object containing the following fields:
                                    *
                                  • [out] accessibles - an array of accessible objects representing column header cells, * or null if there are no column header cells
                                  • @@ -127,7 +127,7 @@ /** * Returns the columns as an array of accessible objects. - * + * * @param e an event object containing the following fields:
                                      *
                                    • [out] accessibles - an array of accessible objects representing columns, * or null if there are no columns
                                    • @@ -137,7 +137,7 @@ /** * Returns the accessible object for the specified row in the table. - * + * * @param e an event object containing the following fields:
                                        *
                                      • [in] row - the 0 based row index for which to retrieve the accessible row
                                      • *
                                      • [out] accessible - the table row at the specified row index, @@ -148,7 +148,7 @@ /** * Returns the total number of rows in the table. - * + * * @param e an event object containing the following fields:
                                          *
                                        • [out] count - the number of rows in the table
                                        • *
                                        @@ -157,7 +157,7 @@ /** * Returns the description text of the specified row in the table. - * + * * @param e an event object containing the following fields:
                                          *
                                        • [in] row - the 0 based index of the row for which to retrieve the description
                                        • *
                                        • [out] result - the description text of the specified row in the table, @@ -168,7 +168,7 @@ /** * Returns the accessible object for the row header. - * + * * @param e an event object containing the following fields:
                                            *
                                          • [out] accessible - an accessible object representing the row header, * or null if there is no row header
                                          • @@ -178,7 +178,7 @@ /** * Returns the row header cells as an array of accessible objects. - * + * * @param e an event object containing the following fields:
                                              *
                                            • [out] accessibles - an array of accessible objects representing row header cells, * or null if there are no row header cells
                                            • @@ -188,7 +188,7 @@ /** * Returns the rows as an array of accessible objects. - * + * * @param e an event object containing the following fields:
                                                *
                                              • [out] accessibles - an array of accessible objects representing rows, * or null if there are no rows
                                              • @@ -198,7 +198,7 @@ /** * Returns the number of selected cells. - * + * * @param e an event object containing the following fields:
                                                  *
                                                • [out] count - the number of cells currently selected
                                                • *
                                                @@ -207,7 +207,7 @@ /** * Returns the currently selected cells. - * + * * @param e an event object containing the following fields:
                                                  *
                                                • [out] accessibles - array containing the selected accessible cells
                                                • *
                                                @@ -216,7 +216,7 @@ /** * Returns the number of selected columns. - * + * * @param e an event object containing the following fields:
                                                  *
                                                • [out] count - the number of columns currently selected
                                                • *
                                                @@ -225,7 +225,7 @@ /** * Returns the column indexes that are currently selected. - * + * * @param e an event object containing the following fields:
                                                  *
                                                • [out] selected - an array of 0 based column indexes of selected columns
                                                • *
                                                @@ -234,7 +234,7 @@ /** * Returns the number of selected rows. - * + * * @param e an event object containing the following fields:
                                                  *
                                                • [out] count - the number of rows currently selected
                                                • *
                                                @@ -243,7 +243,7 @@ /** * Returns the row indexes that are currently selected. - * + * * @param e an event object containing the following fields:
                                                  *
                                                • [out] selected - an array of 0 based row indexes of selected rows
                                                • *
                                                @@ -252,7 +252,7 @@ /** * Returns the summary description of the table. - * + * * @param e an event object containing the following fields:
                                                  *
                                                • [out] accessible - the summary for the table, * or null if the table does not have a summary
                                                • @@ -262,7 +262,7 @@ /** * Returns the visible columns as an array of accessible objects. - * + * * @param e an event object containing the following fields:
                                                    *
                                                  • [out] accessibles - an array of accessible objects representing visible columns, * or null if there are no visible columns
                                                  • @@ -272,7 +272,7 @@ /** * Returns the visible rows as an array of accessible objects. - * + * * @param e an event object containing the following fields:
                                                      *
                                                    • [out] accessibles - an array of accessible objects representing visible rows, * or null if there are no visible rows
                                                    • @@ -283,7 +283,7 @@ /** * Returns a boolean value indicating whether the specified column is * completely selected. - * + * * @param e an event object containing the following fields:
                                                        *
                                                      • [in] column - 0 based index of the column for which to determine whether it is selected
                                                      • *
                                                      • [out] isSelected - true if the specified column is selected completely, and false otherwise
                                                      • @@ -294,7 +294,7 @@ /** * Returns a boolean value indicating whether the specified row is * completely selected. - * + * * @param e an event object containing the following fields:
                                                          *
                                                        • [in] row - 0 based index of the row for which to determine whether it is selected
                                                        • *
                                                        • [out] isSelected - true if the specified row is selected completely, and false otherwise
                                                        • @@ -304,7 +304,7 @@ /** * Selects a column. - * + * * @param e an event object containing the following fields:
                                                            *
                                                          • [in] column - 0 based index of the column to be selected
                                                          • *
                                                          • [out] result - set to {@link ACC#OK} if the column was selected.
                                                          • @@ -314,7 +314,7 @@ /** * Selects a row. - * + * * @param e an event object containing the following fields:
                                                              *
                                                            • [in] row - 0 based index of the row to be selected
                                                            • *
                                                            • [out] result - set to {@link ACC#OK} if the row was selected.
                                                            • @@ -324,7 +324,7 @@ /** * Selects a column and deselects all previously selected columns. - * + * * @param e an event object containing the following fields:
                                                                *
                                                              • [in] column - 0 based index of the column to be selected
                                                              • *
                                                              • [out] result - set to {@link ACC#OK} if the column was selected.
                                                              • @@ -334,7 +334,7 @@ /** * Selects a row and deselects all previously selected rows. - * + * * @param e an event object containing the following fields:
                                                                  *
                                                                • [in] row - 0 based index of the row to be selected
                                                                • *
                                                                • [out] result - set to {@link ACC#OK} if the row was selected.
                                                                • diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleTextAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleTextAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleTextAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleTextAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -34,11 +34,11 @@ * @see AccessibleTextListener * @see AccessibleTextEvent * @see Sample code and further information - * + * * @since 3.0 */ public abstract class AccessibleTextAdapter implements AccessibleTextListener { - + /** * Sent when an accessibility client requests the current character offset * of the text caret. @@ -53,6 +53,7 @@ *
                                                                • offset [OUT] - the current offset of the text caret
                                                                • *
                                                                */ + @Override public void getCaretOffset (AccessibleTextEvent e) { } @@ -71,6 +72,7 @@ *
                                                              • length [OUT] - the length of the current text selection
                                                              • *
                                                              */ + @Override public void getSelectionRange (AccessibleTextEvent e) { } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleTextAttributeEvent.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleTextAttributeEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleTextAttributeEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleTextAttributeEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -29,14 +29,14 @@ /** * [in] the 0-based text offset for which to return attribute information - * + * * @see AccessibleAttributeListener#getTextAttributes */ public int offset; /** * [in/out] the starting and ending offsets of the character range - * + * * @see AccessibleAttributeListener#getTextAttributes * @see AccessibleEditableTextListener#setTextAttributes */ @@ -44,16 +44,16 @@ /** * [in/out] the TextStyle of the character range - * + * * @see AccessibleAttributeListener#getTextAttributes * @see AccessibleEditableTextListener#setTextAttributes */ public TextStyle textStyle; - + /** * [in/out] an array of alternating key and value Strings * that represent attributes that do not correspond to TextStyle fields - * + * * @see AccessibleAttributeListener#getTextAttributes * @see AccessibleEditableTextListener#setTextAttributes */ @@ -62,9 +62,9 @@ /** * [out] Set this field to {@link ACC#OK} if the operation * was completed successfully, and null otherwise. - * + * * @see AccessibleEditableTextListener#setTextAttributes - * + * * @since 3.7 */ public String result; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleTextEvent.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleTextEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleTextEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleTextEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -28,7 +28,7 @@ * @see AccessibleTextListener * @see AccessibleTextAdapter * @see Sample code and further information - * + * * @since 3.0 */ public class AccessibleTextEvent extends SWTEventObject { @@ -43,7 +43,7 @@ * @since 3.6 */ public String result; - + /** @since 3.6 */ public int count; /** @since 3.6 */ @@ -58,9 +58,9 @@ public int [] ranges; /** @since 3.6 */ public Rectangle [] rectangles; - + static final long serialVersionUID = 3977019530868308275L; - + /** * Constructs a new instance of this class. * @@ -82,5 +82,5 @@ " offset=" + offset + //$NON-NLS-1$ " length=" + length + //$NON-NLS-1$ "}"; //$NON-NLS-1$ -} +} } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleTextExtendedAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleTextExtendedAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleTextExtendedAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleTextExtendedAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 2016 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 @@ -27,43 +27,47 @@ public class AccessibleTextExtendedAdapter extends AccessibleTextAdapter implements AccessibleTextExtendedListener { /** * Adds a text selection. - * + * * @param e an event object containing the following fields:
                                                                *
                                                              • [in] start - the 0 based offset of the first character of the new selection
                                                              • *
                                                              • [in] end - the 0 based offset after the last character of the new selection
                                                              • *
                                                              • [out] result - set to {@link ACC#OK} if the text selection was added
                                                              • *
                                                              */ + @Override public void addSelection(AccessibleTextEvent e) {} /** * Returns the total number of characters in the text. - * + * * @param e an event object containing the following fields:
                                                                *
                                                              • [out] count - the total number of characters
                                                              • *
                                                              */ + @Override public void getCharacterCount(AccessibleTextEvent e) {} /** * Returns the number of links and link groups contained within this hypertext * paragraph. - * + * * @param e an event object containing the following fields:
                                                                *
                                                              • [out] count - the number of links and link groups within this hypertext paragraph, * or 0 if there are none
                                                              • *
                                                              */ + @Override public void getHyperlinkCount(AccessibleTextEvent e) {} /** * Returns the specified hyperlink. - * + * * @param e an event object containing the following fields:
                                                                *
                                                              • [in] index - the 0 based index of the hyperlink to return
                                                              • *
                                                              • [out] accessible - the specified hyperlink object, or null if the index is invalid
                                                              • *
                                                              */ + @Override public void getHyperlink(AccessibleTextEvent e) {} /** @@ -77,11 +81,12 @@ * character offset, or -1 if the offset is not in a link *
                                                            */ + @Override public void getHyperlinkIndex(AccessibleTextEvent e) {} /** * Returns the offset of the character under the specified point. - * + * * @param e an event object containing the following fields:
                                                              *
                                                            • [in] x - the X value in display coordinates for which to look up the offset of the character * that is rendered on the display at that point
                                                            • @@ -91,6 +96,7 @@ * or -1 if the point is invalid or there is no character under the point *
                                                            */ + @Override public void getOffsetAtPoint(AccessibleTextEvent e) {} /** @@ -98,7 +104,7 @@ *

                                                            * Partially visible characters are included in the returned ranges. *

                                                            - * + * * @param e an event object containing the following fields:
                                                              *
                                                            • [in] x - the X coordinate of the top left corner of the bounding box, in display relative coordinates
                                                            • *
                                                            • [in] y - the Y coordinate of the top left corner of the bounding box, in display relative coordinates
                                                            • @@ -110,26 +116,29 @@ * if the text range is clipped by the bounding box *
                                                            */ + @Override public void getRanges(AccessibleTextEvent e) {} /** * Returns the character offsets of the specified text selection. - * + * * @param e an event object containing the following fields:
                                                              *
                                                            • [in] index - the 0 based index of the selection
                                                            • *
                                                            • [out] start - the 0 based offset of first selected character
                                                            • *
                                                            • [out] end - the 0 based offset after the last selected character
                                                            • *
                                                            */ + @Override public void getSelection(AccessibleTextEvent e) {} /** * Returns the number of active non-contiguous selections. - * + * * @param e an event object containing the following fields:
                                                              *
                                                            • [out] count - the number of active non-contiguous selections
                                                            • *
                                                            */ + @Override public void getSelectionCount(AccessibleTextEvent e) {} /** @@ -152,7 +161,7 @@ * If start and end are valid, but no suitable word (or other boundary type) is found, * the returned string is null and the returned range is degenerate (start == end). *

                                                            - * + * * @param e an event object containing the following fields:
                                                              *
                                                            • [in] type - the boundary type of the substring to return. One of:
                                                                *
                                                              • {@link ACC#TEXT_BOUNDARY_CHAR}
                                                              • @@ -172,6 +181,7 @@ * when no appropriate substring is found, or if the type is invalid. *
                                                              */ + @Override public void getText(AccessibleTextEvent e) {} /** @@ -190,7 +200,7 @@ * characters in the text or the height of the preceding character, its width * being at least one pixel so that the bounding box is not degenerate. *

                                                              - * + * * @param e an event object containing the following fields:
                                                                *
                                                              • [in] start - the 0 based offset of the first character of the substring in the bounding box
                                                              • *
                                                              • [in] end - the 0 based offset after the last character of the substring in the bounding box
                                                              • @@ -202,6 +212,7 @@ * partial lines *
                                                              */ + @Override public void getTextBounds(AccessibleTextEvent e) {} /** @@ -209,7 +220,7 @@ *

                                                              * Partially visible characters are included in the returned ranges. *

                                                              - * + * * @param e an event object containing the following fields:
                                                                *
                                                              • [typical out] start - the 0 based offset of the first character of the visible substring
                                                              • *
                                                              • [typical out] end - the 0 based offset after the last character of the visible substring
                                                              • @@ -217,21 +228,23 @@ * if the visible text range is clipped *
                                                              */ + @Override public void getVisibleRanges(AccessibleTextEvent e) {} /** * Deselects a range of text. - * + * * @param e an event object containing the following fields:
                                                                *
                                                              • [in] index - the 0 based index of selection to remove
                                                              • *
                                                              • [out] result - set to {@link ACC#OK} if the range of text was deselected
                                                              • *
                                                              */ + @Override public void removeSelection(AccessibleTextEvent e) {} /** * Scrolls a specific part of a substring according to the scroll type. - * + * * @param e an event object containing the following fields:
                                                                *
                                                              • [in] start - the 0 based offset of the first character of the substring
                                                              • *
                                                              • [in] end - the 0 based offset after the last character of the substring
                                                              • @@ -251,6 +264,7 @@ *
                                                              • [out] result - set to {@link ACC#OK} if the text was scrolled
                                                              • *
                                                              */ + @Override public void scrollText(AccessibleTextEvent e) {} /** @@ -270,17 +284,18 @@ * When the new caret position differs from the old one, this is notified to the * accessibility event listeners with an EVENT_TEXT_CARET_MOVED event. *

                                                              - * + * * @param e an event object containing the following fields:
                                                                *
                                                              • [in] offset - the new offset of the caret
                                                              • *
                                                              • [out] result - set to {@link ACC#OK} if the caret position was set
                                                              • *
                                                              */ + @Override public void setCaretOffset(AccessibleTextEvent e) {} /** * Changes the bounds of an existing selection. - * + * * @param e an event object containing the following fields:
                                                                *
                                                              • [in] index - the 0 based index of the selection to change
                                                              • *
                                                              • [in] start - the new 0 based offset of the first character of the selection
                                                              • @@ -288,5 +303,6 @@ *
                                                              • [out] result - set to {@link ACC#OK} if the selection was set
                                                              • *
                                                              */ + @Override public void setSelection(AccessibleTextEvent e) {} } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleTextExtendedListener.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleTextExtendedListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleTextExtendedListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleTextExtendedListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -28,7 +28,7 @@ public interface AccessibleTextExtendedListener extends AccessibleTextListener { /** * Adds a text selection. - * + * * @param e an event object containing the following fields:
                                                                *
                                                              • [in] start - the 0 based offset of the first character of the new selection
                                                              • *
                                                              • [in] end - the 0 based offset after the last character of the new selection
                                                              • @@ -39,7 +39,7 @@ /** * Returns the total number of characters in the text. - * + * * @param e an event object containing the following fields:
                                                                  *
                                                                • [out] count - the total number of characters
                                                                • *
                                                                @@ -49,7 +49,7 @@ /** * Returns the number of links and link groups contained within this hypertext * paragraph. - * + * * @param e an event object containing the following fields:
                                                                  *
                                                                • [out] count - the number of links and link groups within this hypertext paragraph, * or 0 if there are none
                                                                • @@ -59,7 +59,7 @@ /** * Returns the specified hyperlink. - * + * * @param e an event object containing the following fields:
                                                                    *
                                                                  • [in] index - the 0 based index of the hyperlink to return
                                                                  • *
                                                                  • [out] accessible - the specified hyperlink object, or null if the index is invalid
                                                                  • @@ -82,7 +82,7 @@ /** * Returns the offset of the character under the specified point. - * + * * @param e an event object containing the following fields:
                                                                      *
                                                                    • [in] x - the X value in display coordinates for which to look up the offset of the character * that is rendered on the display at that point
                                                                    • @@ -99,7 +99,7 @@ *

                                                                      * Partially visible characters are included in the returned ranges. *

                                                                      - * + * * @param e an event object containing the following fields:
                                                                        *
                                                                      • [in] x - the X coordinate of the top left corner of the bounding box, in display relative coordinates
                                                                      • *
                                                                      • [in] y - the Y coordinate of the top left corner of the bounding box, in display relative coordinates
                                                                      • @@ -115,7 +115,7 @@ /** * Returns the character offsets of the specified text selection. - * + * * @param e an event object containing the following fields:
                                                                          *
                                                                        • [in] index - the 0 based index of the selection
                                                                        • *
                                                                        • [out] start - the 0 based offset of first selected character
                                                                        • @@ -126,7 +126,7 @@ /** * Returns the number of active non-contiguous selections. - * + * * @param e an event object containing the following fields:
                                                                            *
                                                                          • [out] count - the number of active non-contiguous selections
                                                                          • *
                                                                          @@ -153,7 +153,7 @@ * If start and end are valid, but no suitable word (or other boundary type) is found, * the returned string is null and the returned range is degenerate (start == end). *

                                                                          - * + * * @param e an event object containing the following fields:
                                                                            *
                                                                          • [in] type - the boundary type of the substring to return. One of:
                                                                              *
                                                                            • {@link ACC#TEXT_BOUNDARY_CHAR}
                                                                            • @@ -191,7 +191,7 @@ * characters in the text or the height of the preceding character, its width * being at least one pixel so that the bounding box is not degenerate. *

                                                                              - * + * * @param e an event object containing the following fields:
                                                                                *
                                                                              • [in] start - the 0 based offset of the first character of the substring in the bounding box
                                                                              • *
                                                                              • [in] end - the 0 based offset after the last character of the substring in the bounding box
                                                                              • @@ -210,7 +210,7 @@ *

                                                                                * Partially visible characters are included in the returned ranges. *

                                                                                - * + * * @param e an event object containing the following fields:
                                                                                  *
                                                                                • [typical out] start - the 0 based offset of the first character of the visible substring
                                                                                • *
                                                                                • [typical out] end - the 0 based offset after the last character of the visible substring
                                                                                • @@ -222,7 +222,7 @@ /** * Deselects a range of text. - * + * * @param e an event object containing the following fields:
                                                                                    *
                                                                                  • [in] index - the 0 based index of selection to remove
                                                                                  • *
                                                                                  • [out] result - set to {@link ACC#OK} if the range of text was deselected
                                                                                  • @@ -232,7 +232,7 @@ /** * Scrolls a specific part of a substring according to the scroll type. - * + * * @param e an event object containing the following fields:
                                                                                      *
                                                                                    • [in] start - the 0 based offset of the first character of the substring
                                                                                    • *
                                                                                    • [in] end - the 0 based offset after the last character of the substring
                                                                                    • @@ -271,7 +271,7 @@ * When the new caret position differs from the old one, this is notified to the * accessibility event listeners with an EVENT_TEXT_CARET_MOVED event. *

                                                                                      - * + * * @param e an event object containing the following fields:
                                                                                        *
                                                                                      • [in] offset - the new offset of the caret
                                                                                      • *
                                                                                      • [out] result - set to {@link ACC#OK} if the caret position was set
                                                                                      • @@ -281,7 +281,7 @@ /** * Changes the bounds of an existing selection. - * + * * @param e an event object containing the following fields:
                                                                                          *
                                                                                        • [in] index - the 0 based index of the selection to change
                                                                                        • *
                                                                                        • [in] start - the new 0 based offset of the first character of the selection
                                                                                        • diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleTextListener.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleTextListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleTextListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleTextListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -37,11 +37,11 @@ * * @see AccessibleTextAdapter * @see AccessibleTextEvent - * + * * @since 3.0 */ public interface AccessibleTextListener extends SWTEventListener { - + /** * Sent when an accessibility client requests the current character offset * of the text caret. diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleValueAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleValueAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleValueAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleValueAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 2016 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 @@ -27,45 +27,49 @@ public class AccessibleValueAdapter implements AccessibleValueListener { /** * Returns the value of this object as a number. - * + * * @param e an event object containing the following fields:
                                                                                            *
                                                                                          • [out] value - the number that is the current value of this object
                                                                                          • *
                                                                                          */ + @Override public void getCurrentValue(AccessibleValueEvent e) {} /** * Sets the value of this object to the given number. - * + * * The argument is clipped to the valid interval whose upper and lower * bounds are returned by getMaximumValue and getMinimumValue, * i.e. if it is lower than the minimum value the new value will be the minimum, * and if it is greater than the maximum then the new value will be the maximum. - * + * * @param e an event object containing the following fields:
                                                                                            *
                                                                                          • [in/out] value - on input, the number that will be the new value of this object *
                                                                                            - on output, set to null if the value cannot be set
                                                                                          • *
                                                                                          */ + @Override public void setCurrentValue(AccessibleValueEvent e) {} /** * Returns the maximum value that can be represented by this object. - * + * * @param e an event object containing the following fields:
                                                                                            *
                                                                                          • [out] value - the number that is the maximum value that this object can represent. * If this object has no upper bound then null is returned.
                                                                                          • *
                                                                                          */ + @Override public void getMaximumValue(AccessibleValueEvent e) {} /** * Returns the minimum value that can be represented by this object. - * + * * @param e an event object containing the following fields:
                                                                                            *
                                                                                          • [out] value - the number that is the minimum value that this object can represent. * If this object has no lower bound then null is returned.
                                                                                          • *
                                                                                          */ + @Override public void getMinimumValue(AccessibleValueEvent e) {} } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleValueListener.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleValueListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/AccessibleValueListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/AccessibleValueListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -30,7 +30,7 @@ public interface AccessibleValueListener extends SWTEventListener { /** * Returns the value of this object as a number. - * + * * @param e an event object containing the following fields:
                                                                                            *
                                                                                          • [out] value - the number that is the current value of this object
                                                                                          • *
                                                                                          @@ -39,12 +39,12 @@ /** * Sets the value of this object to the given number. - * + * * The argument is clipped to the valid interval whose upper and lower * bounds are returned by getMaximumValue and getMinimumValue, * i.e. if it is lower than the minimum value the new value will be the minimum, * and if it is greater than the maximum then the new value will be the maximum. - * + * * @param e an event object containing the following fields:
                                                                                            *
                                                                                          • [in/out] value - on input, the number that will be the new value of this object *
                                                                                            - on output, set to null if the value cannot be set
                                                                                          • @@ -54,7 +54,7 @@ /** * Returns the maximum value that can be represented by this object. - * + * * @param e an event object containing the following fields:
                                                                                              *
                                                                                            • [out] value - the number that is the maximum value that this object can represent. * If this object has no upper bound then null is returned.
                                                                                            • @@ -64,7 +64,7 @@ /** * Returns the minimum value that can be represented by this object. - * + * * @param e an event object containing the following fields:
                                                                                                *
                                                                                              • [out] value - the number that is the minimum value that this object can represent. * If this object has no lower bound then null is returned.
                                                                                              • diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/accessibility/ACC.java swt4-gtk-4.6.0/org/eclipse/swt/accessibility/ACC.java --- swt4-gtk-4.5.0/org/eclipse/swt/accessibility/ACC.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/accessibility/ACC.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,7 +16,7 @@ * Accessible object. * * @see Sample code and further information - * + * * @since 2.0 */ public class ACC { @@ -137,49 +137,49 @@ /** * An AT is requesting the accessible child object at the specified index. - * + * * @see AccessibleControlListener#getChild - * + * * @since 3.6 */ public static final int CHILDID_CHILD_AT_INDEX = -4; - + /** * An AT is requesting the index of this accessible in its parent. - * + * * @see AccessibleControlListener#getChild - * + * * @since 3.6 */ public static final int CHILDID_CHILD_INDEX = -5; - + /** * A detail constant indicating visible accessible objects. - * + * * @since 3.6 */ public static final int VISIBLE = 0x01; - + /** * A type constant specifying that insertion occurred. - * + * * @since 3.6 */ public static final int INSERT = 0; /** * A type constant specifying that deletion occurred. - * + * * @since 3.6 */ public static final int DELETE = 1; - + public static final int TEXT_INSERT = INSERT; public static final int TEXT_DELETE = DELETE; /** * A constant specifying that an operation succeeded. - * + * * @since 3.6 */ public static final String OK = "OK"; //$NON-NLS-1$ @@ -192,32 +192,32 @@ * caret. Note that after the caret moves, the caret offset changes by the * number of characters in the field, e.g. by 8 characters in the following * date: 03/26/07. - * + * * @since 3.6 */ public static final int TEXT_BOUNDARY_CHAR = 0; - + /** * The range provided matches the range observed when the application * processes the Ctrl + left arrow and Ctrl + right arrow key sequences. * Typically this is from the start of one word to the start of the next, * but various applications are inconsistent in the handling of the end of a * line. - * + * * @since 3.6 */ public static final int TEXT_BOUNDARY_WORD = 1; - + /** * Range is from start of one sentence to the start of another sentence. - * + * * @since 3.6 */ public static final int TEXT_BOUNDARY_SENTENCE = 2; /** * Range is from start of one paragraph to the start of another paragraph. - * + * * @since 3.6 */ public static final int TEXT_BOUNDARY_PARAGRAPH = 3; @@ -228,14 +228,14 @@ * However in the case of some applications an end-of-line character * indicates the end of a paragraph and the lines composing the paragraph, * other than the last line, do not contain an end of line character. - * + * * @since 3.6 */ public static final int TEXT_BOUNDARY_LINE = 4; /** * Using this value will cause all text to be returned. - * + * * @since 3.6 */ public static final int TEXT_BOUNDARY_ALL = 5; @@ -250,7 +250,7 @@ * edge, or midway between those two edges. In cases where there is a * hierarchy of nested scrollable controls, more than one control may have * to be scrolled. - * + * * @since 3.6 */ public static final int SCROLL_TYPE_TOP_LEFT = 0; @@ -265,7 +265,7 @@ * edge, or midway between those two edges. In cases where there is a * hierarchy of nested scrollable controls, more than one control may have * to be scrolled. - * + * * @since 3.6 */ public static final int SCROLL_TYPE_BOTTOM_RIGHT = 1; @@ -280,7 +280,7 @@ * midway between those two edges. In cases where there is a hierarchy of * nested scrollable controls, more than one control may have to be * scrolled. - * + * * @since 3.6 */ public static final int SCROLL_TYPE_TOP_EDGE = 2; @@ -295,7 +295,7 @@ * midway between those two edges. In cases where there is a hierarchy of * nested scrollable controls, more than one control may have to be * scrolled. - * + * * @since 3.6 */ public static final int SCROLL_TYPE_BOTTOM_EDGE = 3; @@ -310,7 +310,7 @@ * midway between those two edges. In cases where there is a hierarchy of * nested scrollable controls, more than one control may have to be * scrolled. - * + * * @since 3.6 */ public static final int SCROLL_TYPE_LEFT_EDGE = 4; @@ -325,7 +325,7 @@ * midway between those two edges. In cases where there is a hierarchy of * nested scrollable controls, more than one control may have to be * scrolled. - * + * * @since 3.6 */ public static final int SCROLL_TYPE_RIGHT_EDGE = 5; @@ -336,32 +336,32 @@ * object is dependent on the application. For example, the object or * substring may be scrolled to to closest edge, the furthest edge, or * midway between those two edges. - * + * * @since 3.6 */ public static final int SCROLL_TYPE_ANYWHERE = 6; /** * Scroll the top left corner of the object or substring to the specified point. - * + * * @since 3.6 */ public static final int SCROLL_TYPE_POINT = 7; /** * Send when the selection within a container has changed. - * + * * @since 3.6 */ public static final int EVENT_SELECTION_CHANGED = 0x8009; - + /** * Send when an object's text selection has changed. - * + * * @since 3.6 */ public static final int EVENT_TEXT_SELECTION_CHANGED = 0x8014; - + /** * Send when an object's state has changed, for example enabled/disabled, pressed/released, or checked/unchecked. *

                                                                                                @@ -369,35 +369,35 @@ *

                                                                                              • state - the STATE_* constant identifying the state that changed
                                                                                              • *
                                                                                              • newValue - either 1 or 0, indicating whether the state has changed to true or false
                                                                                              • *

                                                                                              - * + * * @since 3.6 */ public static final int EVENT_STATE_CHANGED = 0x800A; - + /** * Send when an object has moved. *

                                                                                              * Note: only send one notification for the topmost object that has changed. *

                                                                                              - * + * * @since 3.6 */ public static final int EVENT_LOCATION_CHANGED = 0x800B; - + /** * Send when an object's name has changed. - * + * * @since 3.6 */ public static final int EVENT_NAME_CHANGED = 0x800C; - + /** * Send when an object's description has changed. - * + * * @since 3.6 */ public static final int EVENT_DESCRIPTION_CHANGED = 0x800D; - + /** * Send when an object's value has changed. *

                                                                                              @@ -405,71 +405,71 @@ *

                                                                                            • oldValue - the object's old value
                                                                                            • *
                                                                                            • newValue - the object's new value
                                                                                            • *

                                                                                            - * + * * @since 3.6 */ public static final int EVENT_VALUE_CHANGED = 0x800E; /** * Send when the loading of a document has completed. - * + * * @since 3.6 */ public static final int EVENT_DOCUMENT_LOAD_COMPLETE = 0x105; /** * Send when the loading of a document was interrupted. - * + * * @since 3.6 */ public static final int EVENT_DOCUMENT_LOAD_STOPPED = 0x106; /** * Send when the document contents are being reloaded. - * + * * @since 3.6 */ public static final int EVENT_DOCUMENT_RELOAD = 0x107; /** * Send when a slide changed in a presentation document - * or a page boundary was crossed in a word processing document. - * + * or a page boundary was crossed in a word processing document. + * * @since 3.6 */ public static final int EVENT_PAGE_CHANGED = 0x111; /** * Send when the caret moved from one section to the next. - * + * * @since 3.6 */ public static final int EVENT_SECTION_CHANGED = 0x112; /** * Send when the count or attributes of an accessible object's actions have changed. - * + * * @since 3.6 */ public static final int EVENT_ACTION_CHANGED = 0x100; /** * Send when the starting index of this link within the containing string has changed. - * + * * @since 3.6 */ public static final int EVENT_HYPERLINK_START_INDEX_CHANGED = 0x10d; /** * Send when the ending index of this link within the containing string has changed. - * + * * @since 3.6 */ public static final int EVENT_HYPERLINK_END_INDEX_CHANGED = 0x108; /** * Send when the number of anchors associated with this hyperlink object has changed. - * + * * @since 3.6 */ public static final int EVENT_HYPERLINK_ANCHOR_COUNT_CHANGED = 0x109; @@ -477,14 +477,14 @@ /** * Send when the hyperlink selected state changed from selected to unselected * or from unselected to selected. - * + * * @since 3.6 */ public static final int EVENT_HYPERLINK_SELECTED_LINK_CHANGED = 0x10a; /** * Send when the hyperlink has been activated. - * + * * @since 3.6 */ public static final int EVENT_HYPERLINK_ACTIVATED = 0x10b; @@ -495,44 +495,44 @@ * The eventData object is an Integer that represents the index of the selected link * in the hypertext object. *

                                                                                            - * + * * @since 3.6 */ public static final int EVENT_HYPERTEXT_LINK_SELECTED = 0x10c; /** * Send when the number of hyperlinks associated with a hypertext object has changed. - * + * * @since 3.6 */ public static final int EVENT_HYPERTEXT_LINK_COUNT_CHANGED = 0x10f; /** * Send when an object's attributes have changed. - * + * * @see #EVENT_TEXT_ATTRIBUTE_CHANGED - * + * * @since 3.6 */ public static final int EVENT_ATTRIBUTE_CHANGED = 0x200; /** * Send when a table caption has changed. - * + * * @since 3.6 */ public static final int EVENT_TABLE_CAPTION_CHANGED = 0x203; /** * Send when a table's column description has changed. - * + * * @since 3.6 */ public static final int EVENT_TABLE_COLUMN_DESCRIPTION_CHANGED = 0x204; /** * Send when a table's column header has changed. - * + * * @since 3.6 */ public static final int EVENT_TABLE_COLUMN_HEADER_CHANGED = 0x205; @@ -547,51 +547,51 @@ *
                                                                                          • columnStart - the index of the first column that changed
                                                                                          • *
                                                                                          • columnCount - the number of contiguous columns that changed, or 0 if no columns changed
                                                                                          • *

                                                                                          - * + * * @since 3.6 */ public static final int EVENT_TABLE_CHANGED = 0x206; /** * Send when a table's row description has changed. - * + * * @since 3.6 */ public static final int EVENT_TABLE_ROW_DESCRIPTION_CHANGED = 0x207; /** * Send when a table's row header has changed. - * + * * @since 3.6 */ public static final int EVENT_TABLE_ROW_HEADER_CHANGED = 0x208; /** * Send when a table's summary has changed. - * + * * @since 3.6 */ public static final int EVENT_TABLE_SUMMARY_CHANGED = 0x209; /** * Send when a text object's attributes have changed. - * + * * @see #EVENT_ATTRIBUTE_CHANGED - * + * * @since 3.6 */ public static final int EVENT_TEXT_ATTRIBUTE_CHANGED = 0x20a; - + /** * Send when the caret has moved to a new position. - * + * * @since 3.6 */ public static final int EVENT_TEXT_CARET_MOVED = 0x11b; /** * Send when the caret has moved from one column to the next. - * + * * @since 3.6 */ public static final int EVENT_TEXT_COLUMN_CHANGED = 0x11d; @@ -605,42 +605,42 @@ *
                                                                                        • end - the index of the last character that changed
                                                                                        • *
                                                                                        • text - the text string that was inserted or deleted
                                                                                        • *

                                                                                        - * + * * @since 3.6 */ public static final int EVENT_TEXT_CHANGED = 0x20c; /** * Some attribute of this object is affected by a target object. - * + * * @since 3.6 */ public static final int RELATION_CONTROLLED_BY = 0; /** * This object is interactive and controls some attribute of a target object. - * + * * @since 3.6 */ public static final int RELATION_CONTROLLER_FOR = 1; /** * This object is described by the target object. - * + * * @since 3.6 */ public static final int RELATION_DESCRIBED_BY = 2; /** * This object is describes the target object. - * + * * @since 3.6 */ public static final int RELATION_DESCRIPTION_FOR = 3; /** * This object is embedded by a target object. - * + * * @since 3.6 */ public static final int RELATION_EMBEDDED_BY = 4; @@ -648,78 +648,78 @@ /** * This object embeds a target object. This relation can be used on a * control's accessible to show where the content areas are. - * + * * @since 3.6 */ public static final int RELATION_EMBEDS = 5; /** - * Content flows to this object from a target object. + * Content flows to this object from a target object. * This relation and RELATION_FLOWS_TO are useful to tie text and non-text * objects together in order to allow assistive technology to follow the * intended reading order. - * + * * @since 3.6 */ public static final int RELATION_FLOWS_FROM = 6; /** * Content flows from this object to a target object. - * + * * @since 3.6 */ public static final int RELATION_FLOWS_TO = 7; /** * This object is label for a target object. - * + * * @since 3.6 */ public static final int RELATION_LABEL_FOR = 8; /** * This object is labelled by a target object. - * + * * @since 3.6 */ public static final int RELATION_LABELLED_BY = 9; /** - * This object is a member of a group of one or more objects. When - * there is more than one object in the group each member may have one and the - * same target, e.g. a grouping object. It is also possible that each member has + * This object is a member of a group of one or more objects. When + * there is more than one object in the group each member may have one and the + * same target, e.g. a grouping object. It is also possible that each member has * multiple additional targets, e.g. one for every other member in the group. - * + * * @since 3.6 */ public static final int RELATION_MEMBER_OF = 10; /** * This object is a child of a target object. - * + * * @since 3.6 */ public static final int RELATION_NODE_CHILD_OF = 11; /** * This object is a parent window of the target object. - * + * * @since 3.6 */ public static final int RELATION_PARENT_WINDOW_OF = 12; /** - * This object is a transient component related to the target object. + * This object is a transient component related to the target object. * When this object is activated the target object doesn't lose focus. - * + * * @since 3.6 */ public static final int RELATION_POPUP_FOR = 13; /** * This object is a sub window of a target object. - * + * * @since 3.6 */ - public static final int RELATION_SUBWINDOW_OF = 14; + public static final int RELATION_SUBWINDOW_OF = 14; } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/awt/SWT_AWT.java swt4-gtk-4.6.0/org/eclipse/swt/awt/SWT_AWT.java --- swt4-gtk-4.5.0/org/eclipse/swt/awt/SWT_AWT.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/awt/SWT_AWT.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -10,34 +10,23 @@ *******************************************************************************/ package org.eclipse.swt.awt; -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; +/* AWT Imports */ +import java.awt.*; +import java.awt.Canvas; +import java.awt.event.*; +import java.lang.reflect.*; /* SWT Imports */ import org.eclipse.swt.*; +import org.eclipse.swt.graphics.*; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; -import org.eclipse.swt.graphics.Device; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.*; import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Event; -/* AWT Imports */ -import java.awt.AWTEvent; -import java.awt.Dimension; -import java.awt.EventQueue; -import java.awt.Canvas; -import java.awt.Frame; -import java.awt.Window; -import java.awt.event.AWTEventListener; -import java.awt.event.ComponentAdapter; -import java.awt.event.ComponentEvent; -import java.awt.event.ComponentListener; -import java.awt.event.WindowEvent; - /** * This class provides a bridge between SWT and AWT, so that it @@ -45,20 +34,20 @@ * * @see Swing/AWT snippets * @see Sample code and further information - * + * * @since 3.0 */ public class SWT_AWT { /** * The name of the embedded Frame class. The default class name - * for the platform will be used if null. + * for the platform will be used if null. */ public static String embeddedFrameClass; /** * Key for looking up the embedded frame for a Composite using - * getData(). + * getData(). */ static String EMBEDDED_FRAME_KEY = "org.eclipse.swt.awt.SWT_AWT.embeddedFrame"; @@ -97,25 +86,23 @@ OS.gdk_error_trap_push(); try { /* Initialize the default focus traversal policy */ - Class[] emptyClass = new Class[0]; - Object[] emptyObject = new Object[0]; Class clazz = Class.forName("javax.swing.UIManager"); - Method method = clazz.getMethod("getDefaults", emptyClass); - if (method != null) method.invoke(clazz, emptyObject); + Method method = clazz.getMethod("getDefaults"); + if (method != null) method.invoke(clazz); } catch (Throwable e) {} } /** * Returns a java.awt.Frame which is the embedded frame * associated with the specified composite. - * + * * @param parent the parent Composite of the java.awt.Frame * @return a java.awt.Frame the embedded frame or null. - * + * * @exception IllegalArgumentException
                                                                                          *
                                                                                        • ERROR_NULL_ARGUMENT - if the parent is null
                                                                                        • *
                                                                                        - * + * * @since 3.2 */ public static Frame getFrame (Composite parent) { @@ -136,15 +123,15 @@ * strongly recommended that a heavyweight component such as java.awt.Panel * be added to the frame as the root of all components. *

                                                                                        - * + * * @param parent the parent Composite of the new java.awt.Frame * @return a java.awt.Frame to be the parent of the embedded AWT components - * + * * @exception IllegalArgumentException
                                                                                          *
                                                                                        • ERROR_NULL_ARGUMENT - if the parent is null
                                                                                        • - *
                                                                                        • ERROR_INVALID_ARGUMENT - if the parent Composite does not have the SWT.EMBEDDED style
                                                                                        • + *
                                                                                        • ERROR_INVALID_ARGUMENT - if the parent Composite does not have the SWT.EMBEDDED style
                                                                                        • *
                                                                                        - * + * * @since 3.0 */ public static Frame new_Frame (final Composite parent) { @@ -163,18 +150,18 @@ String className = embeddedFrameClass != null ? embeddedFrameClass : "sun.awt.X11.XEmbeddedFrame"; clazz = Class.forName(className); } catch (Throwable e) { - SWT.error (SWT.ERROR_NOT_IMPLEMENTED, e, " [need JDK 1.5 or greater]"); + SWT.error (SWT.ERROR_NOT_IMPLEMENTED, e, " [need JDK 1.5 or greater]"); } initializeSwing (); Object value = null; Constructor constructor = null; try { - constructor = clazz.getConstructor (new Class [] {int.class, boolean.class}); - value = constructor.newInstance (new Object [] {new Integer ((int)/*64*/handle), Boolean.TRUE}); + constructor = clazz.getConstructor (int.class, boolean.class); + value = constructor.newInstance (new Integer ((int)/*64*/handle), Boolean.TRUE); } catch (Throwable e1) { try { - constructor = clazz.getConstructor (new Class [] {long.class, boolean.class}); - value = constructor.newInstance (new Object [] {new Long (handle), Boolean.TRUE}); + constructor = clazz.getConstructor (long.class, boolean.class); + value = constructor.newInstance (new Long (handle), Boolean.TRUE); } catch (Throwable e2) { SWT.error (SWT.ERROR_NOT_IMPLEMENTED, e2); } @@ -187,15 +174,17 @@ } try { /* Call registerListeners() to make XEmbed focus traversal work */ - Method method = clazz.getMethod("registerListeners", (Class[])null); - if (method != null) method.invoke(value, (Object[])null); + Method method = clazz.getMethod("registerListeners"); + if (method != null) method.invoke(value); } catch (Throwable e) {} final AWTEventListener awtListener = new AWTEventListener() { + @Override public void eventDispatched(AWTEvent event) { if (event.getID() == WindowEvent.WINDOW_OPENED) { final Window window = (Window) event.getSource(); if (window.getParent() == frame) { parent.getDisplay().asyncExec(new Runnable() { + @Override public void run() { if (parent.isDisposed()) return; Shell shell = parent.getShell(); @@ -217,10 +206,12 @@ }; frame.getToolkit().addAWTEventListener(awtListener, AWTEvent.WINDOW_EVENT_MASK); final Listener shellListener = new Listener () { + @Override public void handleEvent (Event e) { switch (e.type) { case SWT.Deiconify: EventQueue.invokeLater(new Runnable () { + @Override public void run () { frame.dispatchEvent (new WindowEvent (frame, WindowEvent.WINDOW_DEICONIFIED)); } @@ -228,6 +219,7 @@ break; case SWT.Iconify: EventQueue.invokeLater(new Runnable () { + @Override public void run () { frame.dispatchEvent (new WindowEvent (frame, WindowEvent.WINDOW_ICONIFIED)); } @@ -239,8 +231,9 @@ Shell shell = parent.getShell (); shell.addListener (SWT.Deiconify, shellListener); shell.addListener (SWT.Iconify, shellListener); - + Listener listener = new Listener () { + @Override public void handleEvent (Event e) { switch (e.type) { case SWT.Dispose: @@ -249,6 +242,7 @@ shell.removeListener (SWT.Iconify, shellListener); parent.setVisible(false); EventQueue.invokeLater(new Runnable () { + @Override public void run () { frame.getToolkit().removeAWTEventListener(awtListener); frame.dispose (); @@ -256,26 +250,27 @@ }); break; case SWT.Resize: - if (Library.JAVA_VERSION >= Library.JAVA_VERSION(1, 6, 0)) { - final Rectangle clientArea = parent.getClientArea(); - EventQueue.invokeLater(new Runnable () { - public void run () { - frame.setSize (clientArea.width, clientArea.height); - } - }); - } + final Rectangle clientArea = DPIUtil.autoScaleUp(parent.getClientArea()); + EventQueue.invokeLater(new Runnable () { + @Override + public void run () { + frame.setSize (clientArea.width, clientArea.height); + } + }); break; } } }; parent.addListener (SWT.Dispose, listener); parent.addListener (SWT.Resize, listener); - + parent.getDisplay().asyncExec(new Runnable() { + @Override public void run () { if (parent.isDisposed()) return; - final Rectangle clientArea = parent.getClientArea(); + final Rectangle clientArea = DPIUtil.autoScaleUp(parent.getClientArea()); EventQueue.invokeLater(new Runnable () { + @Override public void run () { frame.setSize (clientArea.width, clientArea.height); frame.validate (); @@ -288,18 +283,18 @@ /** * Creates a new Shell. This Shell is the root for - * the SWT widgets that will be embedded within the AWT canvas. - * + * the SWT widgets that will be embedded within the AWT canvas. + * * @param display the display for the new Shell * @param parent the parent java.awt.Canvas of the new Shell * @return a Shell to be the parent of the embedded SWT widgets - * + * * @exception IllegalArgumentException
                                                                                          *
                                                                                        • ERROR_NULL_ARGUMENT - if the display is null
                                                                                        • *
                                                                                        • ERROR_NULL_ARGUMENT - if the parent is null
                                                                                        • *
                                                                                        • ERROR_INVALID_ARGUMENT - if the parent's peer is not created
                                                                                        • *
                                                                                        - * + * * @since 3.0 */ public static Shell new_Shell (final Display display, final Canvas parent) { @@ -319,16 +314,18 @@ @Override public void componentResized (ComponentEvent e) { display.syncExec (new Runnable () { + @Override public void run () { if (shell.isDisposed()) return; Dimension dim = parent.getSize (); - shell.setSize (dim.width, dim.height); + shell.setSize (DPIUtil.autoScaleDown(new Point(dim.width, dim.height))); } }); } }; parent.addComponentListener(listener); shell.addListener(SWT.Dispose, new Listener() { + @Override public void handleEvent(Event event) { parent.removeComponentListener(listener); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/AppFileLocProvider.java swt4-gtk-4.6.0/org/eclipse/swt/browser/AppFileLocProvider.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/AppFileLocProvider.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/AppFileLocProvider.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2015 IBM Corporation and others. + * Copyright (c) 2003, 2016 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 @@ -19,7 +19,7 @@ class AppFileLocProvider { XPCOMObject supports; XPCOMObject directoryServiceProvider; - XPCOMObject directoryServiceProvider2; + XPCOMObject directoryServiceProvider2; int refCount = 0; String mozillaPath, profilePath, cacheParentPath; String[] pluginDirs; @@ -42,7 +42,7 @@ String osArch = System.getProperty ("os.arch").toLowerCase (); //$NON-NLS-1$ IsSparc = (osName.startsWith ("sunos") || osName.startsWith ("solaris")) && osArch.startsWith("sparc"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } - + AppFileLocProvider (String mozillaPath, String profilePath, String cacheParentPath, boolean isXULRunner) { this.mozillaPath = mozillaPath + SEPARATOR_OS; this.profilePath = profilePath + SEPARATOR_OS; @@ -79,7 +79,7 @@ @Override public int /*long*/ method2 (int /*long*/[] args) {return Release ();} }; - + directoryServiceProvider = new XPCOMObject (new int[] {2, 0, 0, 3}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -90,7 +90,7 @@ @Override public int /*long*/ method3 (int /*long*/[] args) {return getFile (args[0], args[1], args[2]);} }; - + directoryServiceProvider2 = new XPCOMObject (new int[] {2, 0, 0, 3, 2}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -109,15 +109,15 @@ if (supports != null) { supports.dispose (); supports = null; - } + } if (directoryServiceProvider != null) { directoryServiceProvider.dispose (); - directoryServiceProvider = null; + directoryServiceProvider = null; } if (directoryServiceProvider2 != null) { directoryServiceProvider2.dispose (); - directoryServiceProvider2 = null; - } + directoryServiceProvider2 = null; + } } int /*long*/ getAddress () { @@ -128,7 +128,7 @@ if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE; nsID guid = new nsID (); XPCOM.memmove (guid, riid, nsID.sizeof); - + if (guid.Equals (XPCOM.NS_ISUPPORTS_IID)) { XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF); AddRef (); @@ -144,7 +144,7 @@ AddRef (); return XPCOM.NS_OK; } - + XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); return XPCOM.NS_ERROR_NO_INTERFACE; } @@ -176,7 +176,7 @@ String value = new String (MozillaDelegate.mbcsToWcs (null, buffer)); if (value.length () > 0) { String separator = System.getProperty ("path.separator"); // $NON-NLS-1$ - List segments = new ArrayList (); + List segments = new ArrayList<> (); int start, end = -1; do { start = end + 1; @@ -207,7 +207,7 @@ * error indicating that PR_NewMonitor could not be found. This is a well- * known problem that many other apps have also encountered, with no * resolution other than to remove this plug-in. The Browser workaround is - * to not add the directory containing this plug-in to the plug-in search path. + * to not add the directory containing this plug-in to the plug-in search path. */ if (!IsSparc) { pluginDirs[index++] = mozillaPath + PLUGINS_DIR; @@ -260,8 +260,8 @@ } return XPCOM.NS_ERROR_FAILURE; -} - +} + /* nsIDirectoryServiceProvider implementation */ int getFile(int /*long*/ prop, int /*long*/ persistent, int /*long*/ _retval) { @@ -321,10 +321,10 @@ * < 1.7. Unfortunately this property is queried early enough in the * Browser creation process that the Mozilla version being used is not * yet determined. However it is known if XULRunner is being used or not. - * + * * For now answer a value for this property iff XULRunner is the GRE. * If the range of Mozilla versions supported by the Browser is changed - * in the future to be >= 1.7 then this value can always be answered. + * in the future to be >= 1.7 then this value can always be answered. */ if (isXULRunner) propertyValue = profilePath; } @@ -338,10 +338,10 @@ if (rc != XPCOM.NS_OK) Mozilla.error (rc); if (result[0] == 0) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); pathString.dispose (); - + nsILocalFile localFile = new nsILocalFile (result [0]); result[0] = 0; - rc = localFile.QueryInterface (IIDStore.GetIID (nsIFile.class), result); + rc = localFile.QueryInterface (IIDStore.GetIID (nsIFile.class), result); if (rc != XPCOM.NS_OK) Mozilla.error (rc); if (result[0] == 0) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE); @@ -351,5 +351,5 @@ } return XPCOM.NS_ERROR_FAILURE; -} +} } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/AuthenticationEvent.java swt4-gtk-4.6.0/org/eclipse/swt/browser/AuthenticationEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/AuthenticationEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/AuthenticationEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -33,7 +33,7 @@ /** The password to authenticate with */ public String password; - /** + /** * A flag indicating whether the authentication should proceed. * Setting this field to false will cancel the operation. */ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/AuthenticationListener.java swt4-gtk-4.6.0/org/eclipse/swt/browser/AuthenticationListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/AuthenticationListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/AuthenticationListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,10 +16,10 @@ * This listener interface may be implemented in order to receive * an {@link AuthenticationEvent} notification when the {@link Browser} * encounters a page that requires authentication. - * + * * @see Browser#addAuthenticationListener(AuthenticationListener) * @see Browser#removeAuthenticationListener(AuthenticationListener) - * + * * @since 3.5 */ public interface AuthenticationListener extends SWTEventListener { @@ -47,7 +47,7 @@ *
                                                                                      • (out) user the user name to authenticate with *
                                                                                      • (out) password the password to authenticate with *
                                                                                      - * + * * @param event the AuthenticationEvent that can be used to * either supply authentication credentials, defer credential input to * an authentication prompter, or cancel an authentication challenge. diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/BrowserFunction.java swt4-gtk-4.6.0/org/eclipse/swt/browser/BrowserFunction.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/BrowserFunction.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/BrowserFunction.java 2016-07-06 19:11:33.000000000 +0000 @@ -21,7 +21,7 @@ * overriding its function(Object[]) method. This * method will be invoked whenever javascript running in the * Browser makes a call with the function's name. - * + * *

                                                                                      * Application code must explicitly invoke the * BrowserFunction.dispose() method to release the @@ -35,11 +35,11 @@ * Note that disposing a Browser automatically disposes all * BrowserFunctions associated with it. *

                                                                                      - * + * * @see #dispose() * @see #function(Object[]) * @see org.eclipse.swt.browser.LocationListener#changed(LocationEvent) - * + * * @since 3.5 */ public class BrowserFunction { @@ -65,17 +65,17 @@ *

                                                                                      * @param browser the browser whose javascript can invoke this function * @param name the name that javascript will use to invoke this function - * + * * @exception IllegalArgumentException
                                                                                        *
                                                                                      • ERROR_NULL_ARGUMENT - if the browser is null
                                                                                      • *
                                                                                      • ERROR_NULL_ARGUMENT - if the name is null
                                                                                      • *
                                                                                      - * + * * @exception SWTException
                                                                                        *
                                                                                      • ERROR_WIDGET_DISPOSED - if the browser has been disposed
                                                                                      • *
                                                                                      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
                                                                                      • *
                                                                                      - * + * * @see #dispose() * @see #BrowserFunction(Browser, String, boolean, String[]) * @see org.eclipse.swt.browser.LocationListener#changed(LocationEvent) @@ -104,21 +104,21 @@ * top-level window and false otherwise * @param frameNames the names of the child frames that the function should * be accessible in - * + * * @exception IllegalArgumentException
                                                                                        *
                                                                                      • ERROR_NULL_ARGUMENT - if the browser is null
                                                                                      • *
                                                                                      • ERROR_NULL_ARGUMENT - if the name is null
                                                                                      • *
                                                                                      - * + * * @exception SWTException
                                                                                        *
                                                                                      • ERROR_WIDGET_DISPOSED - if the browser has been disposed
                                                                                      • *
                                                                                      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
                                                                                      • *
                                                                                      - * + * * @see #dispose() * @see #BrowserFunction(Browser, String) * @see org.eclipse.swt.browser.LocationListener#changed(LocationEvent) - * + * * @since 3.8 */ public BrowserFunction (Browser browser, String name, boolean top, String[] frameNames) { @@ -173,7 +173,7 @@ * arguments that are passed to the javascript function call are of * supported types then this method is invoked with the argument values * converted as follows: - * + * * javascript null or undefined -> null * javascript number -> java.lang.Double * javascript string -> java.lang.String @@ -182,16 +182,16 @@ * * If any of the javascript arguments are of unsupported types then the * function invocation will fail and this method will not be called. - * + * * This method must return a value with one of these supported java types to * the javascript caller. Note that null values are converted * to javascript's null value (not undefined), and * instances of any java.lang.Number subclass will be converted * to a javascript number. - * - * @param arguments the javascript arguments converted to java equivalents + * + * @param arguments the javascript arguments converted to java equivalents * @return the value to return to the javascript caller - * + * * @exception SWTException
                                                                                        *
                                                                                      • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                      • *
                                                                                      • ERROR_FUNCTION_DISPOSED when the BrowserFunction has been disposed
                                                                                      • @@ -207,7 +207,7 @@ * Returns the Browser whose pages can invoke this BrowserFunction. * * @return the Browser associated with this BrowserFunction - * + * * @exception SWTException
                                                                                          *
                                                                                        • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                        • *
                                                                                        • ERROR_FUNCTION_DISPOSED when the BrowserFunction has been disposed
                                                                                        • @@ -221,9 +221,9 @@ /** * Returns the name that javascript can use to invoke this BrowserFunction. - * + * * @return the BrowserFunction's name - * + * * @exception SWTException
                                                                                            *
                                                                                          • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                          • *
                                                                                          • ERROR_FUNCTION_DISPOSED when the BrowserFunction has been disposed
                                                                                          • diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/Browser.java swt4-gtk-4.6.0/org/eclipse/swt/browser/Browser.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/Browser.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/Browser.java 2016-07-06 19:11:33.000000000 +0000 @@ -33,7 +33,7 @@ *

                                                                                            * IMPORTANT: This class is not intended to be subclassed. *

                                                                                            - * + * * @see Browser snippets * @see SWT Examples: ControlExample, BrowserExample * @see Sample code and further information @@ -59,7 +59,7 @@ *

                                                                                            * The style value is either one of the style constants defined in * class SWT which is applicable to instances of this - * class, or must be built by bitwise OR'ing together + * class, or must be built by bitwise OR'ing together * (that is, using the int "|" operator) two or more * of those SWT style constants. The class description * lists the style constants that are applicable to the class. @@ -78,9 +78,9 @@ * @exception SWTError

                                                                                              *
                                                                                            • ERROR_NO_HANDLES if a handle could not be obtained for browser creation
                                                                                            • *
                                                                                            - * + * * @see Widget#getStyle - * + * * @since 3.0 */ public Browser (Composite parent, int style) { @@ -110,7 +110,7 @@ /* * Note. Mozilla provides all IM support needed for text input in web pages. * If SWT creates another input method context for the widget it will cause - * indeterminate results to happen (hangs and crashes). The fix is to prevent + * indeterminate results to happen (hangs and crashes). The fix is to prevent * SWT from creating an input method context for the Browser widget. */ if (parent != null && !parent.isDisposed ()) { @@ -135,7 +135,7 @@ * order to avoid incompatibilities that can arise from having multiple * native renderers loaded within the same process. A client can do this by * setting the "org.eclipse.swt.browser.DefaultType" java system property to - * a value like "mozilla" or "webkit". + * a value like "mozilla" or "webkit". */ /* @@ -198,7 +198,7 @@ * the style so that the parent Composite will not draw a second border. */ return style & ~SWT.BORDER; - } + } return style; } @@ -209,7 +209,7 @@ /** * Clears all session cookies from all current Browser instances. - * + * * @since 3.2 */ public static void clearSessions () { @@ -219,16 +219,16 @@ /** * Returns the value of a cookie that is associated with a URL. * Note that cookies are shared amongst all Browser instances. - * + * * @param name the cookie name * @param url the URL that the cookie is associated with * @return the cookie value, or null if no such cookie exists - * + * * @exception IllegalArgumentException
                                                                                              *
                                                                                            • ERROR_NULL_ARGUMENT - if the name is null
                                                                                            • *
                                                                                            • ERROR_NULL_ARGUMENT - if the url is null
                                                                                            • *
                                                                                            - * + * * @since 3.5 */ public static String getCookie (String name, String url) { @@ -239,7 +239,7 @@ /** * Sets a cookie on a URL. Note that cookies are shared amongst all Browser instances. - * + * * The value parameter must be a cookie header string that * complies with RFC 2109. * The value is passed through to the native browser unchanged. @@ -249,16 +249,16 @@ * foo=bar; path=/; domain=.eclipse.org (session cookie) * foo=bar; expires=Thu, 01-Jan-2030 00:00:01 GMT (persistent cookie) * foo=; expires=Thu, 01-Jan-1970 00:00:01 GMT (deletes cookie foo) - * + * * @param value the cookie value * @param url the URL to associate the cookie with * @return true if the cookie was successfully set and false otherwise - * + * * @exception IllegalArgumentException
                                                                                              *
                                                                                            • ERROR_NULL_ARGUMENT - if the value is null
                                                                                            • *
                                                                                            • ERROR_NULL_ARGUMENT - if the url is null
                                                                                            • *
                                                                                            - * + * * @since 3.5 */ public static boolean setCookie (String value, String url) { @@ -267,7 +267,7 @@ return WebBrowser.SetCookie (value, url, true); } -/** +/** * Adds the listener to the collection of listeners who will be * notified when authentication is required. *

                                                                                            @@ -280,7 +280,7 @@ * @exception IllegalArgumentException

                                                                                              *
                                                                                            • ERROR_NULL_ARGUMENT - if the listener is null
                                                                                            • *
                                                                                            - * + * * @exception SWTException
                                                                                              *
                                                                                            • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                            • *
                                                                                            • ERROR_WIDGET_DISPOSED when the widget has been disposed
                                                                                            • @@ -294,7 +294,7 @@ webBrowser.addAuthenticationListener (listener); } -/** +/** * Adds the listener to the collection of listeners who will be * notified when the window hosting the receiver should be closed. *

                                                                                              @@ -307,7 +307,7 @@ * @exception IllegalArgumentException

                                                                                                *
                                                                                              • ERROR_NULL_ARGUMENT - if the listener is null
                                                                                              • *
                                                                                              - * + * * @exception SWTException
                                                                                                *
                                                                                              • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                              • *
                                                                                              • ERROR_WIDGET_DISPOSED when the widget has been disposed
                                                                                              • @@ -321,7 +321,7 @@ webBrowser.addCloseWindowListener (listener); } -/** +/** * Adds the listener to the collection of listeners who will be * notified when the current location has changed or is about to change. *

                                                                                                @@ -335,7 +335,7 @@ * @exception IllegalArgumentException

                                                                                                  *
                                                                                                • ERROR_NULL_ARGUMENT - if the listener is null
                                                                                                • *
                                                                                                - * + * * @exception SWTException
                                                                                                  *
                                                                                                • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                                • *
                                                                                                • ERROR_WIDGET_DISPOSED when the widget has been disposed
                                                                                                • @@ -349,7 +349,7 @@ webBrowser.addLocationListener (listener); } -/** +/** * Adds the listener to the collection of listeners who will be * notified when a new window needs to be created. *

                                                                                                  @@ -362,7 +362,7 @@ * @exception IllegalArgumentException

                                                                                                    *
                                                                                                  • ERROR_NULL_ARGUMENT - if the listener is null
                                                                                                  • *
                                                                                                  - * + * * @exception SWTException
                                                                                                    *
                                                                                                  • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                                  • *
                                                                                                  • ERROR_WIDGET_DISPOSED when the widget has been disposed
                                                                                                  • @@ -376,9 +376,9 @@ webBrowser.addOpenWindowListener (listener); } -/** +/** * Adds the listener to the collection of listeners who will be - * notified when a progress is made during the loading of the current + * notified when a progress is made during the loading of the current * URL or when the loading of the current URL has been completed. * * @param listener the listener which should be notified @@ -386,7 +386,7 @@ * @exception IllegalArgumentException
                                                                                                      *
                                                                                                    • ERROR_NULL_ARGUMENT - if the listener is null
                                                                                                    • *
                                                                                                    - * + * * @exception SWTException
                                                                                                      *
                                                                                                    • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                                    • *
                                                                                                    • ERROR_WIDGET_DISPOSED when the widget has been disposed
                                                                                                    • @@ -400,7 +400,7 @@ webBrowser.addProgressListener (listener); } -/** +/** * Adds the listener to the collection of listeners who will be * notified when the status text is changed. *

                                                                                                      @@ -413,7 +413,7 @@ * @exception IllegalArgumentException

                                                                                                        *
                                                                                                      • ERROR_NULL_ARGUMENT - if the listener is null
                                                                                                      • *
                                                                                                      - * + * * @exception SWTException
                                                                                                        *
                                                                                                      • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                                      • *
                                                                                                      • ERROR_WIDGET_DISPOSED when the widget has been disposed
                                                                                                      • @@ -427,7 +427,7 @@ webBrowser.addStatusTextListener (listener); } -/** +/** * Adds the listener to the collection of listeners who will be * notified when the title of the current document is available * or has changed. @@ -437,7 +437,7 @@ * @exception IllegalArgumentException
                                                                                                          *
                                                                                                        • ERROR_NULL_ARGUMENT - if the listener is null
                                                                                                        • *
                                                                                                        - * + * * @exception SWTException
                                                                                                          *
                                                                                                        • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                                        • *
                                                                                                        • ERROR_WIDGET_DISPOSED when the widget has been disposed
                                                                                                        • @@ -451,7 +451,7 @@ webBrowser.addTitleListener (listener); } -/** +/** * Adds the listener to the collection of listeners who will be * notified when a window hosting the receiver needs to be displayed * or hidden. @@ -461,7 +461,7 @@ * @exception IllegalArgumentException
                                                                                                            *
                                                                                                          • ERROR_NULL_ARGUMENT - if the listener is null
                                                                                                          • *
                                                                                                          - * + * * @exception SWTException
                                                                                                            *
                                                                                                          • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                                          • *
                                                                                                          • ERROR_WIDGET_DISPOSED when the widget has been disposed
                                                                                                          • @@ -486,7 +486,7 @@ *
                                                                                                          * * @see #forward - * + * * @since 3.0 */ public boolean back () { @@ -510,22 +510,22 @@ * If document-defined functions or properties are accessed by the script then this method * should not be invoked until the document has finished loading (ProgressListener.completed() * gives notification of this). - * + * * @param script the script with javascript commands - * + * * @return true if the operation was successful and false otherwise * * @exception IllegalArgumentException
                                                                                                            *
                                                                                                          • ERROR_NULL_ARGUMENT - if the script is null
                                                                                                          • *
                                                                                                          - * + * * @exception SWTException
                                                                                                            *
                                                                                                          • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                                          • *
                                                                                                          • ERROR_WIDGET_DISPOSED when the widget has been disposed
                                                                                                          • *
                                                                                                          * * @see ProgressListener#completed(ProgressEvent) - * + * * @since 3.1 */ public boolean execute (String script) { @@ -540,14 +540,14 @@ * in the Browser's current page. * * @return true if the receiver was disposed, and false otherwise - * + * * @exception SWTException
                                                                                                            *
                                                                                                          • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
                                                                                                          • *
                                                                                                          • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
                                                                                                          • *
                                                                                                          * * @see #dispose() - * + * * @since 3.6 */ public boolean close () { @@ -586,23 +586,23 @@ * error to be thrown. * * @param script the script with javascript commands - * + * * @return the return value, if any, of executing the script * * @exception IllegalArgumentException
                                                                                                            *
                                                                                                          • ERROR_NULL_ARGUMENT - if the script is null
                                                                                                          • *
                                                                                                          - * + * * @exception SWTException
                                                                                                            *
                                                                                                          • ERROR_FAILED_EVALUATE when the script evaluation causes a javascript error to be thrown
                                                                                                          • *
                                                                                                          • ERROR_INVALID_RETURN_VALUE when the script returns a value of unsupported type
                                                                                                          • *
                                                                                                          • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                                          • *
                                                                                                          • ERROR_WIDGET_DISPOSED when the widget has been disposed
                                                                                                          • *
                                                                                                          - * + * * @see Browser#evaluate(String,boolean) * @see ProgressListener#completed(ProgressEvent) - * + * * @since 3.5 */ public Object evaluate (String script) throws SWTException { @@ -614,13 +614,13 @@ * Returns the result, if any, of executing the specified script. *

                                                                                                          * Evaluates a script containing javascript commands. - * When trusted is true script is executed in the context of Chrome + * When trusted is true script is executed in the context of Chrome * with Chrome security privileges. - * When trusted is false script is executed in the context of the + * When trusted is false script is executed in the context of the * current document with normal privileges. *

                                                                                                          * If document-defined functions or properties are accessed by the script then - * this method should not be invoked until the document has finished loading + * this method should not be invoked until the document has finished loading * (ProgressListener.completed() gives notification of this). *

                                                                                                          * If the script returns a value with a supported type then a java @@ -641,20 +641,20 @@ *

                                                                                                          * @param script the script with javascript commands * @param trusted true> or false depending on the security context to be used - * + * * @return the return value, if any, of executing the script * * @exception IllegalArgumentException
                                                                                                            *
                                                                                                          • ERROR_NULL_ARGUMENT - if the script is null
                                                                                                          • *
                                                                                                          - * + * * @exception SWTException
                                                                                                            *
                                                                                                          • ERROR_FAILED_EVALUATE when the script evaluation causes a javascript error to be thrown
                                                                                                          • *
                                                                                                          • ERROR_INVALID_RETURN_VALUE when the script returns a value of unsupported type
                                                                                                          • *
                                                                                                          • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                                          • *
                                                                                                          • ERROR_WIDGET_DISPOSED when the widget has been disposed
                                                                                                          • *
                                                                                                          - * + * * @see ProgressListener#completed(ProgressEvent) */ public Object evaluate (String script, boolean trusted) throws SWTException { @@ -672,9 +672,9 @@ *
                                                                                                        • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                                        • *
                                                                                                        • ERROR_WIDGET_DISPOSED when the widget has been disposed
                                                                                                        • *
                                                                                                        - * + * * @see #back - * + * * @since 3.0 */ public boolean forward () { @@ -687,7 +687,7 @@ * Examples: "ie", "mozilla", "voyager", "webkit" * * @return the type of the native browser - * + * * @since 3.5 */ public String getBrowserType () { @@ -708,9 +708,9 @@ *
                                                                                                      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
                                                                                                      • *
                                                                                                      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
                                                                                                      • *
                                                                                                      - * + * * @see #setJavascriptEnabled - * + * * @since 3.5 */ public boolean getJavascriptEnabled () { @@ -756,7 +756,7 @@ *
                                                                                                    * * @see #setUrl - * + * * @since 3.0 */ public String getUrl () { @@ -771,10 +771,10 @@ *
                                                                                                  • the receiver's style must be SWT.MOZILLA
                                                                                                  • *
                                                                                                  • the classes from JavaXPCOM >= 1.8.1.2 must be resolvable at runtime
                                                                                                  • *
                                                                                                  • the version of the underlying XULRunner must be >= 1.8.1.2
                                                                                                  • - *
                                                                                                  + *
                                                                                                * * @return the receiver's JavaXPCOM nsIWebBrowser or null - * + * * @since 3.3 */ public Object getWebBrowser () { @@ -783,7 +783,7 @@ } /** - * Returns true if the receiver can navigate to the + * Returns true if the receiver can navigate to the * previous session history item, and false otherwise. * * @return the receiver's back command enabled state @@ -792,7 +792,7 @@ *
                                                                                              • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
                                                                                              • *
                                                                                              • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
                                                                                              • *
                                                                                              - * + * * @see #back */ public boolean isBackEnabled () { @@ -808,7 +808,7 @@ } /** - * Returns true if the receiver can navigate to the + * Returns true if the receiver can navigate to the * next session history item, and false otherwise. * * @return the receiver's forward command enabled state @@ -817,7 +817,7 @@ *
                                                                                            • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
                                                                                            • *
                                                                                            • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
                                                                                            • *
                                                                                            - * + * * @see #forward */ public boolean isForwardEnabled () { @@ -840,7 +840,7 @@ webBrowser.refresh (); } -/** +/** * Removes the listener from the collection of listeners who will * be notified when authentication is required. * @@ -849,12 +849,12 @@ * @exception IllegalArgumentException
                                                                                              *
                                                                                            • ERROR_NULL_ARGUMENT - if the listener is null
                                                                                            • *
                                                                                            - * + * * @exception SWTException
                                                                                              *
                                                                                            • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                            • *
                                                                                            • ERROR_WIDGET_DISPOSED when the widget has been disposed
                                                                                            • *
                                                                                            - * + * * @since 3.5 */ public void removeAuthenticationListener (AuthenticationListener listener) { @@ -863,7 +863,7 @@ webBrowser.removeAuthenticationListener (listener); } -/** +/** * Removes the listener from the collection of listeners who will * be notified when the window hosting the receiver should be closed. * @@ -872,12 +872,12 @@ * @exception IllegalArgumentException
                                                                                              *
                                                                                            • ERROR_NULL_ARGUMENT - if the listener is null
                                                                                            • *
                                                                                            - * + * * @exception SWTException
                                                                                              *
                                                                                            • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                            • *
                                                                                            • ERROR_WIDGET_DISPOSED when the widget has been disposed
                                                                                            • *
                                                                                            - * + * * @since 3.0 */ public void removeCloseWindowListener (CloseWindowListener listener) { @@ -886,7 +886,7 @@ webBrowser.removeCloseWindowListener (listener); } -/** +/** * Removes the listener from the collection of listeners who will * be notified when the current location is changed or about to be changed. * @@ -895,12 +895,12 @@ * @exception IllegalArgumentException
                                                                                              *
                                                                                            • ERROR_NULL_ARGUMENT - if the listener is null
                                                                                            • *
                                                                                            - * + * * @exception SWTException
                                                                                              *
                                                                                            • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                            • *
                                                                                            • ERROR_WIDGET_DISPOSED when the widget has been disposed
                                                                                            • *
                                                                                            - * + * * @since 3.0 */ public void removeLocationListener (LocationListener listener) { @@ -909,7 +909,7 @@ webBrowser.removeLocationListener (listener); } -/** +/** * Removes the listener from the collection of listeners who will * be notified when a new window needs to be created. * @@ -918,12 +918,12 @@ * @exception IllegalArgumentException
                                                                                              *
                                                                                            • ERROR_NULL_ARGUMENT - if the listener is null
                                                                                            • *
                                                                                            - * + * * @exception SWTException
                                                                                              *
                                                                                            • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                            • *
                                                                                            • ERROR_WIDGET_DISPOSED when the widget has been disposed
                                                                                            • *
                                                                                            - * + * * @since 3.0 */ public void removeOpenWindowListener (OpenWindowListener listener) { @@ -932,9 +932,9 @@ webBrowser.removeOpenWindowListener (listener); } -/** +/** * Removes the listener from the collection of listeners who will - * be notified when a progress is made during the loading of the current + * be notified when a progress is made during the loading of the current * URL or when the loading of the current URL has been completed. * * @param listener the listener which should no longer be notified @@ -942,12 +942,12 @@ * @exception IllegalArgumentException
                                                                                              *
                                                                                            • ERROR_NULL_ARGUMENT - if the listener is null
                                                                                            • *
                                                                                            - * + * * @exception SWTException
                                                                                              *
                                                                                            • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                            • *
                                                                                            • ERROR_WIDGET_DISPOSED when the widget has been disposed
                                                                                            • *
                                                                                            - * + * * @since 3.0 */ public void removeProgressListener (ProgressListener listener) { @@ -956,7 +956,7 @@ webBrowser.removeProgressListener (listener); } -/** +/** * Removes the listener from the collection of listeners who will * be notified when the status text is changed. * @@ -965,12 +965,12 @@ * @exception IllegalArgumentException
                                                                                              *
                                                                                            • ERROR_NULL_ARGUMENT - if the listener is null
                                                                                            • *
                                                                                            - * + * * @exception SWTException
                                                                                              *
                                                                                            • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                            • *
                                                                                            • ERROR_WIDGET_DISPOSED when the widget has been disposed
                                                                                            • *
                                                                                            - * + * * @since 3.0 */ public void removeStatusTextListener (StatusTextListener listener) { @@ -979,7 +979,7 @@ webBrowser.removeStatusTextListener (listener); } -/** +/** * Removes the listener from the collection of listeners who will * be notified when the title of the current document is available * or has changed. @@ -989,12 +989,12 @@ * @exception IllegalArgumentException
                                                                                              *
                                                                                            • ERROR_NULL_ARGUMENT - if the listener is null
                                                                                            • *
                                                                                            - * + * * @exception SWTException
                                                                                              *
                                                                                            • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                            • *
                                                                                            • ERROR_WIDGET_DISPOSED when the widget has been disposed
                                                                                            • *
                                                                                            - * + * * @since 3.0 */ public void removeTitleListener (TitleListener listener) { @@ -1003,7 +1003,7 @@ webBrowser.removeTitleListener (listener); } -/** +/** * Removes the listener from the collection of listeners who will * be notified when a window hosting the receiver needs to be displayed * or hidden. @@ -1013,12 +1013,12 @@ * @exception IllegalArgumentException
                                                                                              *
                                                                                            • ERROR_NULL_ARGUMENT - if the listener is null
                                                                                            • *
                                                                                            - * + * * @exception SWTException
                                                                                              *
                                                                                            • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                            • *
                                                                                            • ERROR_WIDGET_DISPOSED when the widget has been disposed
                                                                                            • *
                                                                                            - * + * * @since 3.0 */ public void removeVisibilityWindowListener (VisibilityWindowListener listener) { @@ -1038,7 +1038,7 @@ *
                                                                                          • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
                                                                                          • *
                                                                                          • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
                                                                                          • *
                                                                                          - * + * * @since 3.5 */ public void setJavascriptEnabled (boolean enabled) { @@ -1049,12 +1049,12 @@ /** * Renders a string containing HTML. The rendering of the content occurs asynchronously. * The rendered page will be given trusted permissions; to render the page with untrusted - * permissions use setText(String html, boolean trusted) instead. + * permissions use setText(String html, boolean trusted) instead. *

                                                                                          * The html parameter is Unicode-encoded since it is a java String. * As a result, the HTML meta tag charset should not be set. The charset is implied * by the String itself. - * + * * @param html the HTML content to be rendered * * @return true if the operation was successful and false otherwise. @@ -1062,15 +1062,15 @@ * @exception IllegalArgumentException

                                                                                            *
                                                                                          • ERROR_NULL_ARGUMENT - if the html is null
                                                                                          • *
                                                                                          - * + * * @exception SWTException
                                                                                            *
                                                                                          • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                          • *
                                                                                          • ERROR_WIDGET_DISPOSED when the widget has been disposed
                                                                                          • *
                                                                                          - * + * * @see #setText(String,boolean) * @see #setUrl - * + * * @since 3.0 */ public boolean setText (String html) { @@ -1080,7 +1080,7 @@ /** * Renders a string containing HTML. The rendering of the content occurs asynchronously. - * The rendered page can be given either trusted or untrusted permissions. + * The rendered page can be given either trusted or untrusted permissions. *

                                                                                          * The html parameter is Unicode-encoded since it is a java String. * As a result, the HTML meta tag charset should not be set. The charset is implied @@ -1091,9 +1091,9 @@ * to a page on the local file system, while specifying false for trusted * gives the page permissions equivalent to a page from the internet. Page content should * be specified as trusted if the invoker created it or trusts its source, since this would - * allow (for instance) style sheets on the local file system to be referenced. Page + * allow (for instance) style sheets on the local file system to be referenced. Page * content should be specified as untrusted if its source is not trusted or is not known. - * + * * @param html the HTML content to be rendered * @param trusted false if the rendered page should be granted restricted * permissions and true otherwise @@ -1111,7 +1111,7 @@ * * @see #setText(String) * @see #setUrl - * + * * @since 3.6 */ public boolean setText (String html, boolean trusted) { @@ -1122,7 +1122,7 @@ /** * Begins loading a URL. The loading of its content occurs asynchronously. - * + * * @param url the URL to be loaded * * @return true if the operation was successful and false otherwise. @@ -1130,15 +1130,15 @@ * @exception IllegalArgumentException

                                                                                            *
                                                                                          • ERROR_NULL_ARGUMENT - if the url is null
                                                                                          • *
                                                                                          - * + * * @exception SWTException
                                                                                            *
                                                                                          • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                          • *
                                                                                          • ERROR_WIDGET_DISPOSED when the widget has been disposed
                                                                                          • *
                                                                                          - * + * * @see #getUrl * @see #setUrl(String,String,String[]) - * + * * @since 3.0 */ public boolean setUrl (String url) { @@ -1154,22 +1154,22 @@ * sent with the request. A value in the headers argument * must be a name-value pair with a colon separator in order to be sent * (for example: "user-agent: custom"). - * + * * @param url the URL to be loaded * @param postData post data to be sent with the request, or null - * @param headers header lines to be sent with the request, or null + * @param headers header lines to be sent with the request, or null * * @return true if the operation was successful and false otherwise. * * @exception IllegalArgumentException
                                                                                            *
                                                                                          • ERROR_NULL_ARGUMENT - if the url is null
                                                                                          • *
                                                                                          - * + * * @exception SWTException
                                                                                            *
                                                                                          • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
                                                                                          • *
                                                                                          • ERROR_WIDGET_DISPOSED when the widget has been disposed
                                                                                          • *
                                                                                          - * + * * @since 3.6 */ public boolean setUrl (String url, String postData, String[] headers) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/CloseWindowListener.java swt4-gtk-4.6.0/org/eclipse/swt/browser/CloseWindowListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/CloseWindowListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/CloseWindowListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -14,15 +14,15 @@ /** * This listener interface may be implemented in order to receive - * a {@link WindowEvent} notification when a {@link Browser} is + * a {@link WindowEvent} notification when a {@link Browser} is * about to be closed and when its host window should be closed * by the application. - * + * * @see Browser#addCloseWindowListener(CloseWindowListener) * @see Browser#removeCloseWindowListener(CloseWindowListener) * @see OpenWindowListener * @see VisibilityWindowListener - * + * * @since 3.0 */ public interface CloseWindowListener extends SWTEventListener { @@ -40,10 +40,10 @@ * * @param event the WindowEvent that specifies the Browser * that is going to be disposed - * + * * @see org.eclipse.swt.widgets.Shell#close() - * + * * @since 3.0 - */ + */ public void close(WindowEvent event); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/Download_1_8.java swt4-gtk-4.6.0/org/eclipse/swt/browser/Download_1_8.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/Download_1_8.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/Download_1_8.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2012 IBM Corporation and others. + * Copyright (c) 2003, 2016 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 @@ -19,8 +19,8 @@ /** * This class implements the nsIDownload interface for mozilla * version 1.8.x. For mozilla versions 1.4 - 1.7.x this interface - * is implemented by class nsIDownload. Mozilla versions later - * than 1.8.x do not need to call this interface. + * is implemented by class nsIDownload. Mozilla versions later + * than 1.8.x do not need to call this interface. */ class Download_1_8 { XPCOMObject supports; @@ -204,18 +204,18 @@ if (supports != null) { supports.dispose (); supports = null; - } + } if (download != null) { download.dispose (); - download = null; + download = null; } if (progressDialog != null) { progressDialog.dispose (); - progressDialog = null; + progressDialog = null; } if (webProgressListener != null) { webProgressListener.dispose (); - webProgressListener = null; + webProgressListener = null; } } @@ -293,6 +293,7 @@ filename = filename.substring (separator + 1); Listener listener = new Listener() { + @Override public void handleEvent (Event event) { if (event.widget == cancel) { shell.close (); @@ -322,7 +323,7 @@ data.grabExcessHorizontalSpace = true; data.grabExcessVerticalSpace = true; status.setLayoutData (data); - + cancel = new Button (shell, SWT.PUSH); cancel.setText (SWT.getMessage ("SWT_Cancel")); //$NON-NLS-1$ data = new GridData (); @@ -447,9 +448,9 @@ shell = null; } return XPCOM.NS_OK; -} +} int OnStatusChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int aStatus, int /*long*/ aMessage) { return XPCOM.NS_OK; -} +} } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/DownloadFactory_1_8.java swt4-gtk-4.6.0/org/eclipse/swt/browser/DownloadFactory_1_8.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/DownloadFactory_1_8.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/DownloadFactory_1_8.java 2016-07-06 19:11:33.000000000 +0000 @@ -37,7 +37,7 @@ @Override public int /*long*/ method2 (int /*long*/[] args) {return Release ();} }; - + factory = new XPCOMObject (new int[] {2, 0, 0, 3, 1}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -56,10 +56,10 @@ if (supports != null) { supports.dispose (); supports = null; - } + } if (factory != null) { factory.dispose (); - factory = null; + factory = null; } } @@ -71,7 +71,7 @@ if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE; nsID guid = new nsID (); XPCOM.memmove (guid, riid, nsID.sizeof); - + if (guid.Equals (XPCOM.NS_ISUPPORTS_IID)) { XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF); AddRef (); @@ -82,11 +82,11 @@ AddRef (); return XPCOM.NS_OK; } - + XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); return XPCOM.NS_ERROR_NO_INTERFACE; } - + int Release () { refCount--; if (refCount == 0) disposeCOMInterfaces (); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/DownloadFactory.java swt4-gtk-4.6.0/org/eclipse/swt/browser/DownloadFactory.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/DownloadFactory.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/DownloadFactory.java 2016-07-06 19:11:33.000000000 +0000 @@ -37,7 +37,7 @@ @Override public int /*long*/ method2 (int /*long*/[] args) {return Release ();} }; - + factory = new XPCOMObject (new int[] {2, 0, 0, 3, 1}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -56,10 +56,10 @@ if (supports != null) { supports.dispose (); supports = null; - } + } if (factory != null) { factory.dispose (); - factory = null; + factory = null; } } @@ -71,7 +71,7 @@ if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE; nsID guid = new nsID (); XPCOM.memmove (guid, riid, nsID.sizeof); - + if (guid.Equals (XPCOM.NS_ISUPPORTS_IID)) { XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF); AddRef (); @@ -82,17 +82,17 @@ AddRef (); return XPCOM.NS_OK; } - + XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); return XPCOM.NS_ERROR_NO_INTERFACE; } - + int Release () { refCount--; if (refCount == 0) disposeCOMInterfaces (); return refCount; } - + /* nsIFactory */ int CreateInstance (int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/Download.java swt4-gtk-4.6.0/org/eclipse/swt/browser/Download.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/Download.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/Download.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2012 IBM Corporation and others. + * Copyright (c) 2003, 2016 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 @@ -20,7 +20,7 @@ * This class implements the nsIDownload interface for mozilla * versions 1.4 - 1.7.x. For mozilla version 1.8.x this interface * is implemented by class nsIDownload_1_8. Later versions of - * mozilla do not need to call this interface. + * mozilla do not need to call this interface. */ class Download { XPCOMObject supports; @@ -33,7 +33,7 @@ Shell shell; Label status; Button cancel; - + Download () { createCOMInterfaces (); } @@ -53,7 +53,7 @@ @Override public int /*long*/ method2 (int /*long*/[] args) {return Release ();} }; - + download = new XPCOMObject (new int[] {2, 0, 0, 7, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -88,7 +88,7 @@ @Override public int /*long*/ method15 (int /*long*/[] args) {return SetObserver (args[0]);} }; - + progressDialog = new XPCOMObject (new int[] {2, 0, 0, 7, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -133,7 +133,7 @@ @Override public int /*long*/ method20 (int /*long*/[] args) {return SetDialog (args[0]);} }; - + webProgressListener = new XPCOMObject (new int[] {2, 0, 0, 4, 6, 3, 4, 3}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -158,10 +158,10 @@ if (supports != null) { supports.dispose (); supports = null; - } + } if (download != null) { download.dispose (); - download = null; + download = null; } if (progressDialog != null) { progressDialog.dispose (); @@ -205,7 +205,7 @@ XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); return XPCOM.NS_ERROR_NO_INTERFACE; } - + int Release () { refCount--; if (refCount == 0) disposeCOMInterfaces (); @@ -228,9 +228,9 @@ String url = new String (dest); /* - * As of mozilla 1.7 the second argument of the nsIDownload interface's + * As of mozilla 1.7 the second argument of the nsIDownload interface's * Init function changed from nsILocalFile to nsIURI. Detect which of - * these interfaces the second argument implements and act accordingly. + * these interfaces the second argument implements and act accordingly. */ String filename = null; nsISupports supports = new nsISupports (aTarget); @@ -261,6 +261,7 @@ } Listener listener = new Listener () { + @Override public void handleEvent (Event event) { if (event.widget == cancel) { shell.close (); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/ExternalFactory.java swt4-gtk-4.6.0/org/eclipse/swt/browser/ExternalFactory.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/ExternalFactory.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/ExternalFactory.java 2016-07-06 19:11:33.000000000 +0000 @@ -37,7 +37,7 @@ @Override public int /*long*/ method2 (int /*long*/[] args) {return Release ();} }; - + factory = new XPCOMObject (new int[] {2, 0, 0, 3, 1}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -56,10 +56,10 @@ if (supports != null) { supports.dispose (); supports = null; - } + } if (factory != null) { factory.dispose (); - factory = null; + factory = null; } } @@ -71,7 +71,7 @@ if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE; nsID guid = new nsID (); XPCOM.memmove (guid, riid, nsID.sizeof); - + if (guid.Equals (XPCOM.NS_ISUPPORTS_IID)) { XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF); AddRef (); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/External.java swt4-gtk-4.6.0/org/eclipse/swt/browser/External.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/External.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/External.java 2016-07-06 19:11:33.000000000 +0000 @@ -31,7 +31,7 @@ XPCOMObject securityCheckedComponent; XPCOMObject scriptObjectOwner; int refCount = 0; - + static final String CALLJAVA = "callJava"; //$NON-NLS-1$ static Callback CallJavaProc; @@ -215,7 +215,7 @@ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (nsIMemory.class), result); if (rc != XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); serviceManager.Release (); nsIMemory memory = new nsIMemory (result[0]); @@ -599,7 +599,7 @@ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (nsIMemory.class), result); if (rc != XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); serviceManager.Release (); nsIMemory memory = new nsIMemory (result[0]); @@ -651,7 +651,7 @@ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (nsIMemory.class), result); if (rc != XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); serviceManager.Release (); nsIMemory memory = new nsIMemory (result[0]); @@ -703,7 +703,7 @@ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (nsIMemory.class), result); if (rc != XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); serviceManager.Release (); nsIMemory memory = new nsIMemory (result[0]); @@ -728,7 +728,7 @@ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (nsIMemory.class), result); if (rc != XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); serviceManager.Release (); nsIMemory memory = new nsIMemory (result[0]); @@ -739,7 +739,7 @@ String string = new String (dest); byte[] bytes; if (string.equals (CALLJAVA)) { - bytes = MozillaDelegate.wcsToMbcs (null, "allAccess", true); //$NON-NLS-1$ + bytes = MozillaDelegate.wcsToMbcs (null, "allAccess", true); //$NON-NLS-1$ } else { bytes = MozillaDelegate.wcsToMbcs (null, "noAccess", true); //$NON-NLS-1$ } @@ -762,7 +762,7 @@ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (nsIMemory.class), result); if (rc != XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); serviceManager.Release (); nsIMemory memory = new nsIMemory (result[0]); @@ -787,7 +787,7 @@ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (nsIMemory.class), result); if (rc != XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); serviceManager.Release (); nsIMemory memory = new nsIMemory (result[0]); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/FilePickerFactory.java swt4-gtk-4.6.0/org/eclipse/swt/browser/FilePickerFactory.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/FilePickerFactory.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/FilePickerFactory.java 2016-07-06 19:11:33.000000000 +0000 @@ -37,7 +37,7 @@ @Override public int /*long*/ method2 (int /*long*/[] args) {return Release ();} }; - + factory = new XPCOMObject (new int[] {2, 0, 0, 3, 1}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -56,10 +56,10 @@ if (supports != null) { supports.dispose (); supports = null; - } + } if (factory != null) { factory.dispose (); - factory = null; + factory = null; } } @@ -71,7 +71,7 @@ if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE; nsID guid = new nsID (); XPCOM.memmove (guid, riid, nsID.sizeof); - + if (guid.Equals (XPCOM.NS_ISUPPORTS_IID)) { XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF); AddRef (); @@ -82,7 +82,7 @@ AddRef (); return XPCOM.NS_OK; } - + XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); return XPCOM.NS_ERROR_NO_INTERFACE; } @@ -92,7 +92,7 @@ if (refCount == 0) disposeCOMInterfaces (); return refCount; } - + /* nsIFactory */ int CreateInstance (int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/FilePicker.java swt4-gtk-4.6.0/org/eclipse/swt/browser/FilePicker.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/FilePicker.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/FilePicker.java 2016-07-06 19:11:33.000000000 +0000 @@ -91,10 +91,10 @@ if (supports != null) { supports.dispose (); supports = null; - } + } if (filePicker != null) { filePicker.dispose (); - filePicker = null; + filePicker = null; } } @@ -179,7 +179,7 @@ directory = dialog.getFilterPath (); title = defaultFilename = null; masks = null; - int result = filename == null ? nsIFilePicker.returnCancel : nsIFilePicker.returnOK; + int result = filename == null ? nsIFilePicker.returnCancel : nsIFilePicker.returnOK; XPCOM.memmove (_retval, new short[] {(short)result}, 2); /* PRInt16 */ return XPCOM.NS_OK; } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/HelperAppLauncherDialog_10.java swt4-gtk-4.6.0/org/eclipse/swt/browser/HelperAppLauncherDialog_10.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/HelperAppLauncherDialog_10.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/HelperAppLauncherDialog_10.java 2016-07-06 19:11:33.000000000 +0000 @@ -19,7 +19,7 @@ * This class implements the nsIHelperAppLauncherDialog interface for mozilla * versions >= 10. For earlier mozilla versions this interface is implemented * by class HelperAppLauncherDialog(_1_9). HelperAppLauncherDialogFactory - * determines at runtime which of these classes to instantiate. + * determines at runtime which of these classes to instantiate. */ class HelperAppLauncherDialog_10 extends HelperAppLauncherDialog_1_9 { XPCOMObject supports; @@ -69,7 +69,7 @@ if (rc != XPCOM.NS_OK) Mozilla.error (rc); if (result[0] == 0) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); /* Our own nsIDownload has been registered during the Browser initialization. It will be invoked by Mozilla. */ - XPCOM.memmove (_retval, result, C.PTR_SIZEOF); + XPCOM.memmove (_retval, result, C.PTR_SIZEOF); return XPCOM.NS_OK; } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/HelperAppLauncherDialog_1_9.java swt4-gtk-4.6.0/org/eclipse/swt/browser/HelperAppLauncherDialog_1_9.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/HelperAppLauncherDialog_1_9.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/HelperAppLauncherDialog_1_9.java 2016-07-06 19:11:33.000000000 +0000 @@ -19,7 +19,7 @@ * This class implements the nsIHelperAppLauncherDialog interface for mozilla * versions 1.9.x.x. For other mozilla versions this interface is implemented * by class HelperAppLauncherDialog(_10). HelperAppLauncherDialogFactory - * determines at runtime which of these classes to instantiate. + * determines at runtime which of these classes to instantiate. */ class HelperAppLauncherDialog_1_9 { XPCOMObject supports; @@ -45,7 +45,7 @@ @Override public int /*long*/ method2 (int /*long*/[] args) {return Release ();} }; - + helperAppLauncherDialog = new XPCOMObject (new int[] {2, 0, 0, 3, 6}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -57,17 +57,17 @@ public int /*long*/ method3 (int /*long*/[] args) {return Show (args[0], args[1], (int)/*64*/args[2]);} @Override public int /*long*/ method4 (int /*long*/[] args) {return PromptForSaveToFile (args[0], args[1], args[2], args[3], (int)/*64*/args[4], args[5]);} - }; + }; } void disposeCOMInterfaces () { if (supports != null) { supports.dispose (); supports = null; - } + } if (helperAppLauncherDialog != null) { helperAppLauncherDialog.dispose (); - helperAppLauncherDialog = null; + helperAppLauncherDialog = null; } } @@ -94,7 +94,7 @@ XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); return XPCOM.NS_ERROR_NO_INTERFACE; } - + int Release () { refCount--; /* @@ -145,7 +145,7 @@ if (rc != XPCOM.NS_OK) Mozilla.error (rc); if (result[0] == 0) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); /* Our own nsIDownload has been registered during the Browser initialization. It will be invoked by Mozilla. */ - XPCOM.memmove (_retval, result, C.PTR_SIZEOF); + XPCOM.memmove (_retval, result, C.PTR_SIZEOF); return XPCOM.NS_OK; } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/HelperAppLauncherDialogFactory.java swt4-gtk-4.6.0/org/eclipse/swt/browser/HelperAppLauncherDialogFactory.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/HelperAppLauncherDialogFactory.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/HelperAppLauncherDialogFactory.java 2016-07-06 19:11:33.000000000 +0000 @@ -37,7 +37,7 @@ @Override public int /*long*/ method2 (int /*long*/[] args) {return Release ();} }; - + factory = new XPCOMObject (new int[] {2, 0, 0, 3, 1}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -56,10 +56,10 @@ if (supports != null) { supports.dispose (); supports = null; - } + } if (factory != null) { factory.dispose (); - factory = null; + factory = null; } } @@ -71,7 +71,7 @@ if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE; nsID guid = new nsID (); XPCOM.memmove (guid, riid, nsID.sizeof); - + if (guid.Equals (XPCOM.NS_ISUPPORTS_IID)) { XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF); AddRef (); @@ -82,17 +82,17 @@ AddRef (); return XPCOM.NS_OK; } - + XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); return XPCOM.NS_ERROR_NO_INTERFACE; } - + int Release () { refCount--; if (refCount == 0) disposeCOMInterfaces (); return refCount; } - + /* nsIFactory */ int CreateInstance (int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/HelperAppLauncherDialog.java swt4-gtk-4.6.0/org/eclipse/swt/browser/HelperAppLauncherDialog.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/HelperAppLauncherDialog.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/HelperAppLauncherDialog.java 2016-07-06 19:11:33.000000000 +0000 @@ -19,7 +19,7 @@ * This class implements the nsIHelperAppLauncherDialog interface for mozilla * versions 1.4 - 1.8.x. For mozilla versions >= 1.9 this interface is * implemented by class HelperAppLauncherDialog_1_9. HelperAppLauncherDialogFactory - * determines at runtime which of these classes to instantiate. + * determines at runtime which of these classes to instantiate. */ class HelperAppLauncherDialog { XPCOMObject supports; @@ -45,7 +45,7 @@ @Override public int /*long*/ method2 (int /*long*/[] args) {return Release ();} }; - + helperAppLauncherDialog = new XPCOMObject (new int[] {2, 0, 0, 3, 5}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -57,17 +57,17 @@ public int /*long*/ method3 (int /*long*/[] args) {return Show (args[0], args[1], (int)/*64*/args[2]);} @Override public int /*long*/ method4 (int /*long*/[] args) {return PromptForSaveToFile (args[0], args[1], args[2], args[3], args[4]);} - }; + }; } void disposeCOMInterfaces () { if (supports != null) { supports.dispose (); supports = null; - } + } if (helperAppLauncherDialog != null) { helperAppLauncherDialog.dispose (); - helperAppLauncherDialog = null; + helperAppLauncherDialog = null; } } @@ -79,7 +79,7 @@ if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE; nsID guid = new nsID (); XPCOM.memmove (guid, riid, nsID.sizeof); - + if (guid.Equals (XPCOM.NS_ISUPPORTS_IID)) { XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF); AddRef (); @@ -90,11 +90,11 @@ AddRef (); return XPCOM.NS_OK; } - + XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); return XPCOM.NS_ERROR_NO_INTERFACE; } - + int Release () { refCount--; /* @@ -114,7 +114,7 @@ /* * The interface for nsIHelperAppLauncher changed as of mozilla 1.8. Query the received * nsIHelperAppLauncher for the new interface, and if it is not found then fall back to - * the old interface. + * the old interface. */ nsISupports supports = new nsISupports (aLauncher); int /*long*/[] result = new int /*long*/[1]; @@ -136,15 +136,15 @@ /* * The interface for nsIHelperAppLauncherDialog changed as of mozilla 1.5 when an * extra argument was added to the PromptForSaveToFile method (this resulted in all - * subsequent arguments shifting right). The workaround is to provide an XPCOMObject + * subsequent arguments shifting right). The workaround is to provide an XPCOMObject * that fits the newer API, and to use the first argument's type to infer whether * the old or new nsIHelperAppLauncherDialog interface is being used (and by extension * the ordering of the arguments). In mozilla >= 1.5 the first argument is an - * nsIHelperAppLauncher. + * nsIHelperAppLauncher. */ /* * The interface for nsIHelperAppLauncher changed as of mozilla 1.8, so the first - * argument must be queried for both the old and new nsIHelperAppLauncher interfaces. + * argument must be queried for both the old and new nsIHelperAppLauncher interfaces. */ boolean using_1_8 = false; nsISupports support = new nsISupports (arg0); @@ -210,7 +210,7 @@ if (rc != XPCOM.NS_OK) Mozilla.error (rc); if (result[0] == 0) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); /* Our own nsIDownload has been registered during the Browser initialization. It will be invoked by Mozilla. */ - XPCOM.memmove (_retval, result, C.PTR_SIZEOF); + XPCOM.memmove (_retval, result, C.PTR_SIZEOF); return XPCOM.NS_OK; } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/InputStream.java swt4-gtk-4.6.0/org/eclipse/swt/browser/InputStream.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/InputStream.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/InputStream.java 2016-07-06 19:11:33.000000000 +0000 @@ -19,7 +19,7 @@ byte[] buffer; int index = 0; - + InputStream (byte[] buffer) { this.buffer = buffer; index = 0; @@ -56,7 +56,7 @@ void disposeCOMInterfaces () { if (inputStream != null) { inputStream.dispose (); - inputStream = null; + inputStream = null; } } @@ -68,7 +68,7 @@ if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE; nsID guid = new nsID (); XPCOM.memmove (guid, riid, nsID.sizeof); - + if (guid.Equals (XPCOM.NS_ISUPPORTS_IID)) { XPCOM.memmove (ppvObject, new int /*long*/[] {inputStream.getAddress ()}, C.PTR_SIZEOF); AddRef (); @@ -78,17 +78,17 @@ XPCOM.memmove (ppvObject, new int /*long*/[] {inputStream.getAddress ()}, C.PTR_SIZEOF); AddRef (); return XPCOM.NS_OK; - } + } XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); return XPCOM.NS_ERROR_NO_INTERFACE; } - + int Release () { refCount--; if (refCount == 0) disposeCOMInterfaces (); return refCount; } - + /* nsIInputStream implementation */ int Close () { @@ -139,5 +139,5 @@ /* blocking */ XPCOM.memmove (_retval, new boolean[] {false}); return XPCOM.NS_OK; -} +} } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/LocationAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/browser/LocationAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/LocationAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/LocationAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. + * Copyright (c) 2003, 2016 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 @@ -18,16 +18,18 @@ * extend this class and override only the methods which they are * interested in. *

                                                                                          - * + * * @see Sample code and further information * * @since 3.0 */ public abstract class LocationAdapter implements LocationListener { +@Override public void changing(LocationEvent event) { } +@Override public void changed(LocationEvent event) { } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/LocationEvent.java swt4-gtk-4.6.0/org/eclipse/swt/browser/LocationEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/LocationEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/LocationEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,11 +16,11 @@ /** * A LocationEvent is sent by a {@link Browser} to * {@link LocationListener}'s when the Browser - * navigates to a different URL. This notification typically - * occurs when the application navigates to a new location with + * navigates to a different URL. This notification typically + * occurs when the application navigates to a new location with * {@link Browser#setUrl(String)} or when the user activates a * hyperlink. - * + * * @see Sample code and further information * * @since 3.0 @@ -31,13 +31,13 @@ * {@link java.net.URI#URI(String)}. */ public String location; - + /** * A flag indicating whether the location opens in the top frame * or not. */ public boolean top; - + /** * A flag indicating whether the location loading should be allowed. * Setting this field to false will cancel the operation. @@ -45,7 +45,7 @@ public boolean doit; static final long serialVersionUID = 3906644198244299574L; - + /** * Constructs a new instance of this class. * diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/LocationListener.java swt4-gtk-4.6.0/org/eclipse/swt/browser/LocationListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/LocationListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/LocationListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,10 +16,10 @@ * This listener interface may be implemented in order to receive * a {@link LocationEvent} notification when a {@link Browser} * navigates to a different URL. - * + * * @see Browser#addLocationListener(LocationListener) * @see Browser#removeLocationListener(LocationListener) - * + * * @since 3.0 */ public interface LocationListener extends SWTEventListener { @@ -33,14 +33,14 @@ *
                                                                                        • (in) location the location to be loaded *
                                                                                        • (in) widget the Browser whose location is changing *
                                                                                        • (in/out) doit can be set to false to prevent the location - * from being loaded + * from being loaded *
                                                                                        - * + * * @param event the LocationEvent that specifies the location * to be loaded by a Browser - * + * * @since 3.0 - */ + */ public void changing(LocationEvent event); /** @@ -54,12 +54,12 @@ * false otherwise *
                                                                                      • (in) widget the Browser whose location has changed *
                                                                                      - * + * * @param event the LocationEvent that specifies the new * location of a Browser - * + * * @since 3.0 - */ + */ public void changed(LocationEvent event); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/MozillaDelegate.java swt4-gtk-4.6.0/org/eclipse/swt/browser/MozillaDelegate.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/MozillaDelegate.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/MozillaDelegate.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2013 IBM Corporation and others. + * Copyright (c) 2003, 2016 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 @@ -77,7 +77,7 @@ */ int /*long*/ parent = OS.gtk_widget_get_parent (handle); Display display = Display.getCurrent (); - return (Browser)display.findWidget (parent); + return (Browser)display.findWidget (parent); } static String getCacheParentPath () { @@ -111,7 +111,7 @@ static String getProfilePath () { String baseDir = System.getProperty ("user.home"); //$NON-NLS-1$ - + /* * Bug in Sun JRE. Under some circumstances the value of java property "user.home" is * "?", even when the HOME environment variable has a valid value. If this happens @@ -126,7 +126,7 @@ baseDir = new String (mbcsToWcs (null, bytes)); } } - + return baseDir + Mozilla.SEPARATOR_OS + ".mozilla" + Mozilla.SEPARATOR_OS + "eclipse"; //$NON-NLS-1$ //$NON-NLS-2$ } @@ -253,7 +253,7 @@ if (!hasFocus) browser.setFocus (); } - /* + /* * Stop the propagation of events that are not consumed by Mozilla, before * they reach the parent embedder. These event have already been received. */ @@ -265,6 +265,7 @@ if (hasFocus) return; hasFocus = true; listener = new Listener () { + @Override public void handleEvent (Event event) { if (event.widget == browser) return; if (event.type != SWT.Dispose) { @@ -285,9 +286,10 @@ } void handleMouseDown () { - int shellStyle = browser.getShell ().getStyle (); + int shellStyle = browser.getShell ().getStyle (); if ((shellStyle & SWT.ON_TOP) != 0 && (((shellStyle & SWT.NO_FOCUS) == 0) || ((browser.getStyle () & SWT.NO_FOCUS) == 0))) { browser.getDisplay ().asyncExec (new Runnable () { + @Override public void run () { if (browser == null || browser.isDisposed ()) return; ((Mozilla)browser.webBrowser).Activate (); @@ -322,15 +324,15 @@ if (list != 0) { mozillaHandle = OS.g_list_data (list); OS.g_list_free (list); - - if (mozillaHandle != 0) { + + if (mozillaHandle != 0) { /* Note. Callback to get events before Mozilla receives and consumes them. */ OS.g_signal_connect (mozillaHandle, OS.event, eventProc, 0); - - /* - * Note. Callback to get the events not consumed by Mozilla - and to block - * them so that they don't get propagated to the parent handle twice. - * This hook is set after Mozilla and is therefore called after Mozilla's + + /* + * Note. Callback to get the events not consumed by Mozilla - and to block + * them so that they don't get propagated to the parent handle twice. + * This hook is set after Mozilla and is therefore called after Mozilla's * handler because GTK dispatches events in their order of registration. */ OS.g_signal_connect (mozillaHandle, OS.key_press_event, eventProc, STOP_PROPOGATE); @@ -359,6 +361,8 @@ } void setSize (int /*long*/ embedHandle, int width, int height) { + width = DPIUtil.autoScaleUp(width); + height = DPIUtil.autoScaleUp(height); OS.gtk_widget_set_size_request (embedHandle, width, height); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/Mozilla.java swt4-gtk-4.6.0/org/eclipse/swt/browser/Mozilla.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/Mozilla.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/Mozilla.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2015 IBM Corporation and others. + * Copyright (c) 2003, 2016 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 @@ -42,7 +42,7 @@ XPCOMObject embeddingSiteWindow_24; XPCOMObject interfaceRequestor; XPCOMObject supportsWeakReference; - XPCOMObject contextMenuListener; + XPCOMObject contextMenuListener; XPCOMObject uriContentListener; XPCOMObject tooltipListener; XPCOMObject domEventListener; @@ -57,7 +57,7 @@ boolean updateLastNavigateUrl; Shell tip = null; Listener listener; - Vector unhookedDOMWindows = new Vector (); + List unhookedDOMWindows = new ArrayList<> (); String lastNavigateURL; byte[] htmlBytes; @@ -65,7 +65,7 @@ static AppFileLocProvider LocationProvider; static WindowCreator2 WindowCreator; static int BrowserCount, NextJSFunctionIndex = 1; - static Hashtable AllFunctions = new Hashtable (); + static Map AllFunctions = new HashMap<> (); static Listener DisplayListener; static boolean Initialized, IsXULRunner, PerformedVersionCheck, XPCOMWasGlued, XPCOMInitWasGlued; static boolean IsGettingSiteWindow; @@ -83,7 +83,7 @@ static final String GRERANGE_UPPER = "1.9.*"; //$NON-NLS-1$ static final boolean UpperRangeInclusive = true; static final String PROPERTY_ABI = "abi"; //$NON-NLS-1$ - + static final int MAX_PORT = 65535; static final String DEFAULTVALUE_STRING = "default"; //$NON-NLS-1$ static final char SEPARATOR_OS = System.getProperty ("file.separator").charAt (0); //$NON-NLS-1$ @@ -128,6 +128,7 @@ static { DisplayListener = new Listener () { + @Override public void handleEvent (Event event) { if (BrowserCount > 0) return; /* another display is still active */ @@ -137,7 +138,7 @@ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); nsIServiceManager serviceManager = new nsIServiceManager (result[0]); - result[0] = 0; + result[0] = 0; byte[] buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_OBSERVER_CONTRACTID, true); rc = serviceManager.GetServiceByContractID (buffer, IIDStore.GetIID (nsIObserverService.class), result); if (rc != XPCOM.NS_OK) error (rc); @@ -163,7 +164,7 @@ nsILocalFile localFile = new nsILocalFile (result [0]); result[0] = 0; - rc = localFile.QueryInterface (IIDStore.GetIID (nsIFile.class), result); + rc = localFile.QueryInterface (IIDStore.GetIID (nsIFile.class), result); if (rc != XPCOM.NS_OK) Mozilla.error (rc); if (result[0] == 0) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE); localFile.Release (); @@ -191,7 +192,7 @@ * The following is intentionally commented because it causes subsequent * browser instantiations within the process to fail. Mozilla does not * support being unloaded and then re-initialized in a process, see - * http://www.mail-archive.com/dev-embedding@lists.mozilla.org/msg01732.html . + * http://www.mail-archive.com/dev-embedding@lists.mozilla.org/msg01732.html . */ // int size = XPCOM.nsDynamicFunctionLoad_sizeof (); @@ -332,6 +333,7 @@ }; MozillaClearSessions = new Runnable () { + @Override public void run () { if (!Initialized) return; int /*long*/[] result = new int /*long*/[1]; @@ -386,6 +388,7 @@ }; MozillaGetCookie = new Runnable() { + @Override public void run() { if (!Initialized) return; @@ -442,7 +445,7 @@ /* * NS_Free was introduced in mozilla 1.8, prior to this the standard free() call * was to be used. Try to free the cookie string with NS_Free first, and if it fails - * then assume that an older mozilla is being used, and use C's free() instead. + * then assume that an older mozilla is being used, and use C's free() instead. */ if (pathBytes_NSFree == null) { String mozillaPath = getMozillaPath (); @@ -474,6 +477,7 @@ }; MozillaSetCookie = new Runnable() { + @Override public void run() { if (!Initialized) return; @@ -544,7 +548,7 @@ boolean initLoaded = false; if (Boolean.getBoolean (GRE_INITIALIZED)) { - /* + /* * Another browser has already initialized xulrunner in this process, * so just bind to it instead of trying to initialize a new one. */ @@ -553,7 +557,7 @@ MozillaPath = System.getProperty (XULRUNNER_PATH); /* - * Browser clients that ship XULRunner in a plug-in must have an opportunity + * Browser clients that ship XULRunner in a plug-in must have an opportunity * to set the org.eclipse.swt.browser.XULRunnerPath system property to point * at their XULRunner before the first Mozilla-based Browser is created. To * facilitate this, reflection is used to reference non-existent class @@ -577,10 +581,10 @@ Library.loadLibrary (libName); initLoaded = true; } catch (UnsatisfiedLinkError e) { - /* + /* * If this library failed to load then do not attempt to detect a * xulrunner to use. The Browser may still be usable if MOZILLA_FIVE_HOME - * points at a GRE. + * points at a GRE. */ } } else { @@ -605,7 +609,7 @@ * Test whether the detected XULRunner can be used as the GRE before loading swt's * XULRunner library. If it cannot be used then fall back to attempting to use * the GRE pointed to by MOZILLA_FIVE_HOME. - * + * * One case where this will fail is attempting to use a 64-bit xulrunner while swt * is running in 32-bit mode, or vice versa. */ @@ -630,7 +634,7 @@ * crash, so don't attempt unless the GRE appears to be xulrunner. */ if (MozillaPath.indexOf ("xulrunner") == -1) { //$NON-NLS-1$ - IsXULRunner = false; + IsXULRunner = false; } else { MozillaPath += SEPARATOR_OS; MozillaPath += MozillaDelegate.getLibraryName (MozillaPath); @@ -649,7 +653,7 @@ if (Device.DEBUG) System.out.println ("failed to start as XULRunner: " + MozillaPath); //$NON-NLS-1$ } } - } + } } if (IsXULRunner) { XPCOMInitWasGlued = true; @@ -737,7 +741,7 @@ error (XPCOM.NS_NOINTERFACE); } nsIServiceManager serviceManager = new nsIServiceManager (result[0]); - result[0] = 0; + result[0] = 0; /* init the event handler if needed */ initSpinup (componentManager); @@ -756,7 +760,7 @@ /* notify mozilla that the profile directory has been changed from its default value */ initProfile (serviceManager, IsXULRunner); - /* init preference values that give desired mozilla behaviours */ + /* init preference values that give desired mozilla behaviours */ initPreferences (serviceManager, componentManager); /* init our various factories that mozilla can invoke as needed */ @@ -804,7 +808,7 @@ } if (result[0] == 0) { browser.dispose (); - error (XPCOM.NS_NOINTERFACE); + error (XPCOM.NS_NOINTERFACE); } webBrowser = new nsIWebBrowser (result[0]); result[0] = 0; @@ -895,7 +899,7 @@ } } componentRegistrar.Release (); - + if (!factoriesRegistered) { HelperAppLauncherDialogFactory dialogFactory = new HelperAppLauncherDialogFactory (); dialogFactory.AddRef (); @@ -917,7 +921,7 @@ * Bug in XULRunner 1.9. On win32, Mozilla does not clear its background before content has * been set into it. As a result, embedders appear broken if they do not immediately display * a URL or text. The Mozilla bug for this is https://bugzilla.mozilla.org/show_bug.cgi?id=453523. - * + * * The workaround is to subclass the Mozilla window and clear it whenever WM_ERASEBKGND is received. * This subclass should be removed once content has been set into the browser. */ @@ -940,6 +944,7 @@ delegate.init (); listener = new Listener () { + @Override public void handleEvent (Event event) { switch (event.type) { case SWT.Dispose: { @@ -1015,10 +1020,11 @@ * Feature in GTK Mozilla. Mozilla does not show up when * its container (a GTK fixed handle) is made visible * after having been hidden. The workaround is to reset - * its size after the container has been made visible. + * its size after the container has been made visible. */ Display display = event.display; display.asyncExec(new Runnable () { + @Override public void run() { if (browser.isDisposed ()) return; onResize (); @@ -1028,10 +1034,10 @@ } } } - }; + }; int[] folderEvents = new int[] { SWT.Dispose, - SWT.Resize, + SWT.Resize, SWT.FocusIn, SWT.Activate, SWT.Deactivate, @@ -1051,9 +1057,9 @@ int rc = webBrowser.QueryInterface (IIDStore.GetIID (nsIWebNavigation.class), result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE); - - nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); - rc = webNavigation.GoBack (); + + nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); + rc = webNavigation.GoBack (); webNavigation.Release (); return rc == XPCOM.NS_OK; } @@ -1069,7 +1075,7 @@ /* implies that the user did not veto the page unload */ result[0] = true; } - } + } }; execute ("window.location.replace('about:blank');"); //$NON-NLS-1$ locationListeners = oldListeners; @@ -1086,7 +1092,7 @@ @Override public int /*long*/ method2 (int /*long*/[] args) {return Release ();} }; - + weakReference = new XPCOMObject (new int[] {2, 0, 0, 2}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -1116,7 +1122,7 @@ @Override public int /*long*/ method7 (int /*long*/[] args) {return OnSecurityChange (args[0], args[1], (int)/*64*/args[2]);} }; - + webProgressListener_24 = new XPCOMObject (new int[] {2, 0, 0, 4, 6, 4, 4, 3}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -1166,7 +1172,7 @@ @Override public int /*long*/ method12 (int /*long*/[] args) {return ExitModalEventLoop ((int)/*64*/args[0]);} }; - + webBrowserChromeFocus = new XPCOMObject (new int[] {2, 0, 0, 0, 0}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -1179,7 +1185,7 @@ @Override public int /*long*/ method4 (int /*long*/[] args) {return FocusPrevElement ();} }; - + embeddingSiteWindow = new XPCOMObject (new int[] {2, 0, 0, 5, 5, 0, 1, 1, 1, 1, 1}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -1242,7 +1248,7 @@ @Override public int /*long*/ method3 (int /*long*/[] args) {return GetInterface (args[0], args[1]);} }; - + supportsWeakReference = new XPCOMObject (new int[] {2, 0, 0, 1}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -1253,7 +1259,7 @@ @Override public int /*long*/ method3 (int /*long*/[] args) {return GetWeakReference (args[0]);} }; - + contextMenuListener = new XPCOMObject (new int[] {2, 0, 0, 3}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -1264,7 +1270,7 @@ @Override public int /*long*/ method3 (int /*long*/[] args) {return OnShowContextMenu ((int)/*64*/args[0], args[1], args[2]);} }; - + uriContentListener = new XPCOMObject (new int[] {2, 0, 0, 2, 5, 3, 4, 1, 1, 1, 1}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -1287,9 +1293,9 @@ @Override public int /*long*/ method9 (int /*long*/[] args) {return GetParentContentListener (args[0]);} @Override - public int /*long*/ method10 (int /*long*/[] args) {return SetParentContentListener (args[0]);} + public int /*long*/ method10 (int /*long*/[] args) {return SetParentContentListener (args[0]);} }; - + tooltipListener = new XPCOMObject (new int[] {2, 0, 0, 3, 0}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -1300,7 +1306,7 @@ @Override public int /*long*/ method3 (int /*long*/[] args) {return OnShowTooltip ((int)/*64*/args[0], (int)/*64*/args[1], args[2]);} @Override - public int /*long*/ method4 (int /*long*/[] args) {return OnHideTooltip ();} + public int /*long*/ method4 (int /*long*/[] args) {return OnHideTooltip ();} }; domEventListener = new XPCOMObject (new int[] {2, 0, 0, 1}) { @@ -1329,17 +1335,17 @@ @Override void deregisterFunction (BrowserFunction function) { super.deregisterFunction (function); - AllFunctions.remove (new Integer (function.index)); + AllFunctions.remove (function.index); } void disposeCOMInterfaces () { if (supports != null) { supports.dispose (); supports = null; - } + } if (weakReference != null) { weakReference.dispose (); - weakReference = null; + weakReference = null; } if (webProgressListener != null) { webProgressListener.dispose (); @@ -1368,11 +1374,11 @@ if (interfaceRequestor != null) { interfaceRequestor.dispose (); interfaceRequestor = null; - } + } if (supportsWeakReference != null) { supportsWeakReference.dispose (); supportsWeakReference = null; - } + } if (contextMenuListener != null) { contextMenuListener.dispose (); contextMenuListener = null; @@ -1407,8 +1413,8 @@ } } -/** - * evaluate in Chrome security context +/** + * evaluate in Chrome security context */ Object evaluateAsChrome (String script) { int /*long*/[] result = new int /*long*/[1]; @@ -1449,7 +1455,7 @@ return retval; } -/** +/** * evaluate in Normal security context */ Object evaluateInWindow (String script) throws SWTException { @@ -1659,7 +1665,7 @@ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE); nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); - char[] arg = url.toCharArray (); + char[] arg = url.toCharArray (); char[] c = new char[arg.length+1]; System.arraycopy (arg, 0, c, 0, arg.length); rc = webNavigation.LoadURI (c, nsIWebNavigation.LOAD_FLAGS_NONE, 0, 0, 0); @@ -1682,7 +1688,7 @@ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_WINDOWWATCHER_CONTRACTID, true); rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (nsIWindowWatcher.class), result); if (rc != XPCOM.NS_OK) Mozilla.error(rc); - if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); serviceManager.Release (); nsIWindowWatcher windowWatcher = new nsIWindowWatcher (result[0]); @@ -1704,7 +1710,7 @@ result[0] = 0; rc = webBrowserChrome.QueryInterface (IIDStore.GetIID (nsIEmbeddingSiteWindow.class), result); if (rc != XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); webBrowserChrome.Release (); nsIEmbeddingSiteWindow embeddingSiteWindow = new nsIEmbeddingSiteWindow (result[0]); @@ -1713,10 +1719,10 @@ rc = embeddingSiteWindow.GetSiteWindow (result); IsGettingSiteWindow = false; if (rc != XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); embeddingSiteWindow.Release (); - return findBrowser (result[0]); + return findBrowser (result[0]); } @Override @@ -1727,7 +1733,7 @@ int rc = webBrowser.QueryInterface (IIDStore.GetIID (nsIWebNavigation.class), result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE); - + nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); rc = webNavigation.GoForward (); webNavigation.Release (); @@ -1940,7 +1946,7 @@ /** * This method attempts to discover XULRunner and if found returns path of * the mozilla library, else return empty string. - * + * * @return string Mozilla path. */ static String InitDiscoverXULRunner () { @@ -2093,7 +2099,7 @@ browser.dispose (); error (XPCOM.NS_NOINTERFACE); } - + nsIComponentRegistrar componentRegistrar = new nsIComponentRegistrar (result[0]); result[0] = 0; if (!MozillaVersion.CheckVersion (MozillaVersion.VERSION_XR24)) { @@ -2102,7 +2108,7 @@ PromptService2Factory factory = new PromptService2Factory (); factory.AddRef (); - byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PROMPTSERVICE_CONTRACTID, true); + byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PROMPTSERVICE_CONTRACTID, true); byte[] aClassName = MozillaDelegate.wcsToMbcs (null, "swtPromptService", true); //$NON-NLS-1$ rc = componentRegistrar.RegisterFactory (XPCOM.NS_PROMPTSERVICE_CID, aClassName, aContractID, factory.getAddress ()); if (rc != XPCOM.NS_OK) { @@ -2236,18 +2242,18 @@ * Note. Embedding a Mozilla GTK1.2 causes a crash. The workaround * is to check the version of GTK used by Mozilla by looking for * the libwidget_gtk.so library used by Mozilla GTK1.2. Mozilla GTK2 - * uses the libwidget_gtk2.so library. + * uses the libwidget_gtk2.so library. */ if (Compatibility.fileExists (mozillaPath, "components/libwidget_gtk.so")) { //$NON-NLS-1$ browser.dispose (); - SWT.error (SWT.ERROR_NO_HANDLES, null, " [Mozilla GTK2 required (GTK1.2 detected)]"); //$NON-NLS-1$ + SWT.error (SWT.ERROR_NO_HANDLES, null, " [Mozilla GTK2 required (GTK1.2 detected)]"); //$NON-NLS-1$ } try { Library.loadLibrary ("swt-mozilla"); //$NON-NLS-1$ } catch (UnsatisfiedLinkError e) { try { - /* + /* * The initial loadLibrary attempt may have failed as a result of the user's * system not having libstdc++.so.6 installed, so try to load the alternate * swt mozilla library that depends on libswtc++.so.5 instead. @@ -2290,7 +2296,7 @@ C.memset (ptr, 0, size * 2); nsDynamicFunctionLoad functionLoad = new nsDynamicFunctionLoad (); - /* + /* * Attempt to load the XRE_InitEmbedding2 function first, which is present in * mozilla versions > 3.x. */ @@ -2418,7 +2424,7 @@ nsIPrefLocalizedString localizedString = null; buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_LANGUAGES, true); rc = prefBranch.GetComplexValue (buffer, IIDStore.GetIID (nsIPrefLocalizedString.class), result); - /* + /* * Feature of Debian. For some reason attempting to query for the current locale * preference fails on Debian. The workaround for this is to assume a value of * "en-us,en" since this is typically the default value when mozilla is used without @@ -2451,7 +2457,7 @@ /* * construct the new locale preference value by prepending the - * user's current locale and language to the original value + * user's current locale and language to the original value */ Locale locale = Locale.getDefault (); String language = locale.getLanguage (); @@ -2515,7 +2521,7 @@ String prefCharset = null; buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_CHARSET, true); rc = prefBranch.GetComplexValue (buffer, IIDStore.GetIID (nsIPrefLocalizedString.class), result); - /* + /* * Feature of Debian. For some reason attempting to query for the current charset * preference fails on Debian. The workaround for this is to assume a value of * "ISO-8859-1" since this is typically the default value when mozilla is used @@ -2588,7 +2594,7 @@ localizedString = new nsIPrefLocalizedString (result[0]); result[0] = 0; - + int length = proxyHost.length (); char[] charBuffer = new char[length]; proxyHost.getChars (0, length, charBuffer, 0); @@ -2700,7 +2706,7 @@ * try to block these by default since such windows are often unwelcome, but this * assumption should not be made in the Browser's context. Since the Browser client * is responsible for creating the new Browser and Shell in an OpenWindowListener, - * they should decide whether the new window is unwelcome or not and act accordingly. + * they should decide whether the new window is unwelcome or not and act accordingly. */ buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_DISABLEOPENDURINGLOAD, true); rc = prefBranch.SetBoolPref (buffer, 0); @@ -2709,7 +2715,7 @@ error (rc); } - /* Ensure that the status text can be set through means like javascript */ + /* Ensure that the status text can be set through means like javascript */ buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_DISABLEWINDOWSTATUSCHANGE, true); rc = prefBranch.SetBoolPref (buffer, 0); if (rc != XPCOM.NS_OK) { @@ -2717,7 +2723,7 @@ error (rc); } - /* Ensure that the status line can be hidden when opening a window from javascript */ + /* Ensure that the status line can be hidden when opening a window from javascript */ buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_DISABLEOPENWINDOWSTATUSHIDE, true); rc = prefBranch.SetBoolPref (buffer, 0); if (rc != XPCOM.NS_OK) { @@ -2725,7 +2731,7 @@ error (rc); } - /* Ensure that javascript execution is enabled since this is the Browser's default behaviour */ + /* Ensure that javascript execution is enabled since this is the Browser's default behaviour */ buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_JAVASCRIPTENABLED, true); rc = prefBranch.SetBoolPref (buffer, 1); if (rc != XPCOM.NS_OK) { @@ -2848,7 +2854,7 @@ browser.dispose (); error (XPCOM.NS_ERROR_NO_INTERFACE); } - + nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]); result[0] = 0; Rectangle rect = browser.getClientArea (); @@ -2880,7 +2886,7 @@ void initWindowCreator (nsIServiceManager serviceManager) { WindowCreator = new WindowCreator2 (); WindowCreator.AddRef (); - + int /*long*/[] result = new int /*long*/[1]; byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_WINDOWWATCHER_CONTRACTID, true); int rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (nsIWindowWatcher.class), result); @@ -2890,7 +2896,7 @@ } if (result[0] == 0) { browser.dispose (); - error (XPCOM.NS_NOINTERFACE); + error (XPCOM.NS_NOINTERFACE); } nsIWindowWatcher windowWatcher = new nsIWindowWatcher (result[0]); @@ -2934,10 +2940,10 @@ int rc = webBrowser.QueryInterface (IIDStore.GetIID (nsIWebNavigation.class), result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE); - + nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); int[] aCanGoBack = new int[1]; /* PRBool */ - rc = webNavigation.GetCanGoBack (aCanGoBack); + rc = webNavigation.GetCanGoBack (aCanGoBack); webNavigation.Release (); return aCanGoBack[0] != 0; } @@ -2948,7 +2954,7 @@ int rc = webBrowser.QueryInterface (IIDStore.GetIID (nsIWebNavigation.class), result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE); - + nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); int[] aCanGoForward = new int[1]; /* PRBool */ rc = webNavigation.GetCanGoForward (aCanGoForward); @@ -2968,7 +2974,7 @@ ignoreAllMessages = true; execute ("window.location.replace('about:blank');"); //$NON-NLS-1$ ignoreAllMessages = false; - locationListeners = oldLocationListeners; + locationListeners = oldLocationListeners; } if (badCertRequest != 0) { @@ -2980,7 +2986,7 @@ rc = webBrowser.SetParentURIContentListener (0); if (rc != XPCOM.NS_OK) error (rc); - + rc = webBrowser.SetContainerWindow (0); if (rc != XPCOM.NS_OK) error (rc); @@ -3016,9 +3022,9 @@ } unhookedDOMWindows = null; - Enumeration elements = functions.elements (); - while (elements.hasMoreElements ()) { - BrowserFunction function = elements.nextElement (); + Iterator elements = functions.values().iterator (); + while (elements.hasNext ()) { + BrowserFunction function = elements.next (); AllFunctions.remove (new Integer (function.index)); function.dispose (false); } @@ -3037,7 +3043,7 @@ int rc = webBrowser.QueryInterface (IIDStore.GetIID (nsIWebBrowserFocus.class), result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE); - + nsIWebBrowserFocus webBrowserFocus = new nsIWebBrowserFocus (result[0]); rc = webBrowserFocus.Activate (); if (rc != XPCOM.NS_OK) error (rc); @@ -3050,7 +3056,7 @@ int rc = webBrowser.QueryInterface (IIDStore.GetIID (nsIWebBrowserFocus.class), result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE); - + nsIWebBrowserFocus webBrowserFocus = new nsIWebBrowserFocus (result[0]); rc = webBrowserFocus.Deactivate (); if (rc != XPCOM.NS_OK) error (rc); @@ -3063,7 +3069,7 @@ /* get the request post data, if any */ int /*long*/[] result = new int /*long*/[1]; byte[] postData = null; - final List headers = new ArrayList (); + final List headers = new ArrayList<> (); int rc = request.QueryInterface (IIDStore.GetIID (nsIUploadChannel.class), result); if (rc == XPCOM.NS_OK && result[0] != 0) { nsIUploadChannel uploadChannel = new nsIUploadChannel (result[0]); @@ -3242,14 +3248,14 @@ int rc = webBrowser.QueryInterface (IIDStore.GetIID (nsIWebNavigation.class), result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE); - - nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); + + nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); rc = webNavigation.Reload (nsIWebNavigation.LOAD_FLAGS_NONE); webNavigation.Release (); /* * The following error conditions do not indicate unrecoverable problems: - * + * * - NS_ERROR_INVALID_POINTER: happens when Reload is called immediately * after calling LoadURI. * - NS_ERROR_FILE_NOT_FOUND: happens when attempting to reload a file that @@ -3271,7 +3277,7 @@ @Override void registerFunction (BrowserFunction function) { super.registerFunction (function); - AllFunctions.put (new Integer (function.index), function); + AllFunctions.put (function.index, function); } boolean sendChangingEvent (String url) { @@ -3279,7 +3285,7 @@ boolean doit = true; if (request == 0) { - /* + /* * listeners should not be notified of internal transitions like "javascript:..." * because this is an implementation side-effect, not a true navigate */ @@ -3315,7 +3321,7 @@ int rc = webBrowser.QueryInterface (IIDStore.GetIID (nsIWebBrowserSetup.class), result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); - + nsIWebBrowserSetup setup = new nsIWebBrowserSetup (result[0]); result[0] = 0; rc = setup.SetProperty (nsIWebBrowserSetup.SETUP_ALLOW_JAVASCRIPT, jsEnabled ? 1 : 0); @@ -3332,7 +3338,7 @@ @Override public boolean setText (String html, boolean trusted) { /* - * Feature in Mozilla. The focus memory of Mozilla must be + * Feature in Mozilla. The focus memory of Mozilla must be * properly managed through the nsIWebBrowserFocus interface. * In particular, nsIWebBrowserFocus.deactivate must be called * when the focus moves from the browser (or one of its children @@ -3340,16 +3346,16 @@ * get notified when a widget takes focus away from the Browser. * As a result, deactivate is not properly called. This causes * Mozilla to retake focus the next time a document is loaded. - * This breaks the case where the HTML loaded in the Browser + * This breaks the case where the HTML loaded in the Browser * varies while the user enters characters in a text widget. The text * widget loses focus every time new content is loaded. - * The current workaround is to call deactivate everytime if + * The current workaround is to call deactivate everytime if * the browser currently does not have focus. A better workaround * would be to have a way to call deactivate when the Browser * or one of its children loses focus. */ if (browser != browser.getDisplay ().getFocusControl ()) Deactivate (); - + /* convert the String containing HTML to an array of bytes with UTF-8 data */ byte[] data = null; try { @@ -3439,7 +3445,7 @@ /* * Feature in Mozilla. LoadStream invokes the nsIInputStream argument - * through a different thread. The callback mechanism must attach + * through a different thread. The callback mechanism must attach * a non java thread to the JVM otherwise the nsIInputStream Read and * Close methods never get called. */ @@ -3582,8 +3588,8 @@ int rc = webBrowser.QueryInterface (IIDStore.GetIID (nsIWebNavigation.class), result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE); - - nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); + + nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); rc = webNavigation.Stop (nsIWebNavigation.STOP_ALL); if (rc != XPCOM.NS_OK) error (rc); webNavigation.Release (); @@ -3817,8 +3823,8 @@ return refCount; } -/* nsIWeakReference */ - +/* nsIWeakReference */ + int QueryReferent (int /*long*/ riid, int /*long*/ ppvObject) { return QueryInterface (riid, ppvObject); } @@ -3851,9 +3857,9 @@ int OnStateChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int aStateFlags, int aStatus) { if (registerFunctionsOnState != 0 && ((aStateFlags & registerFunctionsOnState) == registerFunctionsOnState)) { registerFunctionsOnState = 0; - Enumeration elements = functions.elements (); - while (elements.hasMoreElements ()) { - BrowserFunction function = elements.nextElement (); + Iterator elements = functions.values().iterator (); + while (elements.hasNext ()) { + BrowserFunction function = elements.next (); if (!function.isEvaluate) { execute (function.functionString); } @@ -3870,7 +3876,7 @@ * When this comes, if the request's name appears to be a url then take it to * be the new site (update lastNavigateURL), and send a "changing" LocationEvent * to allow the redirect to be vetoed. - * + * * Note that updateLastNavigateUrl is not reset to false here so that in * typical contexts where a redirect occurs without an accompanying invalid * certificate, the updated site will be retrieved from the channel (this @@ -3987,7 +3993,7 @@ rc = progress.GetDOMWindow (window); if (rc != XPCOM.NS_OK) error (rc); if (window[0] == 0) error (XPCOM.NS_NOINTERFACE); - + rc = webBrowser.GetContentDOMWindow (result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE); @@ -4008,7 +4014,7 @@ /* * Remove and unreference the nsIDOMWindow from the collection of windows - * that are waiting to have DOM listeners hooked on them. + * that are waiting to have DOM listeners hooked on them. */ unhookedDOMWindows.remove (ptrObject); new nsISupports (ptrObject.value).Release (); @@ -4017,7 +4023,7 @@ boolean deferCompleted = false; /* * If htmlBytes is not null then there is html from a previous setText() call - * waiting to be set into the about:blank page once it has completed loading. + * waiting to be set into the about:blank page once it has completed loading. */ if (htmlBytes != null) { nsIRequest req = new nsIRequest (aRequest); @@ -4033,7 +4039,7 @@ if (url.startsWith (ABOUT_BLANK)) { /* - * Setting mozilla's content with nsIWebBrowserStream invalidates the + * Setting mozilla's content with nsIWebBrowserStream invalidates the * DOM listeners that were hooked on it (about:blank), so remove them and * add new ones after the content has been set. */ @@ -4086,14 +4092,14 @@ * is the only place where registered functions can be re-installed such that * they will be invokable at load time by JS contained in the text. */ - Enumeration elements = functions.elements (); - while (elements.hasMoreElements ()) { - BrowserFunction function = elements.nextElement (); + Iterator elements = functions.values().iterator (); + while (elements.hasNext ()) { + BrowserFunction function = elements.next (); if (!function.isEvaluate) { execute (function.functionString); } } - /* + /* * For Mozilla >= 1.9.2, when content is being set via nsIWebBrowserStream, * registered functions must be re-installed in the subsequent Start Request * in order to be invokable at load time by JS contained in the text. @@ -4133,7 +4139,7 @@ rc = progress.GetDOMWindow (window); if (rc != XPCOM.NS_OK) error (rc); if (window[0] == 0) error (XPCOM.NS_NOINTERFACE); - + rc = webBrowser.GetContentDOMWindow (result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE); @@ -4180,6 +4186,7 @@ event2.display = display; event2.widget = browser; Runnable runnable = new Runnable () { + @Override public void run () { if (browser.isDisposed ()) return; for (int i = 0; i < progressListeners.length; i++) { @@ -4229,7 +4236,7 @@ /* * Hook DOM listeners to the page's nsIDOMWindow here because this is - * the earliest opportunity to do so. + * the earliest opportunity to do so. */ int /*long*/[] result = new int /*long*/[1]; nsIWebProgress progress = new nsIWebProgress (aWebProgress); @@ -4260,7 +4267,7 @@ /* * Remove and unreference the nsIDOMWindow from the collection of windows - * that are waiting to have DOM listeners hooked on them. + * that are waiting to have DOM listeners hooked on them. */ unhookedDOMWindows.remove (ptrObject); new nsISupports (ptrObject.value).Release (); @@ -4306,7 +4313,7 @@ int rc = webProgress.GetDOMWindow (aDOMWindow); if (rc != XPCOM.NS_OK) error (rc); if (aDOMWindow[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE); - + int /*long*/[] aTop = new int /*long*/[1]; nsIDOMWindow domWindow = new nsIDOMWindow (aDOMWindow[0]); rc = domWindow.GetTop (aTop); @@ -4315,7 +4322,7 @@ if (aTop[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE); nsIDOMWindow topWindow = new nsIDOMWindow (aTop[0]); topWindow.Release (); - + nsIURI location = new nsIURI (aLocation); int /*long*/ aSpec = XPCOM.nsEmbedCString_new (); location.GetSpec (aSpec); @@ -4370,7 +4377,7 @@ statusTextListeners[i].changed (event); } return XPCOM.NS_OK; -} +} int OnSecurityChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int state) { return XPCOM.NS_OK; @@ -4395,10 +4402,10 @@ } int GetWebBrowser (int /*long*/ aWebBrowser) { - int /*long*/[] ret = new int /*long*/[1]; + int /*long*/[] ret = new int /*long*/[1]; if (webBrowser != null) { webBrowser.AddRef (); - ret[0] = webBrowser.getAddress (); + ret[0] = webBrowser.getAddress (); } XPCOM.memmove (aWebBrowser, ret, C.PTR_SIZEOF); return XPCOM.NS_OK; @@ -4406,10 +4413,10 @@ int SetWebBrowser (int /*long*/ aWebBrowser) { if (webBrowser != null) webBrowser.Release (); - webBrowser = aWebBrowser != 0 ? new nsIWebBrowser (aWebBrowser) : null; + webBrowser = aWebBrowser != 0 ? new nsIWebBrowser (aWebBrowser) : null; return XPCOM.NS_OK; } - + int GetChromeFlags (int /*long*/ aChromeFlags) { int[] ret = new int[1]; ret[0] = chromeFlags; @@ -4485,7 +4492,7 @@ XPCOM.memmove (retval, new boolean[] {result}); return XPCOM.NS_OK; } - + int ExitModalEventLoop (int aStatus) { return XPCOM.NS_OK; } @@ -4541,7 +4548,7 @@ error (rc); } if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE); - + nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]); rc = baseWindow.SetFocus (); if (rc != XPCOM.NS_OK) error (rc); @@ -4552,8 +4559,8 @@ * focus. This could or should be used to fire an SWT.FOCUS_IN * event on Browser focus listeners. */ - return XPCOM.NS_OK; -} + return XPCOM.NS_OK; +} int GetVisibility (int /*long*/ aVisibility) { boolean visible = browser.isVisible () && !browser.getShell ().getMinimized (); @@ -4570,7 +4577,7 @@ /* * Bug in Mozilla. When the JavaScript window.open is executed, Mozilla * fires multiple SetVisibility 1 notifications. The workaround is - * to ignore subsequent notifications. + * to ignore subsequent notifications. */ if (!visible) { visible = true; @@ -4595,13 +4602,13 @@ } } } - return XPCOM.NS_OK; + return XPCOM.NS_OK; } int GetTitle (int /*long*/ aTitle) { - return XPCOM.NS_OK; + return XPCOM.NS_OK; } - + int SetTitle (int /*long*/ aTitle) { if (titleListeners.length == 0) return XPCOM.NS_OK; TitleEvent event = new TitleEvent (browser); @@ -4610,7 +4617,7 @@ /* * To be consistent with other platforms the title event should * contain the page's url if the page does not contain a - * tag. + * tag. */ int length = XPCOM.strlen_PRUnichar (aTitle); if (length > 0) { @@ -4623,7 +4630,7 @@ for (int i = 0; i < titleListeners.length; i++) { titleListeners[i].changed (event); } - return XPCOM.NS_OK; + return XPCOM.NS_OK; } int GetSiteWindow (int /*long*/ aSiteWindow) { @@ -4636,7 +4643,7 @@ int /*long*/ siteWindow = delegate.getSiteWindow (); XPCOM.memmove (aSiteWindow, new int /*long*/[] {siteWindow}, C.PTR_SIZEOF); - return XPCOM.NS_OK; + return XPCOM.NS_OK; } int Blur () { @@ -4653,12 +4660,13 @@ * send the traversal notification after this callback returns. */ browser.getDisplay ().asyncExec (new Runnable () { + @Override public void run () { if (browser.isDisposed ()) return; browser.traverse (SWT.TRAVERSE_TAB_NEXT); } }); - return XPCOM.NS_OK; + return XPCOM.NS_OK; } int FocusPrevElement () { @@ -4669,12 +4677,13 @@ * send the traversal notification after this callback returns. */ browser.getDisplay ().asyncExec (new Runnable () { + @Override public void run () { if (browser.isDisposed ()) return; browser.traverse (SWT.TRAVERSE_TAB_PREVIOUS); } }); - return XPCOM.NS_OK; + return XPCOM.NS_OK; } /* nsIContextMenuListener */ @@ -4693,8 +4702,10 @@ rc = domMouseEvent.GetScreenY (aScreenY); if (rc != XPCOM.NS_OK) error (rc); domMouseEvent.Release (); - + Event event = new Event (); + aScreenX[0] = DPIUtil.autoScaleDown(aScreenX[0]); // To Points + aScreenY[0] = DPIUtil.autoScaleDown(aScreenY[0]); // To Points event.x = aScreenX[0]; event.y = aScreenY[0]; browser.notifyListeners (SWT.MenuDetect, event); @@ -4706,7 +4717,7 @@ } menu.setVisible (true); } - return XPCOM.NS_OK; + return XPCOM.NS_OK; } /* nsIURIContentListener */ @@ -4820,7 +4831,7 @@ int GetParentContentListener (int /*long*/ aParentContentListener) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } - + int SetParentContentListener (int /*long*/ aParentContentListener) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } @@ -4842,14 +4853,14 @@ label.setBackground (display.getSystemColor (SWT.COLOR_INFO_BACKGROUND)); label.setText (text); /* - * Bug in Mozilla embedded API. Tooltip coordinates are wrong for - * elements inside an inline frame (IFrame tag). The workaround is + * Bug in Mozilla embedded API. Tooltip coordinates are wrong for + * elements inside an inline frame (IFrame tag). The workaround is * to position the tooltip based on the mouse cursor location. */ Point point = display.getCursorLocation (); /* Assuming cursor is 21x21 because this is the size of * the arrow cursor on Windows - */ + */ point.y += 21; tip.setLocation (point); tip.pack (); @@ -4940,7 +4951,7 @@ break; } default: { - /* + /* * If the keydown has Meta (but not Meta+Ctrl) as a modifier then send a KeyDown event for it here * because a corresponding keypress event will not be received for it from the DOM. If the keydown * does not have Meta as a modifier, or has Meta+Ctrl as a modifier, then then do nothing here @@ -4989,7 +5000,7 @@ /* * On linux only, unexpected keypress events are received for some * modifier keys. The workaround is to ignore these events since - * KeyDown events are sent for these keys in the keydown listener. + * KeyDown events are sent for these keys in the keydown listener. */ switch (lastKeyCode) { case SWT.CAPS_LOCK: @@ -5043,7 +5054,7 @@ doit = sendKeyEvent (keyEvent); } else { browser.notifyListeners (keyEvent.type, keyEvent); - doit = keyEvent.doit; + doit = keyEvent.doit; } if (!doit || browser.isDisposed ()) { domEvent.PreventDefault (); @@ -5145,7 +5156,7 @@ if (rc != XPCOM.NS_OK) error (rc); rc = domMouseEvent.GetScreenY (aScreenY); if (rc != XPCOM.NS_OK) error (rc); - Point position = new Point (aScreenX[0], aScreenY[0]); + Point position = DPIUtil.autoScaleDown(new Point (aScreenX[0], aScreenY[0]));// To Points position = browser.getDisplay ().map (null, browser, position); int[] aDetail = new int[1]; /* PRInt32 */ @@ -5220,7 +5231,7 @@ mouseEvent.type = SWT.MouseDoubleClick; mouseEvent.button = aButton[0] + 1; mouseEvent.count = aDetail[0]; - browser.notifyListeners (mouseEvent.type, mouseEvent); + browser.notifyListeners (mouseEvent.type, mouseEvent); } return XPCOM.NS_OK; } @@ -5320,6 +5331,7 @@ System.arraycopy (problems, 0, finalProblems, 0, problemCount); final String url = lastNavigateURL; browser.getDisplay().asyncExec(new Runnable() { + @Override public void run() { if (browser.isDisposed ()) return; if (url.equals (lastNavigateURL)) { @@ -5329,7 +5341,7 @@ int rc = XPCOM.NS_GetServiceManager (result); if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); - + nsIServiceManager serviceManager = new nsIServiceManager (result[0]); result[0] = 0; byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_CERTOVERRIDE_CONTRACTID, true); @@ -5337,7 +5349,7 @@ if (rc != XPCOM.NS_OK) error (rc); if (result[0] == 0) error (XPCOM.NS_NOINTERFACE); serviceManager.Release (); - + nsICertOverrideService overrideService = new nsICertOverrideService (result[0]); result[0] = 0; byte[] hostBytes = MozillaDelegate.wcsToMbcs (null, host, false); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/OpenWindowListener.java swt4-gtk-4.6.0/org/eclipse/swt/browser/OpenWindowListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/OpenWindowListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/OpenWindowListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -12,16 +12,16 @@ import org.eclipse.swt.internal.SWTEventListener; -/** +/** * This listener interface may be implemented in order to receive * a {@link WindowEvent} notification when a new {@link Browser} * needs to be provided by the application. - * + * * @see Browser#addOpenWindowListener(OpenWindowListener) * @see Browser#removeOpenWindowListener(OpenWindowListener) * @see CloseWindowListener * @see VisibilityWindowListener - * + * * @since 3.0 */ public interface OpenWindowListener extends SWTEventListener { @@ -33,10 +33,10 @@ * field to host the content of a new window. * <p> * A standalone system browser is used to host the new window - * if the event.required field value is false and if the event.browser + * if the event.required field value is false and if the event.browser * field is left <code>null</code>. The event.required field * is true on platforms that don't support a standalone system browser for - * new window requests. + * new window requests. * <p> * The navigation is cancelled if the event.required field is set to * true and the event.browser field is left <code>null</code>. @@ -45,16 +45,16 @@ * <ul> * <li>(in/out) required true if the platform requires the user to provide a * <code>Browser</code> to handle the new window or false otherwise. - * <li>(out) browser the new (unique) <code>Browser</code> that will host the + * <li>(out) browser the new (unique) <code>Browser</code> that will host the * content of the new window. - * <li>(in) widget the <code>Browser</code> that is requesting to open a + * <li>(in) widget the <code>Browser</code> that is requesting to open a * new window * </ul> - * + * * @param event the <code>WindowEvent</code> that needs to be passed a new * <code>Browser</code> to handle the new window request - * + * * @since 3.0 - */ + */ public void open(WindowEvent event); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/ProgressAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/browser/ProgressAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/ProgressAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/ProgressAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. + * Copyright (c) 2003, 2016 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 @@ -18,16 +18,18 @@ * extend this class and override only the methods which they are * interested in. * </p> - * + * * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> * * @since 3.0 */ public abstract class ProgressAdapter implements ProgressListener { - + +@Override public void changed(ProgressEvent event) { } +@Override public void completed(ProgressEvent event) { } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/ProgressEvent.java swt4-gtk-4.6.0/org/eclipse/swt/browser/ProgressEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/ProgressEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/ProgressEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -18,7 +18,7 @@ * {@link ProgressListener}'s when a progress is made during the * loading of the current URL or when the loading of the current * URL has been completed. - * + * * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> * * @since 3.0 @@ -28,7 +28,7 @@ public int current; /** total value */ public int total; - + static final long serialVersionUID = 3977018427045393972L; /** diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/ProgressListener.java swt4-gtk-4.6.0/org/eclipse/swt/browser/ProgressListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/ProgressListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/ProgressListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -17,17 +17,17 @@ * a {@link ProgressEvent} notification when a {@link Browser} * makes a progress in loading the current URL or when the * current URL has been loaded. - * + * * @see Browser#addProgressListener(ProgressListener) * @see Browser#removeProgressListener(ProgressListener) * @see Browser#getUrl() - * + * * @since 3.0 */ public interface ProgressListener extends SWTEventListener { - + /** - * This method is called when a progress is made during the loading of the + * This method is called when a progress is made during the loading of the * current location. * <p> * @@ -37,14 +37,14 @@ * <li>(in) total the maximum progress for the location currently being loaded * <li>(in) widget the <code>Browser</code> whose current URL is being loaded * </ul> - * + * * @param event the <code>ProgressEvent</code> related to the loading of the * current location of a <code>Browser</code> - * + * * @since 3.0 - */ + */ public void changed(ProgressEvent event); - + /** * This method is called when the current location has been completely loaded. * <p> @@ -53,10 +53,10 @@ * <ul> * <li>(in) widget the <code>Browser</code> whose current URL has been loaded * </ul> - * + * * @param event the <code>ProgressEvent</code> related to the <code>Browser</code> * that has loaded its current URL. - * + * * @since 3.0 */ public void completed(ProgressEvent event); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/PromptAuth2.java swt4-gtk-4.6.0/org/eclipse/swt/browser/PromptAuth2.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/PromptAuth2.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/PromptAuth2.java 2016-07-06 19:11:33.000000000 +0000 @@ -20,7 +20,7 @@ XPCOMObject promptAuth; int refCount = 0; int /*long*/ parent; - + PromptAuth2 () { createCOMInterfaces (); } @@ -40,7 +40,7 @@ @Override public int /*long*/ method2 (int /*long*/[] args) {return Release ();} }; - + promptAuth = new XPCOMObject (new int[] {2, 0, 0, 4, 6}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -59,7 +59,7 @@ if (supports != null) { supports.dispose (); supports = null; - } + } if (promptAuth != null) { promptAuth.dispose (); promptAuth = null; @@ -74,7 +74,7 @@ if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE; nsID guid = new nsID (); XPCOM.memmove (guid, riid, nsID.sizeof); - + if (guid.Equals (XPCOM.NS_ISUPPORTS_IID)) { XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF); AddRef (); @@ -89,7 +89,7 @@ XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); return XPCOM.NS_ERROR_NO_INTERFACE; } - + int Release () { refCount--; if (refCount == 0) disposeCOMInterfaces (); @@ -208,7 +208,7 @@ rc = auth.SetUsername(string.getAddress ()); if (rc != XPCOM.NS_OK) SWT.error (rc); string.dispose (); - + string = new nsEmbedString (passLabel[0]); rc = auth.SetPassword(string.getAddress ()); if (rc != XPCOM.NS_OK) SWT.error (rc); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/PromptDialog.java swt4-gtk-4.6.0/org/eclipse/swt/browser/PromptDialog.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/PromptDialog.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/PromptDialog.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2012 IBM Corporation and others. + * Copyright (c) 2003, 2016 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 @@ -19,15 +19,15 @@ import org.eclipse.swt.widgets.*; class PromptDialog extends Dialog { - + PromptDialog(Shell parent, int style) { super(parent, style); } - + PromptDialog(Shell parent) { this(parent, 0); } - + void alertCheck(String title, String text, String check, final boolean[] checkValue) { Shell parent = getParent(); final Shell shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); @@ -59,6 +59,7 @@ data.horizontalAlignment = GridData.CENTER; okButton.setLayoutData (data); okButton.addListener(SWT.Selection, new Listener() { + @Override public void handleEvent(Event event) { if (checkButton != null) checkValue[0] = checkButton.getSelection(); shell.close(); @@ -140,6 +141,7 @@ viewCertButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); viewCertButton.setText(Compatibility.getMessage("SWT_ViewCertificate")); //$NON-NLS-1$ viewCertButton.addListener(SWT.Selection, new Listener() { + @Override public void handleEvent(Event event) { int /*long*/[] result = new int /*long*/[1]; int rc = XPCOM.NS_GetServiceManager (result); @@ -153,15 +155,16 @@ if (rc != XPCOM.NS_OK) Mozilla.error (rc); if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE); serviceManager.Release(); - + nsICertificateDialogs dialogs = new nsICertificateDialogs(result[0]); result[0] = 0; - + /* * Bug in Mozilla. The certificate viewer dialog does not show its content when * opened. The workaround is to periodically wake up the UI thread. */ Runnable runnable = new Runnable() { + @Override public void run() { browser.getDisplay().timerExec(1000, this); } @@ -189,6 +192,7 @@ cancelButton.setText(Compatibility.getMessage("SWT_Cancel")); //$NON-NLS-1$ final boolean[] result = new boolean[1]; Listener listener = new Listener() { + @Override public void handleEvent(Event event) { shell.dispose(); result[0] = event.widget == okButton; @@ -226,6 +230,7 @@ final Button[] buttons = new Button[4]; Listener listener = new Listener() { + @Override public void handleEvent(Event event) { if (buttons[0] != null) checkValue[0] = buttons[0].getSelection(); Widget widget = event.widget; @@ -236,7 +241,7 @@ } } shell.close(); - } + } }; if (check != null) { buttons[0] = new Button(shell, SWT.CHECK); @@ -286,7 +291,7 @@ if (!display.readAndDispatch()) display.sleep(); } } - + void prompt(String title, String text, String check, final String[] value, final boolean[] checkValue, final boolean[] result) { Shell parent = getParent(); final Shell shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); @@ -303,7 +308,7 @@ data.horizontalAlignment = GridData.FILL; data.grabExcessHorizontalSpace = true; label.setLayoutData (data); - + final Text valueText = new Text(shell, SWT.BORDER); if (value[0] != null) valueText.setText(value[0]); data = new GridData(); @@ -315,12 +320,13 @@ final Button[] buttons = new Button[3]; Listener listener = new Listener() { + @Override public void handleEvent(Event event) { if (buttons[0] != null) checkValue[0] = buttons[0].getSelection(); value[0] = valueText.getText(); result[0] = event.widget == buttons[1]; shell.close(); - } + } }; if (check != null) { buttons[0] = new Button(shell, SWT.CHECK); @@ -349,7 +355,7 @@ Display display = parent.getDisplay(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); - } + } } void promptUsernameAndPassword(String title, String text, String check, final String[] user, final String[] pass, final boolean[] checkValue, final boolean[] result) { @@ -368,20 +374,20 @@ data.horizontalAlignment = GridData.FILL; data.grabExcessHorizontalSpace = true; label.setLayoutData (data); - + Label userLabel = new Label(shell, SWT.NONE); userLabel.setText(SWT.getMessage("SWT_Username")); //$NON-NLS-1$ - + final Text userText = new Text(shell, SWT.BORDER); if (user[0] != null) userText.setText(user[0]); data = new GridData(); data.horizontalAlignment = GridData.FILL; data.grabExcessHorizontalSpace = true; userText.setLayoutData(data); - + Label passwordLabel = new Label(shell, SWT.NONE); passwordLabel.setText(SWT.getMessage("SWT_Password")); //$NON-NLS-1$ - + final Text passwordText = new Text(shell, SWT.PASSWORD | SWT.BORDER); if (pass[0] != null) passwordText.setText(pass[0]); data = new GridData(); @@ -391,13 +397,14 @@ final Button[] buttons = new Button[3]; Listener listener = new Listener() { + @Override public void handleEvent(Event event) { if (buttons[0] != null) checkValue[0] = buttons[0].getSelection(); user[0] = userText.getText(); pass[0] = passwordText.getText(); result[0] = event.widget == buttons[1]; shell.close(); - } + } }; if (check != null) { buttons[0] = new Button(shell, SWT.CHECK); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/Prompter.java swt4-gtk-4.6.0/org/eclipse/swt/browser/Prompter.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/Prompter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/Prompter.java 2016-07-06 19:11:33.000000000 +0000 @@ -20,7 +20,7 @@ XPCOMObject prompt; int refCount = 0; int /*long*/ parent; - + Prompter () { createCOMInterfaces (); } @@ -40,7 +40,7 @@ @Override public int /*long*/ method2 (int /*long*/[] args) {return Release ();} }; - + prompt = new XPCOMObject (new int[] {2, 0, 0, 2, 4, 3, 5, 9, 6, 6, 7, 6}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -73,10 +73,10 @@ if (supports != null) { supports.dispose (); supports = null; - } + } if (prompt != null) { prompt.dispose (); - prompt = null; + prompt = null; } } @@ -88,7 +88,7 @@ if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE; nsID guid = new nsID (); XPCOM.memmove (guid, riid, nsID.sizeof); - + if (guid.Equals (XPCOM.NS_ISUPPORTS_IID)) { XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF); AddRef (); @@ -102,7 +102,7 @@ XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); return XPCOM.NS_ERROR_NO_INTERFACE; } - + int Release () { refCount--; if (refCount == 0) disposeCOMInterfaces (); @@ -141,7 +141,7 @@ int Alert (int /*long*/ aDialogTitle, int /*long*/ aText) { final Browser browser = getBrowser (); - + int length = XPCOM.strlen_PRUnichar (aDialogTitle); char[] dest = new char[length]; XPCOM.memmove (dest, aDialogTitle, length * 2); @@ -161,7 +161,7 @@ if (mozilla.isRetrievingBadCert) return XPCOM.NS_OK; } - Shell shell = browser == null ? new Shell () : browser.getShell (); + Shell shell = browser == null ? new Shell () : browser.getShell (); MessageBox messageBox = new MessageBox (shell, SWT.OK | SWT.ICON_WARNING); messageBox.setText (titleLabel); messageBox.setMessage (textLabel); @@ -230,7 +230,7 @@ int ConfirmEx (int /*long*/ aDialogTitle, int /*long*/ aText, int aButtonFlags, int /*long*/ aButton0Title, int /*long*/ aButton1Title, int /*long*/ aButton2Title, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) { Browser browser = getBrowser (); - + int length = XPCOM.strlen_PRUnichar (aDialogTitle); char[] dest = new char[length]; XPCOM.memmove (dest, aDialogTitle, length * 2); @@ -240,7 +240,7 @@ dest = new char[length]; XPCOM.memmove (dest, aText, length * 2); String textLabel = new String (dest); - + String checkLabel = null; if (aCheckMsg != 0) { length = XPCOM.strlen_PRUnichar (aCheckMsg); @@ -248,18 +248,18 @@ XPCOM.memmove (dest, aCheckMsg, length * 2); checkLabel = new String (dest); } - + String button0Label = getLabel (aButtonFlags, nsIPrompt.BUTTON_POS_0, aButton0Title); String button1Label = getLabel (aButtonFlags, nsIPrompt.BUTTON_POS_1, aButton1Title); String button2Label = getLabel (aButtonFlags, nsIPrompt.BUTTON_POS_2, aButton2Title); - + int defaultIndex = 0; if ((aButtonFlags & nsIPrompt.BUTTON_POS_1_DEFAULT) != 0) { defaultIndex = 1; } else if ((aButtonFlags & nsIPrompt.BUTTON_POS_2_DEFAULT) != 0) { defaultIndex = 2; } - + Shell shell = browser == null ? new Shell () : browser.getShell (); PromptDialog dialog = new PromptDialog (shell); boolean[] check = new boolean[1]; @@ -283,21 +283,21 @@ XPCOM.memmove (dest, aDialogTitle, length * 2); titleLabel = new String (dest); } - + length = XPCOM.strlen_PRUnichar (aText); dest = new char[length]; XPCOM.memmove (dest, aText, length * 2); textLabel = new String (dest); - + int /*long*/[] valueAddr = new int /*long*/[1]; XPCOM.memmove (valueAddr, aValue, C.PTR_SIZEOF); if (valueAddr[0] != 0) { length = XPCOM.strlen_PRUnichar (valueAddr[0]); dest = new char[length]; XPCOM.memmove (dest, valueAddr[0], length * 2); - valueLabel[0] = new String (dest); + valueLabel[0] = new String (dest); } - + if (aCheckMsg != 0) { length = XPCOM.strlen_PRUnichar (aCheckMsg); if (length > 0) { @@ -315,7 +315,7 @@ XPCOM.memmove (_retval, result); if (result[0]) { - /* + /* * User selected OK. User name and password are returned as PRUnichar values. Any default * value that we override must be freed using the nsIMemory service. */ @@ -330,7 +330,7 @@ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (nsIMemory.class), result2); if (rc != XPCOM.NS_OK) SWT.error (rc); - if (result2[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); + if (result2[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); serviceManager.Release (); nsIMemory memory = new nsIMemory (result2[0]); @@ -457,7 +457,7 @@ rc = auth.SetUsername(string.getAddress ()); if (rc != XPCOM.NS_OK) SWT.error (rc); string.dispose (); - + string = new nsEmbedString (passLabel[0]); rc = auth.SetPassword(string.getAddress ()); if (rc != XPCOM.NS_OK) SWT.error (rc); @@ -512,7 +512,7 @@ } else { titleLabel = SWT.getMessage ("SWT_Authentication_Required"); //$NON-NLS-1$ } - + length = XPCOM.strlen_PRUnichar (aText); dest = new char[length]; XPCOM.memmove (dest, aText, length * 2); @@ -524,7 +524,7 @@ length = XPCOM.strlen_PRUnichar (userAddr[0]); dest = new char[length]; XPCOM.memmove (dest, userAddr[0], length * 2); - userLabel[0] = new String (dest); + userLabel[0] = new String (dest); } int /*long*/[] passAddr = new int /*long*/[1]; @@ -533,9 +533,9 @@ length = XPCOM.strlen_PRUnichar (passAddr[0]); dest = new char[length]; XPCOM.memmove (dest, passAddr[0], length * 2); - passLabel[0] = new String (dest); + passLabel[0] = new String (dest); } - + if (aCheckMsg != 0) { length = XPCOM.strlen_PRUnichar (aCheckMsg); if (length > 0) { @@ -544,13 +544,13 @@ checkLabel = new String (dest); } } - + Shell shell = browser == null ? new Shell () : browser.getShell (); PromptDialog dialog = new PromptDialog (shell); boolean[] check = new boolean[1], result = new boolean[1]; if (aCheckState != 0) XPCOM.memmove (check, aCheckState); dialog.promptUsernameAndPassword (titleLabel, textLabel, checkLabel, userLabel, passLabel, check, result); - + XPCOM.memmove (_retval, result); if (result[0]) { /* User selected OK */ @@ -561,7 +561,7 @@ } if (user != null) { - /* + /* * User name and password are returned as PRUnichar values. Any default * value that we override must be freed using the nsIMemory service. */ @@ -580,7 +580,7 @@ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (nsIMemory.class), result); if (rc != XPCOM.NS_OK) SWT.error (rc); - if (result[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); + if (result[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); serviceManager.Release (); nsIMemory memory = new nsIMemory (result[0]); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/PromptFactory.java swt4-gtk-4.6.0/org/eclipse/swt/browser/PromptFactory.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/PromptFactory.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/PromptFactory.java 2016-07-06 19:11:33.000000000 +0000 @@ -37,7 +37,7 @@ @Override public int /*long*/ method2 (int /*long*/[] args) {return Release ();} }; - + factory = new XPCOMObject (new int[] {2, 0, 0, 3, 1}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -54,10 +54,10 @@ if (supports != null) { supports.dispose (); supports = null; - } + } if (factory != null) { factory.dispose (); - factory = null; + factory = null; } } @@ -69,7 +69,7 @@ if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE; nsID guid = new nsID (); XPCOM.memmove (guid, riid, nsID.sizeof); - + if (guid.Equals (XPCOM.NS_ISUPPORTS_IID)) { XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF); AddRef (); @@ -80,23 +80,23 @@ AddRef (); return XPCOM.NS_OK; } - + XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); return XPCOM.NS_ERROR_NO_INTERFACE; } - + int Release () { refCount--; if (refCount == 0) disposeCOMInterfaces (); return refCount; } - + /* nsIPromptFactory */ int GetPrompt (int /*long*/ aParent, int /*long*/ iid, int /*long*/ result) { nsID guid = new nsID (); XPCOM.memmove (guid, iid, nsID.sizeof); - + if (guid.Equals (IIDStore.GetIID (nsIPrompt.class))) { Prompter prompter = new Prompter (); prompter.AddRef (); @@ -113,7 +113,7 @@ AddRef (); return XPCOM.NS_OK; } - + return XPCOM.NS_NOINTERFACE; } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/PromptService2Factory.java swt4-gtk-4.6.0/org/eclipse/swt/browser/PromptService2Factory.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/PromptService2Factory.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/PromptService2Factory.java 2016-07-06 19:11:33.000000000 +0000 @@ -37,7 +37,7 @@ @Override public int /*long*/ method2 (int /*long*/[] args) {return Release ();} }; - + factory = new XPCOMObject (new int[] {2, 0, 0, 3, 1}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -56,10 +56,10 @@ if (supports != null) { supports.dispose (); supports = null; - } + } if (factory != null) { factory.dispose (); - factory = null; + factory = null; } } @@ -71,7 +71,7 @@ if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE; nsID guid = new nsID (); XPCOM.memmove (guid, riid, nsID.sizeof); - + if (guid.Equals (XPCOM.NS_ISUPPORTS_IID)) { XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF); AddRef (); @@ -82,17 +82,17 @@ AddRef (); return XPCOM.NS_OK; } - + XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); return XPCOM.NS_ERROR_NO_INTERFACE; } - + int Release () { refCount--; if (refCount == 0) disposeCOMInterfaces (); return refCount; } - + /* nsIFactory */ int CreateInstance (int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/PromptService2.java swt4-gtk-4.6.0/org/eclipse/swt/browser/PromptService2.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/PromptService2.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/PromptService2.java 2016-07-06 19:11:33.000000000 +0000 @@ -20,7 +20,7 @@ XPCOMObject promptService; XPCOMObject promptService2; int refCount = 0; - + PromptService2 () { createCOMInterfaces (); } @@ -40,7 +40,7 @@ @Override public int /*long*/ method2 (int /*long*/[] args) {return Release ();} }; - + promptService = new XPCOMObject (new int[] {2, 0, 0, 3, 5, 4, 6, 10, 7, 8, 7, 7}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -67,7 +67,7 @@ @Override public int /*long*/ method11 (int /*long*/[] args) {return Select (args[0], args[1], args[2], (int)/*64*/args[3], args[4], args[5], args[6]);} }; - + promptService2 = new XPCOMObject (new int[] {2, 0, 0, 3, 5, 4, 6, 10, 7, 8, 7, 7, 7, 9}) { @Override public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} @@ -104,14 +104,14 @@ if (supports != null) { supports.dispose (); supports = null; - } + } if (promptService != null) { promptService.dispose (); - promptService = null; + promptService = null; } if (promptService2 != null) { promptService2.dispose (); - promptService2 = null; + promptService2 = null; } } @@ -123,7 +123,7 @@ if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE; nsID guid = new nsID (); XPCOM.memmove (guid, riid, nsID.sizeof); - + if (guid.Equals (XPCOM.NS_ISUPPORTS_IID)) { XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF); AddRef (); @@ -143,7 +143,7 @@ XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); return XPCOM.NS_ERROR_NO_INTERFACE; } - + int Release () { refCount--; if (refCount == 0) disposeCOMInterfaces (); @@ -178,7 +178,7 @@ int Alert (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText) { final Browser browser = getBrowser (aParent); - + int length = XPCOM.strlen_PRUnichar (aDialogTitle); char[] dest = new char[length]; XPCOM.memmove (dest, aDialogTitle, length * 2); @@ -198,7 +198,7 @@ if (mozilla.isRetrievingBadCert) return XPCOM.NS_OK; } - Shell shell = browser == null ? new Shell () : browser.getShell (); + Shell shell = browser == null ? new Shell () : browser.getShell (); MessageBox messageBox = new MessageBox (shell, SWT.OK | SWT.ICON_WARNING); messageBox.setText (titleLabel); messageBox.setMessage (textLabel); @@ -208,7 +208,7 @@ int AlertCheck (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aCheckMsg, int /*long*/ aCheckState) { Browser browser = getBrowser (aParent); - + int length = XPCOM.strlen_PRUnichar (aDialogTitle); char[] dest = new char[length]; XPCOM.memmove (dest, aDialogTitle, length * 2); @@ -271,7 +271,7 @@ int ConfirmEx (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int aButtonFlags, int /*long*/ aButton0Title, int /*long*/ aButton1Title, int /*long*/ aButton2Title, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) { Browser browser = getBrowser (aParent); - + int length = XPCOM.strlen_PRUnichar (aDialogTitle); char[] dest = new char[length]; XPCOM.memmove (dest, aDialogTitle, length * 2); @@ -281,7 +281,7 @@ dest = new char[length]; XPCOM.memmove (dest, aText, length * 2); String textLabel = new String (dest); - + String checkLabel = null; if (aCheckMsg != 0) { length = XPCOM.strlen_PRUnichar (aCheckMsg); @@ -289,18 +289,18 @@ XPCOM.memmove (dest, aCheckMsg, length * 2); checkLabel = new String (dest); } - + String button0Label = getLabel (aButtonFlags, nsIPromptService.BUTTON_POS_0, aButton0Title); String button1Label = getLabel (aButtonFlags, nsIPromptService.BUTTON_POS_1, aButton1Title); String button2Label = getLabel (aButtonFlags, nsIPromptService.BUTTON_POS_2, aButton2Title); - + int defaultIndex = 0; if ((aButtonFlags & nsIPromptService.BUTTON_POS_1_DEFAULT) != 0) { defaultIndex = 1; } else if ((aButtonFlags & nsIPromptService.BUTTON_POS_2_DEFAULT) != 0) { defaultIndex = 2; } - + Shell shell = browser == null ? new Shell () : browser.getShell (); PromptDialog dialog = new PromptDialog (shell); boolean[] check = new boolean[1]; @@ -324,21 +324,21 @@ XPCOM.memmove (dest, aDialogTitle, length * 2); titleLabel = new String (dest); } - + length = XPCOM.strlen_PRUnichar (aText); dest = new char[length]; XPCOM.memmove (dest, aText, length * 2); textLabel = new String (dest); - + int /*long*/[] valueAddr = new int /*long*/[1]; XPCOM.memmove (valueAddr, aValue, C.PTR_SIZEOF); if (valueAddr[0] != 0) { length = XPCOM.strlen_PRUnichar (valueAddr[0]); dest = new char[length]; XPCOM.memmove (dest, valueAddr[0], length * 2); - valueLabel[0] = new String (dest); + valueLabel[0] = new String (dest); } - + if (aCheckMsg != 0) { length = XPCOM.strlen_PRUnichar (aCheckMsg); if (length > 0) { @@ -356,7 +356,7 @@ XPCOM.memmove (_retval, result); if (result[0]) { - /* + /* * User selected OK. User name and password are returned as PRUnichar values. Any default * value that we override must be freed using the nsIMemory service. */ @@ -371,7 +371,7 @@ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (nsIMemory.class), result2); if (rc != XPCOM.NS_OK) SWT.error (rc); - if (result2[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); + if (result2[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); serviceManager.Release (); nsIMemory memory = new nsIMemory (result2[0]); @@ -506,7 +506,7 @@ rc = auth.SetUsername(string.getAddress ()); if (rc != XPCOM.NS_OK) SWT.error (rc); string.dispose (); - + string = new nsEmbedString (passLabel[0]); rc = auth.SetPassword(string.getAddress ()); if (rc != XPCOM.NS_OK) SWT.error (rc); @@ -562,7 +562,7 @@ } else { titleLabel = SWT.getMessage ("SWT_Authentication_Required"); //$NON-NLS-1$ } - + length = XPCOM.strlen_PRUnichar (aText); dest = new char[length]; XPCOM.memmove (dest, aText, length * 2); @@ -574,7 +574,7 @@ length = XPCOM.strlen_PRUnichar (userAddr[0]); dest = new char[length]; XPCOM.memmove (dest, userAddr[0], length * 2); - userLabel[0] = new String (dest); + userLabel[0] = new String (dest); } int /*long*/[] passAddr = new int /*long*/[1]; @@ -583,9 +583,9 @@ length = XPCOM.strlen_PRUnichar (passAddr[0]); dest = new char[length]; XPCOM.memmove (dest, passAddr[0], length * 2); - passLabel[0] = new String (dest); + passLabel[0] = new String (dest); } - + if (aCheckMsg != 0) { length = XPCOM.strlen_PRUnichar (aCheckMsg); if (length > 0) { @@ -594,13 +594,13 @@ checkLabel = new String (dest); } } - + Shell shell = browser == null ? new Shell () : browser.getShell (); PromptDialog dialog = new PromptDialog (shell); boolean[] check = new boolean[1], result = new boolean[1]; if (aCheckState != 0) XPCOM.memmove (check, aCheckState); dialog.promptUsernameAndPassword (titleLabel, textLabel, checkLabel, userLabel, passLabel, check, result); - + XPCOM.memmove (_retval, result); if (result[0]) { /* User selected OK */ @@ -611,7 +611,7 @@ } if (user != null) { - /* + /* * User name and password are returned as PRUnichar values. Any default * value that we override must be freed using the nsIMemory service. */ @@ -630,7 +630,7 @@ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); rc = serviceManager.GetServiceByContractID (aContractID, IIDStore.GetIID (nsIMemory.class), result); if (rc != XPCOM.NS_OK) SWT.error (rc); - if (result[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); + if (result[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); serviceManager.Release (); nsIMemory memory = new nsIMemory (result[0]); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/SimpleEnumerator.java swt4-gtk-4.6.0/org/eclipse/swt/browser/SimpleEnumerator.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/SimpleEnumerator.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/SimpleEnumerator.java 2016-07-06 19:11:33.000000000 +0000 @@ -62,10 +62,10 @@ if (supports != null) { supports.dispose (); supports = null; - } + } if (simpleEnumerator != null) { simpleEnumerator.dispose (); - simpleEnumerator = null; + simpleEnumerator = null; } if (values != null) { for (int i = 0; i < values.length; i++) { @@ -109,14 +109,14 @@ boolean more = values != null && index < values.length; XPCOM.memmove (_retval, new boolean[] {more}); return XPCOM.NS_OK; -} - +} + int GetNext (int /*long*/ _retval) { if (values == null || index == values.length) return XPCOM.NS_ERROR_UNEXPECTED; nsISupports value = values[index++]; value.AddRef (); XPCOM.memmove (_retval, new int /*long*/[] {value.getAddress ()}, C.PTR_SIZEOF); return XPCOM.NS_OK; -} +} } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/StatusTextEvent.java swt4-gtk-4.6.0/org/eclipse/swt/browser/StatusTextEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/StatusTextEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/StatusTextEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -18,7 +18,7 @@ * {@link StatusTextListener}'s when the status text is changed. * The status text is typically displayed in the status bar of * a browser application. - * + * * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> * * @since 3.0 @@ -26,7 +26,7 @@ public class StatusTextEvent extends TypedEvent { /** status text */ public String text; - + static final long serialVersionUID = 3258407348371600439L; /** diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/StatusTextListener.java swt4-gtk-4.6.0/org/eclipse/swt/browser/StatusTextListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/StatusTextListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/StatusTextListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,18 +16,18 @@ * This listener interface may be implemented in order to receive * a {@link StatusTextEvent} notification when the status text for * a {@link Browser} is changed. - * + * * @see Browser#addStatusTextListener(StatusTextListener) * @see Browser#removeStatusTextListener(StatusTextListener) - * + * * @since 3.0 */ public interface StatusTextListener extends SWTEventListener { /** * This method is called when the status text is changed. The - * status text is typically displayed in the status bar of a browser - * application. + * status text is typically displayed in the status bar of a browser + * application. * <p> * * <p>The following fields in the <code>StatusTextEvent</code> apply: @@ -35,10 +35,10 @@ * <li>(in) text the modified status text * <li>(in) widget the <code>Browser</code> whose status text is changed * </ul> - * + * * @param event the <code>StatusTextEvent</code> that contains the updated * status description of a <code>Browser</code> - * + * * @since 3.0 */ public void changed(StatusTextEvent event); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/TitleEvent.java swt4-gtk-4.6.0/org/eclipse/swt/browser/TitleEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/TitleEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/TitleEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -17,7 +17,7 @@ * A <code>TitleEvent</code> is sent by a {@link Browser} to * {@link TitleListener}'s when the title of the current document * is available or when it is modified. - * + * * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> * * @since 3.0 @@ -25,7 +25,7 @@ public class TitleEvent extends TypedEvent { /** the title of the current document */ public String title; - + static final long serialVersionUID = 4121132532906340919L; /** diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/TitleListener.java swt4-gtk-4.6.0/org/eclipse/swt/browser/TitleListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/TitleListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/TitleListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,10 +16,10 @@ * This listener interface may be implemented in order to receive * a {@link TitleEvent} notification when the title of the document * displayed in a {@link Browser} is known or has been changed. - * + * * @see Browser#addTitleListener(TitleListener) * @see Browser#removeTitleListener(TitleListener) - * + * * @since 3.0 */ public interface TitleListener extends SWTEventListener { @@ -35,10 +35,10 @@ * <li>(in) widget the <code>Browser</code> whose current document's * title is known or modified * </ul> - * + * * @param event the <code>TitleEvent</code> that contains the title * of the document currently displayed in a <code>Browser</code> - * + * * @since 3.0 */ public void changed(TitleEvent event); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/VisibilityWindowAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/browser/VisibilityWindowAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/VisibilityWindowAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/VisibilityWindowAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. + * Copyright (c) 2003, 2016 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 @@ -18,16 +18,18 @@ * extend this class and override only the methods which they are * interested in. * </p> - * + * * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> * * @since 3.0 */ public abstract class VisibilityWindowAdapter implements VisibilityWindowListener { +@Override public void hide(WindowEvent event) { } - + +@Override public void show(WindowEvent event) { } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/VisibilityWindowListener.java swt4-gtk-4.6.0/org/eclipse/swt/browser/VisibilityWindowListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/VisibilityWindowListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/VisibilityWindowListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -12,22 +12,22 @@ import org.eclipse.swt.internal.SWTEventListener; -/** +/** * This listener interface may be implemented in order to receive * a {@link WindowEvent} notification when a window hosting a * {@link Browser} needs to be displayed or hidden. - * + * * @see Browser#addVisibilityWindowListener(VisibilityWindowListener) * @see Browser#removeVisibilityWindowListener(VisibilityWindowListener) * @see OpenWindowListener * @see CloseWindowListener - * + * * @since 3.0 */ public interface VisibilityWindowListener extends SWTEventListener { - + /** - * This method is called when the window hosting a <code>Browser</code> + * This method is called when the window hosting a <code>Browser</code> * is requested to be hidden. Application would typically hide the * {@link org.eclipse.swt.widgets.Shell} that hosts the <code>Browser</code>. * <p> @@ -39,17 +39,17 @@ * * @param event the <code>WindowEvent</code> that specifies the * <code>Browser</code> that needs to be hidden - * + * * @see org.eclipse.swt.widgets.Shell#setVisible(boolean) - * + * * @since 3.0 - */ + */ public void hide(WindowEvent event); /** * This method is called when the window hosting a <code>Browser</code> - * is requested to be displayed. Application would typically set the - * location and the size of the {@link org.eclipse.swt.widgets.Shell} + * is requested to be displayed. Application would typically set the + * location and the size of the {@link org.eclipse.swt.widgets.Shell} * that hosts the <code>Browser</code>, if a particular location and size * are specified. The application would then open that <code>Shell</code>. * <p> @@ -57,35 +57,35 @@ * <p>The following fields in the <code>WindowEvent</code> apply: * <ul> * <li>(in) widget the <code>Browser</code> to display - * <li>(in) location the requested location for the <code>Shell</code> - * hosting the browser. It is <code>null</code> if no location is set. + * <li>(in) location the requested location for the <code>Shell</code> + * hosting the browser. It is <code>null</code> if no location is set. * <li>(in) size the requested size for the <code>Browser</code>. * The client area of the <code>Shell</code> hosting the * <code>Browser</code> should be large enough to accommodate that size. * It is <code>null</code> if no size is set. - * <li>(in) addressBar <code>true</code> if the <code>Shell</code> + * <li>(in) addressBar <code>true</code> if the <code>Shell</code> * hosting the <code>Browser</code> should display an address bar or * <code>false</code> otherwise - * <li>(in) menuBar <code>true</code> if the <code>Shell</code> + * <li>(in) menuBar <code>true</code> if the <code>Shell</code> * hosting the <code>Browser</code> should display a menu bar or * <code>false</code> otherwise - * <li>(in) statusBar <code>true</code> if the <code>Shell</code> + * <li>(in) statusBar <code>true</code> if the <code>Shell</code> * hosting the <code>Browser</code> should display a status bar or * <code>false</code> otherwise - * <li>(in) toolBar <code>true</code> if the <code>Shell</code> + * <li>(in) toolBar <code>true</code> if the <code>Shell</code> * hosting the <code>Browser</code> should display a tool bar or * <code>false</code> otherwise * </ul> * * @param event the <code>WindowEvent</code> that specifies the * <code>Browser</code> that needs to be displayed - * + * * @see org.eclipse.swt.widgets.Control#setLocation(org.eclipse.swt.graphics.Point) * @see org.eclipse.swt.widgets.Control#setSize(org.eclipse.swt.graphics.Point) * @see org.eclipse.swt.widgets.Shell#open() - * + * * @since 3.0 - */ + */ public void show(WindowEvent event); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/WebBrowser.java swt4-gtk-4.6.0/org/eclipse/swt/browser/WebBrowser.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/WebBrowser.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/WebBrowser.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2012 IBM Corporation and others. + * Copyright (c) 2003, 2016 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 @@ -11,13 +11,14 @@ package org.eclipse.swt.browser; import java.util.*; +import java.util.List; import org.eclipse.swt.*; import org.eclipse.swt.widgets.*; abstract class WebBrowser { Browser browser; - Hashtable<Integer, BrowserFunction> functions = new Hashtable<Integer, BrowserFunction> (); + Map<Integer, BrowserFunction> functions = new HashMap<> (); AuthenticationListener[] authenticationListeners = new AuthenticationListener[0]; CloseWindowListener[] closeWindowListeners = new CloseWindowListener[0]; LocationListener[] locationListeners = new LocationListener[0]; @@ -33,8 +34,8 @@ static final String ERROR_ID = "org.eclipse.swt.browser.error"; // $NON-NLS-1$ static final String EXECUTE_ID = "SWTExecuteTemporaryFunction"; // $NON-NLS-1$ - static Vector<String[]> NativePendingCookies = new Vector<String[]> (); - static Vector<String[]> MozillaPendingCookies = new Vector<String[]> (); + static List<String[]> NativePendingCookies = new ArrayList<> (); + static List<String[]> MozillaPendingCookies = new ArrayList<> (); static String CookieName, CookieValue, CookieUrl; static boolean CookieResult; static Runnable MozillaClearSessions, NativeClearSessions; @@ -293,7 +294,7 @@ return CookieResult; } -static void SetPendingCookies (Vector<String[]> pendingCookies) { +static void SetPendingCookies (List<String[]> pendingCookies) { for (String[] current : pendingCookies) { SetCookie (current[0], current[1], false); } @@ -319,9 +320,9 @@ * remove it so that it is not recreated on subsequent pages * (the new function overwrites the old one). */ - Enumeration<Integer> keys = functions.keys (); - while (keys.hasMoreElements ()) { - Integer key = keys.nextElement (); + Iterator<Integer> keys = functions.keySet().iterator (); + while (keys.hasNext ()) { + Integer key = keys.next (); BrowserFunction current = functions.get (key); if (current.name.equals (function.name)) { deregisterFunction (current); @@ -375,7 +376,7 @@ } void deregisterFunction (BrowserFunction function) { - functions.remove (new Integer (function.index)); + functions.remove (function.index); } public void destroyFunction (BrowserFunction function) { @@ -473,7 +474,7 @@ public abstract void refresh (); void registerFunction (BrowserFunction function) { - functions.put (new Integer (function.index), function); + functions.put (function.index, function); } public void removeAuthenticationListener (AuthenticationListener listener) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/WebKit.java swt4-gtk-4.6.0/org/eclipse/swt/browser/WebKit.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/WebKit.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/WebKit.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 IBM Corporation and others. + * Copyright (c) 2010, 2016 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 @@ -12,40 +12,17 @@ package org.eclipse.swt.browser; -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.StringTokenizer; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.SWTException; -import org.eclipse.swt.graphics.Device; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.internal.C; -import org.eclipse.swt.internal.Callback; -import org.eclipse.swt.internal.Compatibility; -import org.eclipse.swt.internal.Converter; -import org.eclipse.swt.internal.LONG; -import org.eclipse.swt.internal.Library; -import org.eclipse.swt.internal.gtk.GdkEventKey; -import org.eclipse.swt.internal.gtk.OS; -import org.eclipse.swt.internal.webkit.JSClassDefinition; -import org.eclipse.swt.internal.webkit.WebKitGTK; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Monitor; -import org.eclipse.swt.widgets.Shell; +import java.io.*; +import java.net.*; +import java.util.*; + +import org.eclipse.swt.*; +import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.*; +import org.eclipse.swt.internal.gtk.*; +import org.eclipse.swt.internal.webkit.*; +import org.eclipse.swt.layout.*; +import org.eclipse.swt.widgets.*; class WebKit extends WebBrowser { int /*long*/ webView, webViewData, scrolledWindow; @@ -59,7 +36,7 @@ static int DisabledJSCount; static int /*long*/ ExternalClass, PostString, WebViewType; static boolean IsWebKit14orNewer, LibraryLoaded; - static Hashtable<LONG, LONG> WindowMappings = new Hashtable<LONG, LONG> (); + static Map<LONG, LONG> WindowMappings = new HashMap<> (); static final String ABOUT_BLANK = "about:blank"; //$NON-NLS-1$ static final String CHARSET_UTF8 = "UTF-8"; //$NON-NLS-1$ @@ -157,6 +134,7 @@ if (JSDOMEventProc.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); NativeClearSessions = new Runnable () { + @Override public void run () { if (!LibraryLoaded) return; int /*long*/ session = WebKitGTK.webkit_get_default_session (); @@ -181,6 +159,7 @@ }; NativeGetCookie = new Runnable () { + @Override public void run () { if (!LibraryLoaded) return; int /*long*/ session = WebKitGTK.webkit_get_default_session (); @@ -214,6 +193,7 @@ }; NativeSetCookie = new Runnable () { + @Override public void run () { if (!LibraryLoaded) return; int /*long*/ session = WebKitGTK.webkit_get_default_session (); @@ -351,6 +331,7 @@ case OS.GDK_Tab: { if ((gdkEvent.state & (OS.GDK_CONTROL_MASK | OS.GDK_MOD1_MASK)) == 0) { browser.getDisplay ().asyncExec (new Runnable () { + @Override public void run () { if (browser.isDisposed ()) return; if (browser.getDisplay ().getFocusControl () == null) { @@ -409,7 +390,7 @@ return 0; } - Browser browser = FindBrowser (webView); + Browser browser = FindBrowser (webView); if (browser == null) return 0; WebKit webkit = (WebKit)browser.webBrowser; if (webView == handle) { @@ -679,9 +660,9 @@ OS.g_signal_connect (webView, OS.motion_notify_event, JSDOMEventProc.getAddress (), 0); /* - * Callbacks to get the events not consumed by WebKit, and to block - * them so that they don't get propagated to the parent handle twice. - * This hook is set after WebKit and is therefore called after WebKit's + * Callbacks to get the events not consumed by WebKit, and to block + * them so that they don't get propagated to the parent handle twice. + * This hook is set after WebKit and is therefore called after WebKit's * handler because GTK dispatches events in their order of registration. */ if (!WEBKIT2){ @@ -706,6 +687,7 @@ } Listener listener = new Listener () { + @Override public void handleEvent (Event event) { switch (event.type) { case SWT.Dispose: { @@ -1241,6 +1223,7 @@ if (browser.isFocusControl ()) { if (keyCode == SWT.TAB && (stateMask & (SWT.CTRL | SWT.ALT)) == 0) { browser.getDisplay ().asyncExec (new Runnable () { + @Override public void run () { if (browser.isDisposed ()) return; if (browser.getDisplay ().getFocusControl () == null) { @@ -1553,9 +1536,9 @@ } } - Enumeration<BrowserFunction> elements = functions.elements (); - while (elements.hasMoreElements ()) { - elements.nextElement ().dispose (false); + Iterator<BrowserFunction> elements = functions.values().iterator (); + while (elements.hasNext ()) { + elements.next ().dispose (false); } functions = null; @@ -1571,7 +1554,7 @@ } void onResize (Event e) { - Rectangle rect = browser.getClientArea (); + Rectangle rect = DPIUtil.autoScaleUp(browser.getClientArea ()); if (WEBKIT2){ OS.gtk_widget_set_size_request (webView, rect.width, rect.height); } else { @@ -1622,6 +1605,7 @@ data.horizontalAlignment = GridData.CENTER; cancel.setLayoutData (data); final Listener cancelListener = new Listener () { + @Override public void handleEvent (Event event) { WebKitGTK.webkit_download_cancel (webkitDownload); } @@ -1632,6 +1616,7 @@ final Display display = browser.getDisplay (); final int INTERVAL = 500; display.timerExec (INTERVAL, new Runnable () { + @Override public void run () { int status = WebKitGTK.webkit_download_get_status (webkitDownload); if (shell.isDisposed () || status == WebKitGTK.WEBKIT_DOWNLOAD_STATUS_FINISHED || status == WebKitGTK.WEBKIT_DOWNLOAD_STATUS_CANCELLED) { @@ -1646,6 +1631,7 @@ OS.g_object_unref (webkitDownload); cancel.removeListener (SWT.Selection, cancelListener); cancel.addListener (SWT.Selection, new Listener () { + @Override public void handleEvent (Event event) { shell.dispose (); } @@ -1766,7 +1752,9 @@ if (WEBKIT2 && headers != null){ int /*long*/ request = WebKitGTK.webkit_uri_request_new (uriBytes); int /*long*/ requestHeaders = WebKitGTK.webkit_uri_request_get_http_headers (request); - addRequestHeaders(requestHeaders, headers); + if (requestHeaders != 0) { + addRequestHeaders(requestHeaders, headers); + } WebKitGTK.webkit_web_view_load_request (webView, request); return true; @@ -1856,6 +1844,7 @@ * a hang. The workaround is to open it asynchronously with a new download. */ browser.getDisplay ().asyncExec (new Runnable () { + @Override public void run () { if (!browser.isDisposed ()) { FileDialog dialog = new FileDialog (browser.getShell (), SWT.SAVE); @@ -2321,9 +2310,9 @@ int /*long*/ name = WebKitGTK.JSStringCreateWithUTF8CString (bytes); WebKitGTK.JSObjectSetProperty (context, globalObject, name, externalObject, 0, null); WebKitGTK.JSStringRelease (name); - Enumeration<BrowserFunction> elements = functions.elements (); - while (elements.hasMoreElements ()) { - BrowserFunction current = elements.nextElement (); + Iterator<BrowserFunction> elements = functions.values().iterator (); + while (elements.hasNext ()) { + BrowserFunction current = elements.next (); execute (current.functionString); } int /*long*/ mainFrame = WebKitGTK.webkit_web_view_get_main_frame (webView); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/WindowCreator2.java swt4-gtk-4.6.0/org/eclipse/swt/browser/WindowCreator2.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/WindowCreator2.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/WindowCreator2.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2013 IBM Corporation and others. + * Copyright (c) 2003, 2016 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 @@ -72,15 +72,15 @@ if (supports != null) { supports.dispose (); supports = null; - } + } if (windowCreator != null) { windowCreator.dispose (); - windowCreator = null; + windowCreator = null; } if (windowCreator2 != null) { windowCreator2.dispose (); - windowCreator2 = null; + windowCreator2 = null; } } @@ -92,7 +92,7 @@ if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE; nsID guid = new nsID (); XPCOM.memmove (guid, riid, nsID.sizeof); - + if (guid.Equals (XPCOM.NS_ISUPPORTS_IID)) { XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF); AddRef (); @@ -112,13 +112,13 @@ XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); return XPCOM.NS_ERROR_NO_INTERFACE; } - + int Release () { refCount--; if (refCount == 0) disposeCOMInterfaces (); return refCount; } - + /* nsIWindowCreator */ int CreateChromeWindow (int /*long*/ parent, int chromeFlags, int /*long*/ _retval) { @@ -131,7 +131,7 @@ if (parent == 0 && (chromeFlags & nsIWebBrowserChrome.CHROME_OPENAS_CHROME) == 0) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } - Browser src = null; + Browser src = null; if (parent != 0) { nsIWebBrowserChrome browserChromeParent = new nsIWebBrowserChrome (parent); int /*long*/[] aWebBrowser = new int /*long*/[1]; @@ -171,15 +171,17 @@ /* add dialog trim for all windows except pop-ups */ style |= SWT.DIALOG_TRIM; } - if ((chromeFlags & nsIWebBrowserChrome.CHROME_MODAL) != 0) style |= SWT.APPLICATION_MODAL; + if ((chromeFlags & nsIWebBrowserChrome.CHROME_MODAL) != 0) style |= SWT.APPLICATION_MODAL; final Shell shell = src == null ? new Shell (style) : new Shell (src.getShell(), style); shell.setLayout (new FillLayout ()); browser = new Browser (shell, src == null ? SWT.MOZILLA : src.getStyle () & SWT.MOZILLA); browser.addVisibilityWindowListener (new VisibilityWindowListener () { + @Override public void hide (WindowEvent event) { } + @Override public void show (WindowEvent event) { if (event.location != null) shell.setLocation (event.location); if (event.size != null) { @@ -190,6 +192,7 @@ } }); browser.addCloseWindowListener (new CloseWindowListener () { + @Override public void close (WindowEvent event) { shell.close (); } @@ -218,7 +221,7 @@ } browser = event.browser; - /* Ensure that the Browser provided by the client is valid for use */ + /* Ensure that the Browser provided by the client is valid for use */ doit = browser != null && !browser.isDisposed (); if (doit) { String platform = Platform.PLATFORM; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/browser/WindowEvent.java swt4-gtk-4.6.0/org/eclipse/swt/browser/WindowEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/browser/WindowEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/browser/WindowEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -24,7 +24,7 @@ * <p> * The following example shows how <code>WindowEvent</code>'s are typically * handled. - * + * * <code><pre> * public static void main(String[] args) { * Display display = new Display(); @@ -90,10 +90,10 @@ * }); * } * </pre></code> - * + * * The following notifications are emitted when the user selects a hyperlink that targets a new window - * or as the result of a javascript that executes window.open. - * + * or as the result of a javascript that executes window.open. + * * <p>Main Browser * <ul> * <li>User selects a link that opens in a new window or javascript requests a new window</li> @@ -104,7 +104,7 @@ * <li>Application returns the second Browser as the host for the new window content</li> * </ul> * </ul> - * + * * <p>Second Browser * <ul> * <li>VisibilityWindowListener.show() notified</li> @@ -112,49 +112,49 @@ * <li>Application sets navigation tool bar, status bar, menu bar and Shell size * <li>Application makes the Shell hosting the second Browser visible * <li>User now sees the new window - * </ul> + * </ul> * </ul> - * + * * @see CloseWindowListener * @see OpenWindowListener * @see VisibilityWindowListener * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.0 */ public class WindowEvent extends TypedEvent { - /** + /** * Specifies whether the platform requires the user to provide a * <code>Browser</code> to handle the new window. - * + * * @since 3.1 */ public boolean required; - - - /** + + + /** * <code>Browser</code> provided by the application. */ public Browser browser; - /** + /** * Requested location for the <code>Shell</code> hosting the <code>Browser</code>. * It is <code>null</code> if no location has been requested. */ public Point location; - /** - * Requested <code>Browser</code> size. The client area of the <code>Shell</code> - * hosting the <code>Browser</code> should be large enough to accommodate that size. + /** + * Requested <code>Browser</code> size. The client area of the <code>Shell</code> + * hosting the <code>Browser</code> should be large enough to accommodate that size. * It is <code>null</code> if no size has been requested. */ public Point size; - + /** * Specifies whether the <code>Shell</code> hosting the <code>Browser</code> should * display an address bar. - * + * * @since 3.1 */ public boolean addressBar; @@ -162,29 +162,29 @@ /** * Specifies whether the <code>Shell</code> hosting the <code>Browser</code> should * display a menu bar. Note that this is always <code>true</code> on OS X. - * + * * @since 3.1 */ public boolean menuBar; - + /** * Specifies whether the <code>Shell</code> hosting the <code>Browser</code> should * display a status bar. - * + * * @since 3.1 */ public boolean statusBar; - + /** * Specifies whether the <code>Shell</code> hosting the <code>Browser</code> should * display a tool bar. - * + * * @since 3.1 */ public boolean toolBar; - + static final long serialVersionUID = 3617851997387174969L; - + /** * Constructs a new instance of this class. * diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/AnimatedProgress.java swt4-gtk-4.6.0/org/eclipse/swt/custom/AnimatedProgress.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/AnimatedProgress.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/AnimatedProgress.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -12,14 +12,14 @@ import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; +import org.eclipse.swt.widgets.*; import org.eclipse.swt.events.*; /** * A control for showing progress feedback for a long running operation. * * @deprecated As of Eclipse 2.1, use ProgressBar with the style SWT.INDETERMINATE - * + * * <dl> * <dt><b>Styles:</b><dd>VERTICAL, HORIZONTAL, BORDER * </dl> @@ -44,7 +44,7 @@ * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -68,24 +68,26 @@ */ public AnimatedProgress(Composite parent, int style) { super(parent, checkStyle(style)); - + if ((style & SWT.VERTICAL) != 0) { orientation = SWT.VERTICAL; } showBorder = (style & SWT.BORDER) != 0; - + addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { redraw(); } - }); + }); addPaintListener(new PaintListener() { + @Override public void paintControl(PaintEvent e) { paint(e); } }); addDisposeListener(new DisposeListener() { + @Override public void widgetDisposed(DisposeEvent e){ stop(); } @@ -96,9 +98,9 @@ return style & mask; } /** - * Stop the animation if it is not already stopped and + * Stop the animation if it is not already stopped and * reset the presentation to a blank appearance. - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -121,14 +123,14 @@ } if (wHint != SWT.DEFAULT) size.x = wHint; if (hHint != SWT.DEFAULT) size.y = hHint; - + return size; } private void drawBevelRect(GC gc, int x, int y, int w, int h, Color topleft, Color bottomright) { gc.setForeground(topleft); gc.drawLine(x, y, x+w-1, y); gc.drawLine(x, y, x, y+h-1); - + gc.setForeground(bottomright); gc.drawLine(x+w, y, x+w, y+h); gc.drawLine(x, y+h, x+w, y+h); @@ -136,7 +138,7 @@ void paint(PaintEvent event) { GC gc = event.gc; Display disp= getDisplay(); - + Rectangle rect= getClientArea(); gc.fillRectangle(rect); if (showBorder) { @@ -144,13 +146,13 @@ disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW), disp.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW)); } - + paintStripes(gc); -} +} void paintStripes(GC gc) { - + if (!showStripes) return; - + Rectangle rect= getClientArea(); // Subtracted border painted by paint. rect = new Rectangle(rect.x+2, rect.y+2, rect.width-4, rect.height-4); @@ -181,14 +183,14 @@ gc.drawLine(x, y, w, y); } } - + if (active) { value = (value + 2) % step; } } /** * Start the animation. -* +* * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -200,13 +202,14 @@ active = true; showStripes = true; - + final Display display = getDisplay(); final Runnable [] timer = new Runnable [1]; timer [0] = new Runnable () { + @Override public void run () { if (!active) return; - GC gc = new GC(AnimatedProgress.this); + GC gc = new GC(AnimatedProgress.this); paintStripes(gc); gc.dispose(); display.timerExec (SLEEP, timer [0]); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/BidiSegmentEvent.java swt4-gtk-4.6.0/org/eclipse/swt/custom/BidiSegmentEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/BidiSegmentEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/BidiSegmentEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -15,54 +15,54 @@ /** * This event is sent to BidiSegmentListeners when a line is to - * be measured or rendered in a bidi locale. + * be measured or rendered in a bidi locale. * The segments field can be used in conjunction with the segmentsChars * field or by itself. Setting only the segmentsChars field has no effect. * When used by itself, the segments field specify text ranges in the line - * that should be treated as separate segments for bidi reordering. Each + * that should be treated as separate segments for bidi reordering. Each * segment will be reordered and rendered separately. * <p> - * The elements in the segments field specify the start offset of + * The elements in the segments field specify the start offset of * a segment relative to the start of the line. They must follow * the following rules: * <ul> * <li>elements must be in ascending order and must not have duplicates * <li>elements must not exceed the line length * </ul> - * In addition, the first element may be set to zero and the last element may + * In addition, the first element may be set to zero and the last element may * be set to the end of the line but this is not required. * - * The segments field may be left null if the entire line should + * The segments field may be left null if the entire line should * be reordered as is. * </p> - * A BidiSegmentListener may be used when adjacent segments of - * right-to-left text should not be reordered relative to each other. - * For example, within a Java editor, you may wish multiple + * A BidiSegmentListener may be used when adjacent segments of + * right-to-left text should not be reordered relative to each other. + * For example, within a Java editor, you may wish multiple * right-to-left string literals to be reordered differently than the - * bidi algorithm specifies. + * bidi algorithm specifies. * * Example: * <pre> * stored line = "R1R2R3" + "R4R5R6" * R1 to R6 are right-to-left characters. The quotation marks * are part of the line text. The line is 13 characters long. - * - * segments = null: - * entire line will be reordered and thus the two R2L segments - * swapped (as per the bidi algorithm). + * + * segments = null: + * entire line will be reordered and thus the two R2L segments + * swapped (as per the bidi algorithm). * visual line (rendered on screen) = "R6R5R4" + "R3R2R1" - * - * segments = [0, 5, 8] - * "R1R2R3" will be reordered, followed by [blank]+[blank] and - * "R4R5R6". + * + * segments = [0, 5, 8] + * "R1R2R3" will be reordered, followed by [blank]+[blank] and + * "R4R5R6". * visual line = "R3R2R1" + "R6R5R4" * </pre> - * + * * <p> * The segments and segmentsChars fields can be used together to obtain different * types of bidi reordering and text display. The application can use these two fields * to insert Unicode Control Characters in specific offsets in the line, the character - * at segmentsChars[i] is inserted at the offset specified by segments[i]. When both fields + * at segmentsChars[i] is inserted at the offset specified by segments[i]. When both fields * are set, the rules for the segments field are less restrictive: * <ul> * <li>elements must be in ascending order, duplicates are allowed @@ -73,7 +73,7 @@ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public class BidiSegmentEvent extends SegmentEvent { - + static final long serialVersionUID = -3712986188155944253L; BidiSegmentEvent(StyledTextEvent e) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/BidiSegmentListener.java swt4-gtk-4.6.0/org/eclipse/swt/custom/BidiSegmentListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/BidiSegmentListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/BidiSegmentListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,17 +16,17 @@ * This listener interface may be implemented in order to receive * BidiSegmentEvents. * @see BidiSegmentEvent - */ + */ public interface BidiSegmentListener extends SWTEventListener { /** - * This method is called when a line needs to be reordered for - * measuring or rendering in a bidi locale. + * This method is called when a line needs to be reordered for + * measuring or rendering in a bidi locale. * <p> * The following event fields are used:<ul> * <li>event.lineOffset line start offset (input)</li> * <li>event.lineText line text (input)</li> - * <li>event.segments text segments that should be reordered separately (output)</li> + * <li>event.segments text segments that should be reordered separately (output)</li> * <li>event.segmentsChars characters that should be inserted (output, optional)</li> * </ul> * diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/Bullet.java swt4-gtk-4.6.0/org/eclipse/swt/custom/Bullet.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/Bullet.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/Bullet.java 2016-07-06 19:11:33.000000000 +0000 @@ -18,17 +18,17 @@ * The hashCode() method in this class uses the values of the public * fields to compute the hash value. When storing instances of the * class in hashed collections, do not modify these fields after the - * object has been inserted. + * object has been inserted. * </p> * <p> * Application code does <em>not</em> need to explicitly release the * resources managed by each instance when those instances are no longer * required, and thus no <code>dispose()</code> method is provided. * </p> - * + * * @see StyledText#setLineBullet(int, int, Bullet) * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.2 */ public class Bullet { @@ -58,36 +58,36 @@ int[] linesIndices; int count; -/** - * Create a new bullet with the specified style, and type <code>ST.BULLET_DOT</code>. +/** + * Create a new bullet with the specified style, and type <code>ST.BULLET_DOT</code>. * The style must have a glyph metrics set. * - * @param style the style - * + * @param style the style + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when the style or the glyph metrics are null</li> - * </ul> + * </ul> */ public Bullet(StyleRange style) { this(ST.BULLET_DOT, style); } -/** - * Create a new bullet the specified style and type. +/** + * Create a new bullet the specified style and type. * The style must have a glyph metrics set. * * @param type the bullet type - * @param style the style - * + * @param style the style + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when the style or the glyph metrics are null</li> - * </ul> + * </ul> */ public Bullet(int type, StyleRange style) { if (style == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (style.metrics == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); this.type = type; this.style = style; -} +} void addIndices (int startLine, int lineCount) { if (linesIndices == null) { linesIndices = new int[lineCount]; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/BusyIndicator.java swt4-gtk-4.6.0/org/eclipse/swt/custom/BusyIndicator.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/BusyIndicator.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/BusyIndicator.java 2016-07-06 19:11:33.000000000 +0000 @@ -30,14 +30,14 @@ /** * Runs the given <code>Runnable</code> while providing * busy feedback using this busy indicator. - * + * * @param display the display on which the busy feedback should be * displayed. If the display is null, the Display for the current * thread will be used. If there is no Display for the current thread, * the runnable code will be executed and no busy feedback will be displayed. * @param runnable the runnable for which busy feedback is to be shown. * Must not be null. - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the runnable is null</li> * </ul> @@ -53,8 +53,8 @@ return; } } - - Integer busyId = new Integer(nextBusyId); + + Integer busyId = Integer.valueOf(nextBusyId); nextBusyId++; Cursor cursor = display.getSystemCursor(SWT.CURSOR_WAIT); Shell[] shells = display.getShells(); @@ -65,7 +65,7 @@ shells[i].setData(BUSYID_NAME, busyId); } } - + try { runnable.run(); } finally { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/CaretEvent.java swt4-gtk-4.6.0/org/eclipse/swt/custom/CaretEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/CaretEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/CaretEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -17,16 +17,16 @@ * This event is sent when the caret offset changes. * * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.5 */ public class CaretEvent extends TypedEvent { - - /** - * caret offset + + /** + * caret offset */ public int caretOffset; - + static final long serialVersionUID = 3257846571587545489L; CaretEvent(StyledTextEvent e) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/CaretListener.java swt4-gtk-4.6.0/org/eclipse/swt/custom/CaretListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/CaretListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/CaretListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -15,22 +15,22 @@ /** * This listener interface may be implemented in order to receive * CaretEvents. - * + * * @see CaretEvent - * + * * @since 3.5 - */ + */ public interface CaretListener extends SWTEventListener { /** * This method is called after the caret offset is changed. - * + * * The following event fields are used:<ul> * <li>event.caretOffset the new caret offset (input)</li> * </ul> * * @param event the given event - * + * * @see CaretEvent */ public void caretMoved(CaretEvent event); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/CBanner.java swt4-gtk-4.6.0/org/eclipse/swt/custom/CBanner.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/CBanner.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/CBanner.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -35,27 +35,27 @@ * <p> * IMPORTANT: This class is <em>not</em> intended to be subclassed. * </p> - * + * * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> * * @since 3.0 * @noextend This class is not intended to be subclassed by clients. */ -public class CBanner extends Composite { +public class CBanner extends Composite { Control left; Control right; Control bottom; - + boolean simple = true; - + int[] curve = new int[0]; int curveStart = 0; Rectangle curveRect = new Rectangle(0, 0, 0, 0); int curve_width = 5; int curve_indent = -2; - + int rightWidth = SWT.DEFAULT; int rightMinWidth = 0; int rightMinHeight = 0; @@ -63,7 +63,7 @@ boolean dragging = false; int rightDragDisplacement = 0; Listener listener; - + static final int OFFSCREEN = -200; static final int BORDER_BOTTOM = 2; static final int BORDER_TOP = 3; @@ -73,15 +73,15 @@ static final int BEZIER_LEFT = 30; static final int MIN_LEFT = 10; static int BORDER1 = SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW; - - + + /** * Constructs a new instance of this class given its parent * and a style value describing its behavior and appearance. * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -103,8 +103,9 @@ super(parent, checkStyle(style)); super.setLayout(new CBannerLayout()); resizeCursor = getDisplay().getSystemCursor(SWT.CURSOR_SIZEWE); - + listener = new Listener() { + @Override public void handleEvent(Event e) { switch (e.type) { case SWT.Dispose: @@ -166,14 +167,14 @@ //} /** * Returns the Control that appears on the bottom side of the banner. -* +* * @return the control that appears on the bottom side of the banner or null -* +* * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> -* +* * @since 3.0 */ public Control getBottom() { @@ -187,14 +188,14 @@ /** * Returns the Control that appears on the left side of the banner. -* +* * @return the control that appears on the left side of the banner or null -* +* * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> -* +* * @since 3.0 */ public Control getLeft() { @@ -204,14 +205,14 @@ /** * Returns the Control that appears on the right side of the banner. -* +* * @return the control that appears on the right side of the banner or null -* +* * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> -* +* * @since 3.0 */ public Control getRight() { @@ -220,9 +221,9 @@ } /** * Returns the minimum size of the control that appears on the right of the banner. - * + * * @return the minimum size of the control that appears on the right of the banner - * + * * @since 3.1 */ public Point getRightMinimumSize() { @@ -231,9 +232,9 @@ } /** * Returns the width of the control that appears on the right of the banner. - * + * * @return the width of the control that appears on the right of the banner - * + * * @since 3.0 */ public int getRightWidth() { @@ -248,9 +249,9 @@ /** * Returns <code>true</code> if the CBanner is rendered * with a simple, traditional shape. - * + * * @return <code>true</code> if the CBanner is rendered with a simple shape - * + * * @since 3.0 */ public boolean getSimple() { @@ -291,7 +292,7 @@ return; } if (curveRect.contains(x, y)) { - setCursor(resizeCursor); + setCursor(resizeCursor); } else { setCursor(null); } @@ -302,7 +303,7 @@ void onPaint(GC gc) { // Useful for debugging paint problems // { -// Point size = getSize(); +// Point size = getSize(); // gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_GREEN)); // gc.fillRectangle(-10, -10, size.x+20, size.y+20); // } @@ -328,14 +329,14 @@ line1[index++] = 0; line1[index++] = size.x; line1[index++] = 0; - + Color background = getBackground(); - + if (getDisplay().getDepth() >= 15) { // Anti- aliasing int[] line2 = new int[line1.length]; index = 0; - for (int i = 0; i < line1.length/2; i++) { + for (int i = 0; i < line1.length/2; i++) { line2[index] = line1[index++] - 1; line2[index] = line1[index++]; } @@ -355,7 +356,7 @@ gc.drawPolyline(line2); gc.drawPolyline(line3); color.dispose(); - + // draw tail fading to background int x1 = Math.max(0, curveStart - CURVE_TAIL); gc.setForeground(background); @@ -367,7 +368,7 @@ gc.setForeground(border1); gc.drawLine(x1, size.y - BORDER_STRIPE, curveStart+1, size.y - BORDER_STRIPE); } - + // draw border gc.setForeground(border1); gc.drawPolyline(line1); @@ -378,17 +379,17 @@ } /** * Set the control that appears on the bottom side of the banner. -* The bottom control is optional. Setting the bottom control to null will remove it from +* The bottom control is optional. Setting the bottom control to null will remove it from * the banner - however, the creator of the control must dispose of the control. -* +* * @param control the control to be displayed on the bottom or null -* +* * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * <li>ERROR_INVALID_ARGUMENT - if the bottom control was not created as a child of the receiver</li> * </ul> -* +* * @since 3.0 */ public void setBottom(Control control) { @@ -426,17 +427,17 @@ /** * Set the control that appears on the left side of the banner. -* The left control is optional. Setting the left control to null will remove it from +* The left control is optional. Setting the left control to null will remove it from * the banner - however, the creator of the control must dispose of the control. -* +* * @param control the control to be displayed on the left or null -* +* * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * <li>ERROR_INVALID_ARGUMENT - if the left control was not created as a child of the receiver</li> * </ul> -* +* * @since 3.0 */ public void setLeft(Control control) { @@ -453,17 +454,17 @@ } /** * Set the control that appears on the right side of the banner. -* The right control is optional. Setting the right control to null will remove it from +* The right control is optional. Setting the right control to null will remove it from * the banner - however, the creator of the control must dispose of the control. -* +* * @param control the control to be displayed on the right or null -* +* * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * <li>ERROR_INVALID_ARGUMENT - if the right control was not created as a child of the receiver</li> * </ul> -* +* * @since 3.0 */ public void setRight(Control control) { @@ -480,15 +481,15 @@ } /** * Set the minimum height of the control that appears on the right side of the banner. - * + * * @param size the minimum size of the control on the right - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * <li>ERROR_INVALID_ARGUMENT - if the size is null or the values of size are less than SWT.DEFAULT</li> * </ul> - * + * * @since 3.1 */ public void setRightMinimumSize(Point size) { @@ -500,15 +501,15 @@ } /** * Set the width of the control that appears on the right side of the banner. - * + * * @param width the width of the control on the right - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * <li>ERROR_INVALID_ARGUMENT - if width is less than SWT.DEFAULT</li> * </ul> - * + * * @since 3.0 */ public void setRightWidth(int width) { @@ -518,10 +519,10 @@ layout(false); } /** - * Sets the shape that the CBanner will use to render itself. - * + * Sets the shape that the CBanner will use to render itself. + * * @param simple <code>true</code> if the CBanner should render itself in a simple, traditional style - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/CBannerLayout.java swt4-gtk-4.6.0/org/eclipse/swt/custom/CBannerLayout.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/CBannerLayout.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/CBannerLayout.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,7 +16,7 @@ /** * This class provides the layout for CBanner - * + * * @see CBanner */ class CBannerLayout extends Layout { @@ -30,7 +30,7 @@ boolean showCurve = left != null && right != null; int height = hHint; int width = wHint; - + // Calculate component sizes Point bottomSize = new Point(0, 0); if (bottom != null) { @@ -60,7 +60,7 @@ int w = wHint == SWT.DEFAULT ? SWT.DEFAULT : Math.max(0, width - trim); leftSize = computeChildSize(left, w, SWT.DEFAULT, flushCache); } - + // Add up sizes width = leftSize.x + rightSize.x; height = bottomSize.y; @@ -80,10 +80,10 @@ width += banner.curve_width - 2*banner.curve_indent; height += CBanner.BORDER_TOP + CBanner.BORDER_BOTTOM + 2*CBanner.BORDER_STRIPE; } - + if (wHint != SWT.DEFAULT) width = wHint; if (hHint != SWT.DEFAULT) height = hHint; - + return new Point(width, height); } Point computeChildSize(Control control, int wHint, int hHint, boolean flushCache) { @@ -113,12 +113,12 @@ Control left = banner.left; Control right = banner.right; Control bottom = banner.bottom; - + Point size = banner.getSize(); boolean showCurve = left != null && right != null; int width = size.x - 2*banner.getBorderWidth(); int height = size.y - 2*banner.getBorderWidth(); - + Point bottomSize = new Point(0, 0); if (bottom != null) { int trim = computeTrim(bottom); @@ -140,7 +140,7 @@ w = Math.max(0, w); } rightSize = computeChildSize(right, w, SWT.DEFAULT, flushCache); - width = width - (rightSize.x - banner.curve_indent + banner.curve_width - banner.curve_indent); + width = width - (rightSize.x - banner.curve_indent + banner.curve_width - banner.curve_indent); } Point leftSize = new Point(0, 0); if (left != null) { @@ -179,7 +179,7 @@ /* * The paint events must be flushed in order to make the curve draw smoothly * while the user drags the divider. - * On Windows, it is necessary to flush the paints before the children are + * On Windows, it is necessary to flush the paints before the children are * resized because otherwise the children (particularly toolbars) will flash. */ banner.update(); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/CCombo.java swt4-gtk-4.6.0/org/eclipse/swt/custom/CCombo.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/CCombo.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/CCombo.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -26,7 +26,7 @@ * combo box. Specifically, on win32, the height of a CCombo can be set; * attempts to set the height of a Combo are ignored. CCombo can be used * anywhere that having the increased flexibility is more important than - * getting native L&F, but the decision should not be taken lightly. + * getting native L&F, but the decision should not be taken lightly. * There is no is no strict requirement that CCombo look or behave * the same as the native combo box. * </p> @@ -57,7 +57,7 @@ Color foreground, background; Font font; Shell _shell; - + static final String PACKAGE_PREFIX = "org.eclipse.swt.custom."; //$NON-NLS-1$ /** @@ -66,7 +66,7 @@ * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -91,7 +91,7 @@ public CCombo (Composite parent, int style) { super (parent, style = checkStyle (style)); _shell = super.getShell (); - + int textStyle = SWT.SINGLE; if ((style & SWT.READ_ONLY) != 0) textStyle |= SWT.READ_ONLY; if ((style & SWT.FLAT) != 0) textStyle |= SWT.FLAT; @@ -101,6 +101,7 @@ arrow = new Button (this, arrowStyle); listener = new Listener () { + @Override public void handleEvent (Event event) { if (isDisposed ()) return; if (popup == event.widget) { @@ -125,6 +126,7 @@ } if (getShell () == event.widget) { getDisplay().asyncExec(new Runnable() { + @Override public void run() { if (isDisposed ()) return; handleFocus (SWT.FocusOut); @@ -134,6 +136,7 @@ } }; filter = new Listener() { + @Override public void handleEvent(Event event) { if (isDisposed ()) return; if (event.type == SWT.Selection) { @@ -148,19 +151,19 @@ } } }; - + int [] comboEvents = {SWT.Dispose, SWT.FocusIn, SWT.Move, SWT.Resize}; for (int i=0; i<comboEvents.length; i++) this.addListener (comboEvents [i], listener); - + int [] textEvents = {SWT.DefaultSelection, SWT.DragDetect, SWT.KeyDown, SWT.KeyUp, SWT.MenuDetect, SWT.Modify, SWT.MouseDown, SWT.MouseUp, SWT.MouseDoubleClick, SWT.MouseEnter, SWT.MouseExit, SWT.MouseHover, SWT.MouseMove, SWT.MouseWheel, SWT.Traverse, SWT.FocusIn, SWT.Verify}; for (int i=0; i<textEvents.length; i++) text.addListener (textEvents [i], listener); - + int [] arrowEvents = {SWT.DragDetect, SWT.MouseDown, SWT.MouseEnter, SWT.MouseExit, SWT.MouseHover, SWT.MouseMove, SWT.MouseUp, SWT.MouseWheel, SWT.Selection, SWT.FocusIn}; for (int i=0; i<arrowEvents.length; i++) arrow.addListener (arrowEvents [i], listener); - + createPopup(null, -1); if ((style & SWT.SIMPLE) == 0) { int itemHeight = list.getItemHeight (); @@ -304,7 +307,7 @@ * * @see VerifyListener * @see #removeVerifyListener - * + * * @since 3.3 */ public void addVerifyListener (VerifyListener listener) { @@ -378,7 +381,7 @@ * text field is editable, this has the effect of placing the * i-beam at the start of the text. * <p> - * Note: To clear the selected items in the receiver's list, + * Note: To clear the selected items in the receiver's list, * use <code>deselectAll()</code>. * </p> * @@ -409,9 +412,9 @@ shell.removeListener (SWT.Deactivate, listener); Display display = getDisplay (); display.removeFilter (SWT.FocusIn, filter); - popup = null; - text = null; - list = null; + popup = null; + text = null; + list = null; arrow = null; _shell = null; break; @@ -449,7 +452,7 @@ Point arrowSize = arrow.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed); Point listSize = list.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed); int borderWidth = getBorderWidth (); - + height = Math.max (textSize.y, arrowSize.y); width = Math.max (textWidth + 2*spacer + arrowSize.x + 2*borderWidth, listSize.x); if (wHint != SWT.DEFAULT) width = wHint; @@ -466,14 +469,14 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.3 */ public void copy () { checkWidget (); text.copy (); } -void createPopup(String[] items, int selectionIndex) { +void createPopup(String[] items, int selectionIndex) { // create shell and list popup = new Shell (getShell (), SWT.NO_TRIM | SWT.ON_TOP); int style = getStyle (); @@ -505,7 +508,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.3 */ public void cut () { @@ -513,7 +516,7 @@ text.cut (); } /** - * Deselects the item at the given zero-relative index in the receiver's + * Deselects the item at the given zero-relative index in the receiver's * list. If the item at the index was already deselected, it remains * deselected. Indices that are out of range are ignored. * @@ -527,7 +530,7 @@ public void deselect (int index) { checkWidget (); if (0 <= index && index < list.getItemCount () && - index == list.getSelectionIndex() && + index == list.getSelectionIndex() && text.getText().equals(list.getItem(index))) { text.setText(""); //$NON-NLS-1$ list.deselect (index); @@ -573,7 +576,7 @@ list = null; createPopup (items, selectionIndex); } - + Point comboSize = getSize (); int itemCount = list.getItemCount (); itemCount = (itemCount == 0) ? visibleItemCount : Math.min(visibleItemCount, itemCount); @@ -581,7 +584,7 @@ Point listSize = list.computeSize (SWT.DEFAULT, itemHeight, false); Rectangle displayRect = getMonitor ().getClientArea (); list.setBounds (1, 1, Math.max (comboSize.x - 2, Math.min(listSize.x, displayRect.width - 2)), listSize.y); - + int index = list.getSelectionIndex (); if (index != -1) list.setTopIndex (index); Rectangle listRect = list.getBounds (); @@ -614,7 +617,7 @@ popup.setBounds (x, y, width, height - emptyHBarSpace); popup.setVisible (true); if (isFocusControl()) list.setFocus (); - + /* * Add a filter to listen to scrolling of the parent composite, when the * drop-down is visible. Remove the filter when drop-down is not @@ -640,9 +643,9 @@ } while (index < length); return '\0'; } -/* - * Return the Label immediately preceding the receiver in the z-order, - * or null if none. +/* + * Return the Label immediately preceding the receiver in the z-order, + * or null if none. */ String getAssociatedLabel () { Control[] siblings = getParent ().getChildren (); @@ -667,12 +670,12 @@ * Gets the editable state. * * @return whether or not the receiver is editable - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.0 */ public boolean getEditable () { @@ -730,11 +733,11 @@ } /** * Returns an array of <code>String</code>s which are the items - * in the receiver's list. + * in the receiver's list. * <p> * Note: This is not the actual structure used by the receiver * to maintain its list of items, so modifying the array will - * not affect the receiver. + * not affect the receiver. * </p> * * @return the items in the receiver's list @@ -764,7 +767,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.4 */ public boolean getListVisible () { @@ -824,7 +827,7 @@ public int getStyle () { int style = super.getStyle (); style &= ~SWT.READ_ONLY; - if (!text.getEditable()) style |= SWT.READ_ONLY; + if (!text.getEditable()) style |= SWT.READ_ONLY; return style; } /** @@ -861,9 +864,9 @@ * text field is capable of holding. If this has not been changed * by <code>setTextLimit()</code>, it will be the constant * <code>Combo.LIMIT</code>. - * + * * @return the text limit - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -883,7 +886,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.0 */ public int getVisibleItemCount () { @@ -929,7 +932,7 @@ } /** * Searches the receiver's list starting at the first item - * (index 0) until an item is found that is equal to the + * (index 0) until an item is found that is equal to the * argument, and returns the index of that item. If no item * is found, returns -1. * @@ -950,7 +953,7 @@ return list.indexOf (string); } /** - * Searches the receiver's list starting at the given, + * Searches the receiver's list starting at the given, * zero-relative index until an item is found that is equal * to the argument, and returns the index of that item. If * no item is found or the starting index is out of range, @@ -1005,7 +1008,7 @@ getAccessible ().addAccessibleListener (accessibleAdapter); text.getAccessible ().addAccessibleListener (accessibleAdapter); list.getAccessible ().addAccessibleListener (accessibleAdapter); - + arrow.getAccessible ().addAccessibleListener (new AccessibleAdapter() { @Override public void getName (AccessibleEvent e) { @@ -1033,7 +1036,7 @@ e.length = sel.y - sel.x; } }); - + getAccessible().addAccessibleControlListener (new AccessibleControlAdapter() { @Override public void getChildAtPoint (AccessibleControlEvent e) { @@ -1042,7 +1045,7 @@ e.childID = ACC.CHILDID_SELF; } } - + @Override public void getLocation (AccessibleControlEvent e) { Rectangle location = getBounds (); @@ -1052,17 +1055,17 @@ e.width = location.width; e.height = location.height; } - + @Override public void getChildCount (AccessibleControlEvent e) { e.detail = 0; } - + @Override public void getRole (AccessibleControlEvent e) { e.detail = ACC.ROLE_COMBOBOX; } - + @Override public void getState (AccessibleControlEvent e) { e.detail = ACC.STATE_NORMAL; @@ -1096,7 +1099,7 @@ checkWidget(); if (text.isFocusControl () || arrow.isFocusControl () || list.isFocusControl () || popup.isFocusControl ()) { return true; - } + } return super.isFocusControl (); } boolean isParentScrolling(Control scrollableParent) { @@ -1136,9 +1139,9 @@ /* * Behavior in Windows, GTK & Cocoa: When the arrow button is pressed * with the popup list visible, the following events are received- - * popup control receives a deactivate event, + * popup control receives a deactivate event, * list receives focus lost event, and then - * arrow button receives a selection event. + * arrow button receives a selection event. * If we hide the popup in the focus out event, the selection event will * show it again. To prevent the popup from showing again, we will detect * this case and let the selection event of the arrow button hide the popup. @@ -1200,7 +1203,7 @@ event.detail = e.detail; break; } - case SWT.KeyUp: { + case SWT.KeyUp: { Event e = new Event (); e.time = event.time; e.character = event.character; @@ -1212,7 +1215,7 @@ break; } case SWT.KeyDown: { - if (event.character == SWT.ESC) { + if (event.character == SWT.ESC) { // Escape key cancels popup list dropDown (false); } @@ -1239,7 +1242,7 @@ notifyListeners(SWT.KeyDown, e); event.doit = e.doit; break; - + } } } @@ -1254,7 +1257,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.3 */ public void paste () { @@ -1308,7 +1311,7 @@ } /** * Removes the items from the receiver's list which are - * between the given zero-relative start and end + * between the given zero-relative start and end * indices (inclusive). * * @param start the start of the range @@ -1328,7 +1331,7 @@ } /** * Searches the receiver's list starting at the first item - * until an item is found that is equal to the argument, + * until an item is found that is equal to the argument, * and removes that item from the list. * * @param string the item to remove @@ -1381,7 +1384,7 @@ public void removeModifyListener (ModifyListener listener) { checkWidget(); if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - removeListener(SWT.Modify, listener); + removeListener(SWT.Modify, listener); } /** * Removes the listener from the collection of listeners who will @@ -1404,7 +1407,7 @@ checkWidget(); if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); removeListener(SWT.Selection, listener); - removeListener(SWT.DefaultSelection,listener); + removeListener(SWT.DefaultSelection,listener); } /** * Removes the listener from the collection of listeners who will @@ -1422,7 +1425,7 @@ * * @see VerifyListener * @see #addVerifyListener - * + * * @since 3.3 */ public void removeVerifyListener (VerifyListener listener) { @@ -1431,7 +1434,7 @@ removeListener(SWT.Verify, listener); } /** - * Selects the item at the given zero-relative index in the receiver's + * Selects the item at the given zero-relative index in the receiver's * list. If the item at the index was already selected, it remains * selected. Indices that are out of range are ignored. * @@ -1475,7 +1478,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.0 */ public void setEditable (boolean editable) { @@ -1588,7 +1591,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.4 */ public void setListVisible (boolean visible) { @@ -1603,7 +1606,7 @@ * Sets the selection in the receiver's text field to the * range specified by the argument whose x coordinate is the * start of the selection and whose y coordinate is the end - * of the selection. + * of the selection. * * @param selection a point representing the new selection start and end * @@ -1628,7 +1631,7 @@ * Note: The text field in a <code>Combo</code> is typically * only capable of displaying a single line of text. Thus, * setting the text to a string containing line breaks or - * other special characters will probably cause it to + * other special characters will probably cause it to * display incorrectly. * </p><p> * Also note, if control characters like '\n', '\t' etc. are used @@ -1683,13 +1686,13 @@ checkWidget(); super.setToolTipText(string); arrow.setToolTipText (string); - text.setToolTipText (string); + text.setToolTipText (string); } @Override public void setVisible (boolean visible) { super.setVisible(visible); - /* + /* * At this point the widget may have been disposed in a FocusOut event. * If so then do not continue. */ @@ -1708,7 +1711,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.0 */ public void setVisibleItemCount (int count) { @@ -1790,8 +1793,8 @@ } if (isDisposed ()) break; } - - // Further work : Need to add support for incremental search in + + // Further work : Need to add support for incremental search in // pop up list as characters typed in text widget break; } @@ -1890,7 +1893,7 @@ } break; } - case SWT.Traverse: { + case SWT.Traverse: { switch (event.detail) { case SWT.TRAVERSE_ARROW_PREVIOUS: case SWT.TRAVERSE_ARROW_NEXT: @@ -1903,7 +1906,7 @@ event.doit = traverse(SWT.TRAVERSE_TAB_PREVIOUS); event.detail = SWT.TRAVERSE_NONE; return; - } + } Event e = new Event (); e.time = event.time; e.detail = event.detail; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/CLabel.java swt4-gtk-4.6.0/org/eclipse/swt/custom/CLabel.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/CLabel.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/CLabel.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -19,7 +19,7 @@ /** * A Label which supports aligned text and/or an image and different border styles. * <p> - * If there is not enough space a CLabel uses the following strategy to fit the + * If there is not enough space a CLabel uses the following strategy to fit the * information into the available space: * <pre> * ignores the indent in left align mode @@ -34,7 +34,7 @@ * <dt><b>Events:</b> * <dd></dd> * </dl> - * + * * </p><p> * This class may be subclassed for the purpose of overriding the default string * shortening algorithm that is implemented in method <code>shortenText()</code>. @@ -65,17 +65,17 @@ // The tooltip is used for two purposes - the application can set // a tooltip or the tooltip can be used to display the full text when the // the text has been truncated due to the label being too short. - // The appToolTip stores the tooltip set by the application. Control.tooltiptext + // The appToolTip stores the tooltip set by the application. Control.tooltiptext // contains whatever tooltip is currently being displayed. private String appToolTipText; private boolean ignoreDispose; - + private Image backgroundImage; private Color[] gradientColors; private int[] gradientPercents; private boolean gradientVertical; private Color background; - + private static int DRAW_FLAGS = SWT.DRAW_MNEMONIC | SWT.DRAW_TAB | SWT.DRAW_TRANSPARENT | SWT.DRAW_DELIMITER; /** @@ -84,7 +84,7 @@ * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -115,27 +115,30 @@ if ((style & SWT.CENTER) != 0) align = SWT.CENTER; if ((style & SWT.RIGHT) != 0) align = SWT.RIGHT; if ((style & SWT.LEFT) != 0) align = SWT.LEFT; - + addPaintListener(new PaintListener() { + @Override public void paintControl(PaintEvent event) { onPaint(event); } }); - + addTraverseListener(new TraverseListener() { + @Override public void keyTraversed(TraverseEvent event) { if (event.detail == SWT.TRAVERSE_MNEMONIC) { onMnemonic(event); } } }); - + addListener(SWT.Dispose, new Listener() { + @Override public void handleEvent(Event event) { onDispose(event); } }); - + initAccessible(); } @@ -172,7 +175,7 @@ gc.setForeground(bottomright); gc.drawLine(x+w, y, x+w, y+h); gc.drawLine(x, y+h, x+w, y+h); - + gc.setForeground(topleft); gc.drawLine(x, y, x+w-1, y); gc.drawLine(x, y, x, y+h-1); @@ -197,7 +200,7 @@ /** * Returns the horizontal alignment. * The alignment style (LEFT, CENTER or RIGHT) is returned. - * + * * @return SWT.LEFT, SWT.RIGHT or SWT.CENTER */ public int getAlignment() { @@ -206,9 +209,9 @@ } /** * Return the CLabel's bottom margin. - * + * * @return the bottom margin of the label - * + * * @since 3.6 */ public int getBottomMargin() { @@ -217,7 +220,7 @@ } /** * Return the CLabel's image or <code>null</code>. - * + * * @return the image of the label or null */ public Image getImage() { @@ -226,9 +229,9 @@ } /** * Return the CLabel's left margin. - * + * * @return the left margin of the label - * + * * @since 3.6 */ public int getLeftMargin() { @@ -237,9 +240,9 @@ } /** * Return the CLabel's right margin. - * + * * @return the right margin of the label - * + * * @since 3.6 */ public int getRightMargin() { @@ -257,7 +260,7 @@ size.x += r.width; size.y += r.height; } - + GC gc = new GC(this); if (text != null && text.length() > 0) { Point e = gc.textExtent(text, DRAW_FLAGS); @@ -268,7 +271,7 @@ size.y = Math.max(size.y, gc.getFontMetrics().getHeight()); } gc.dispose(); - + return size; } @Override @@ -284,7 +287,7 @@ /** * Return the Label's text. - * + * * @return the text of the label or null */ public String getText() { @@ -298,9 +301,9 @@ } /** * Return the CLabel's top margin. - * + * * @return the top margin of the label - * + * * @since 3.6 */ public int getTopMargin() { @@ -314,27 +317,27 @@ public void getName(AccessibleEvent e) { e.result = getText(); } - + @Override public void getHelp(AccessibleEvent e) { e.result = getToolTipText(); } - + @Override public void getKeyboardShortcut(AccessibleEvent e) { - char mnemonic = _findMnemonic(CLabel.this.text); + char mnemonic = _findMnemonic(CLabel.this.text); if (mnemonic != '\0') { e.result = "Alt+"+mnemonic; //$NON-NLS-1$ } } }); - + accessible.addAccessibleControlListener(new AccessibleControlAdapter() { @Override public void getChildAtPoint(AccessibleControlEvent e) { e.childID = ACC.CHILDID_SELF; } - + @Override public void getLocation(AccessibleControlEvent e) { Rectangle rect = getDisplay().map(getParent(), null, getBounds()); @@ -343,17 +346,17 @@ e.width = rect.width; e.height = rect.height; } - + @Override public void getChildCount(AccessibleControlEvent e) { e.detail = 0; } - + @Override public void getRole(AccessibleControlEvent e) { e.detail = ACC.ROLE_LABEL; } - + @Override public void getState(AccessibleControlEvent e) { e.detail = ACC.STATE_READONLY; @@ -403,7 +406,7 @@ void onPaint(PaintEvent event) { Rectangle rect = getClientArea(); if (rect.width == 0 || rect.height == 0) return; - + boolean shortenText = false; String t = text; Image img = image; @@ -416,10 +419,10 @@ shortenText = true; } } - + GC gc = event.gc; - String[] lines = text == null ? null : splitString(text); - + String[] lines = text == null ? null : splitString(text); + // shorten the text if (shortenText) { extent.x = 0; @@ -438,7 +441,7 @@ } else { super.setToolTipText(appToolTipText); } - + // determine horizontal position int x = rect.x + leftMargin; if (align == SWT.CENTER) { @@ -447,7 +450,7 @@ if (align == SWT.RIGHT) { x = rect.width - rightMargin - extent.x; } - + // draw a background image behind the text try { if (backgroundImage != null) { @@ -528,7 +531,7 @@ */ Rectangle imageRect = null; int lineHeight = 0, textHeight = 0, imageHeight = 0; - + if (img != null) { imageRect = img.getBounds(); imageHeight = imageRect.height; @@ -537,7 +540,7 @@ lineHeight = gc.getFontMetrics().getHeight(); textHeight = lines.length * lineHeight; } - + int imageY = 0, midPoint = 0, lineY = 0; if (imageHeight > textHeight ) { if (topMargin == DEFAULT_MARGIN && bottomMargin == DEFAULT_MARGIN) imageY = rect.y + (rect.height - imageHeight) / 2; @@ -551,15 +554,15 @@ midPoint = lineY + textHeight/2; imageY = midPoint - imageHeight / 2; } - + // draw the image if (img != null) { - gc.drawImage(img, 0, 0, imageRect.width, imageHeight, + gc.drawImage(img, 0, 0, imageRect.width, imageHeight, x, imageY, imageRect.width, imageHeight); x += imageRect.width + GAP; extent.x -= imageRect.width + GAP; } - + // draw the text if (lines != null) { gc.setForeground(getForeground()); @@ -588,17 +591,17 @@ Color c1 = null; Color c2 = null; - + int style = getStyle(); if ((style & SWT.SHADOW_IN) != 0) { c1 = disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW); c2 = disp.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW); } - if ((style & SWT.SHADOW_OUT) != 0) { + if ((style & SWT.SHADOW_OUT) != 0) { c1 = disp.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW); c2 = disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW); } - + if (c1 != null && c2 != null) { gc.setLineWidth(1); drawBevelRect(gc, r.x, r.y, r.width-1, r.height-1, c1, c2); @@ -607,9 +610,9 @@ /** * Set the horizontal alignment of the CLabel. * Use the values LEFT, CENTER and RIGHT to align image and text within the available space. - * + * * @param align the alignment style of LEFT, RIGHT or CENTER - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -631,14 +634,14 @@ public void setBackground (Color color) { super.setBackground (color); // Are these settings the same as before? - if (backgroundImage == null && - gradientColors == null && + if (backgroundImage == null && + gradientColors == null && gradientPercents == null) { if (color == null) { if (background == null) return; } else { if (color.equals(background)) return; - } + } } background = color; backgroundImage = null; @@ -650,24 +653,24 @@ /** * Specify a gradient of colours to be drawn in the background of the CLabel. * <p>For example, to draw a gradient that varies from dark blue to blue and then to - * white and stays white for the right half of the label, use the following call + * white and stays white for the right half of the label, use the following call * to setBackground:</p> * <pre> - * clabel.setBackground(new Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE), + * clabel.setBackground(new Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE), * display.getSystemColor(SWT.COLOR_BLUE), - * display.getSystemColor(SWT.COLOR_WHITE), + * display.getSystemColor(SWT.COLOR_WHITE), * display.getSystemColor(SWT.COLOR_WHITE)}, * new int[] {25, 50, 100}); * </pre> * - * @param colors an array of Color that specifies the colors to appear in the gradient - * in order of appearance from left to right; The value <code>null</code> - * clears the background gradient; the value <code>null</code> can be used + * @param colors an array of Color that specifies the colors to appear in the gradient + * in order of appearance from left to right; The value <code>null</code> + * clears the background gradient; the value <code>null</code> can be used * inside the array of Color to specify the background color. - * @param percents an array of integers between 0 and 100 specifying the percent of the width - * of the widget at which the color should change; the size of the percents + * @param percents an array of integers between 0 and 100 specifying the percent of the width + * of the widget at which the color should change; the size of the percents * array must be one less than the size of the colors array. - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -680,32 +683,32 @@ /** * Specify a gradient of colours to be drawn in the background of the CLabel. * <p>For example, to draw a gradient that varies from dark blue to white in the vertical, - * direction use the following call + * direction use the following call * to setBackground:</p> * <pre> - * clabel.setBackground(new Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE), + * clabel.setBackground(new Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE), * display.getSystemColor(SWT.COLOR_WHITE)}, * new int[] {100}, true); * </pre> * - * @param colors an array of Color that specifies the colors to appear in the gradient - * in order of appearance from left/top to right/bottom; The value <code>null</code> - * clears the background gradient; the value <code>null</code> can be used + * @param colors an array of Color that specifies the colors to appear in the gradient + * in order of appearance from left/top to right/bottom; The value <code>null</code> + * clears the background gradient; the value <code>null</code> can be used * inside the array of Color to specify the background color. - * @param percents an array of integers between 0 and 100 specifying the percent of the width/height - * of the widget at which the color should change; the size of the percents + * @param percents an array of integers between 0 and 100 specifying the percent of the width/height + * of the widget at which the color should change; the size of the percents * array must be one less than the size of the colors array. * @param vertical indicate the direction of the gradient. True is vertical and false is horizontal. - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * <li>ERROR_INVALID_ARGUMENT - if the values of colors and percents are not consistent</li> * </ul> - * + * * @since 3.0 */ -public void setBackground(Color[] colors, int[] percents, boolean vertical) { +public void setBackground(Color[] colors, int[] percents, boolean vertical) { checkWidget(); if (colors != null) { if (percents == null || percents.length != colors.length - 1) { @@ -725,11 +728,11 @@ } } } - + // Are these settings the same as before? final Color background = getBackground(); if (backgroundImage == null) { - if ((gradientColors != null) && (colors != null) && + if ((gradientColors != null) && (colors != null) && (gradientColors.length == colors.length)) { boolean same = false; for (int i = 0; i < gradientColors.length; i++) { @@ -768,9 +771,9 @@ } /** * Set the image to be drawn in the background of the label. - * + * * @param image the image to be drawn in the background - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -785,18 +788,18 @@ } backgroundImage = image; redraw(); - + } /** * Set the label's bottom margin, in pixels. - * + * * @param bottomMargin the bottom margin of the label, which must be equal to or greater than zero - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.6 */ public void setBottomMargin(int bottomMargin) { @@ -813,9 +816,9 @@ /** * Set the label's Image. * The value <code>null</code> clears it. - * + * * @param image the image to be displayed in the label or null - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -830,14 +833,14 @@ } /** * Set the label's horizontal left margin, in pixels. - * + * * @param leftMargin the left margin of the label, which must be equal to or greater than zero - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.6 */ public void setLeftMargin(int leftMargin) { @@ -846,9 +849,9 @@ this.leftMargin = leftMargin; redraw(); } -/** +/** * Set the label's margins, in pixels. - * + * * @param leftMargin the left margin. * @param topMargin the top margin. * @param rightMargin the right margin. @@ -857,7 +860,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.6 */ public void setMargins (int leftMargin, int topMargin, int rightMargin, int bottomMargin) { @@ -870,14 +873,14 @@ } /** * Set the label's right margin, in pixels. - * + * * @param rightMargin the right margin of the label, which must be equal to or greater than zero - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.6 */ public void setRightMargin(int rightMargin) { @@ -902,9 +905,9 @@ * Note: If control characters like '\n', '\t' etc. are used * in the string, then the behavior is platform dependent. * </p> - * + * * @param text the text to be displayed in the label or null - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -925,14 +928,14 @@ } /** * Set the label's top margin, in pixels. - * + * * @param topMargin the top margin of the label, which must be equal to or greater than zero - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.6 */ public void setTopMargin(int topMargin) { @@ -946,7 +949,7 @@ * the given width. The default implementation replaces characters in the * center of the original string with an ellipsis ("..."). * Override if you need a different strategy. - * + * * @param gc the gc to use for text measurement * @param t the text to shorten * @param width the width to shorten the text to, in pixels @@ -970,7 +973,7 @@ int l1 = gc.textExtent(s1, DRAW_FLAGS).x; int l2 = gc.textExtent(s2, DRAW_FLAGS).x; if (l1+w+l2 > width) { - max = mid; + max = mid; mid = validateOffset(layout, (max+min)/2); } else if (l1+w+l2 < width) { min = mid; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/CLayoutData.java swt4-gtk-4.6.0/org/eclipse/swt/custom/CLayoutData.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/CLayoutData.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/CLayoutData.java 2016-07-06 19:11:33.000000000 +0000 @@ -18,7 +18,7 @@ int defaultWidth = -1, defaultHeight = -1; int currentWhint, currentHhint, currentWidth = -1, currentHeight = -1; - + Point computeSize (Control control, int wHint, int hHint, boolean flushCache) { if (flushCache) flushCache(); if (wHint == SWT.DEFAULT && hHint == SWT.DEFAULT) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/ControlEditor.java swt4-gtk-4.6.0/org/eclipse/swt/custom/ControlEditor.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/ControlEditor.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/ControlEditor.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -18,21 +18,21 @@ /** * * A ControlEditor is a manager for a Control that appears above a composite and tracks with the -* moving and resizing of that composite. It can be used to display one control above -* another control. This could be used when editing a control that does not have editing -* capabilities by using a text editor or for launching a dialog by placing a button +* moving and resizing of that composite. It can be used to display one control above +* another control. This could be used when editing a control that does not have editing +* capabilities by using a text editor or for launching a dialog by placing a button * above a control. * * <p> Here is an example of using a ControlEditor: * * <code><pre> * Canvas canvas = new Canvas(shell, SWT.BORDER); -* canvas.setBounds(10, 10, 300, 300); +* canvas.setBounds(10, 10, 300, 300); * Color color = new Color(null, 255, 0, 0); * canvas.setBackground(color); * ControlEditor editor = new ControlEditor (canvas); * // The editor will be a button in the bottom right corner of the canvas. -* // When selected, it will launch a Color dialog that will change the background +* // When selected, it will launch a Color dialog that will change the background * // of the canvas. * Button button = new Button(canvas, SWT.PUSH); * button.setText("Select Color..."); @@ -46,7 +46,7 @@ * color = new Color(null, rgb); * canvas.setBackground(color); * } -* +* * } * }); * @@ -69,37 +69,37 @@ * are SWT.LEFT, SWT.RIGHT and SWT.CENTER. The default value is SWT.CENTER. */ public int horizontalAlignment = SWT.CENTER; - + /** * Specifies whether the editor should be sized to use the entire width of the control. - * True means resize the editor to the same width as the cell. False means do not adjust + * True means resize the editor to the same width as the cell. False means do not adjust * the width of the editor. The default value is false. */ public boolean grabHorizontal = false; - + /** * Specifies the minimum width the editor can have. This is used in association with - * a true value of grabHorizontal. If the cell becomes smaller than the minimumWidth, the + * a true value of grabHorizontal. If the cell becomes smaller than the minimumWidth, the * editor will not made smaller than the minimum width value. The default value is 0. */ public int minimumWidth = 0; - + /** * Specifies how the editor should be aligned relative to the control. Allowed values * are SWT.TOP, SWT.BOTTOM and SWT.CENTER. The default value is SWT.CENTER. */ public int verticalAlignment = SWT.CENTER; - + /** * Specifies whether the editor should be sized to use the entire height of the control. - * True means resize the editor to the same height as the underlying control. False means do not adjust + * True means resize the editor to the same height as the underlying control. False means do not adjust * the height of the editor. The default value is false. */ public boolean grabVertical = false; - + /** * Specifies the minimum height the editor can have. This is used in association with - * a true value of grabVertical. If the control becomes smaller than the minimumHeight, the + * a true value of grabVertical. If the control becomes smaller than the minimumHeight, the * editor will not made smaller than the minimum height value. The default value is 0. */ public int minimumHeight = 0; @@ -109,7 +109,7 @@ private boolean hadFocus; private Listener controlListener; private Listener scrollbarListener; - + private final static int [] EVENTS = {SWT.KeyDown, SWT.KeyUp, SWT.MouseDown, SWT.MouseUp, SWT.Resize}; /** * Creates a ControlEditor for the specified Composite. @@ -121,6 +121,7 @@ this.parent = parent; controlListener = new Listener() { + @Override public void handleEvent(Event e) { layout (); } @@ -128,12 +129,13 @@ for (int i=0; i<EVENTS.length; i++) { parent.addListener (EVENTS [i], controlListener); } - + scrollbarListener = new Listener() { + @Override public void handleEvent(Event e) { scroll (e); } - }; + }; ScrollBar hBar = parent.getHorizontalBar (); if (hBar != null) hBar.addListener (SWT.Selection, scrollbarListener); ScrollBar vBar = parent.getVerticalBar (); @@ -142,10 +144,10 @@ Rectangle computeBounds () { Rectangle clientArea = parent.getClientArea(); Rectangle editorRect = new Rectangle(clientArea.x, clientArea.y, minimumWidth, minimumHeight); - + if (grabHorizontal) editorRect.width = Math.max(clientArea.width, minimumWidth); - + if (grabVertical) editorRect.height = Math.max(clientArea.height, minimumHeight); @@ -160,7 +162,7 @@ // default is CENTER editorRect.x += (clientArea.width - editorRect.width)/2; } - + switch (verticalAlignment) { case SWT.BOTTOM: editorRect.y += clientArea.height - editorRect.height; @@ -173,7 +175,7 @@ editorRect.y += (clientArea.height - editorRect.height)/2; } - + return editorRect; } @@ -191,7 +193,7 @@ ScrollBar vBar = parent.getVerticalBar (); if (vBar != null) vBar.removeListener (SWT.Selection, scrollbarListener); } - + parent = null; editor = null; hadFocus = false; @@ -210,7 +212,7 @@ * Lays out the control within the underlying composite. This * method should be called after changing one or more fields to * force the Editor to resize. - * + * * @since 2.1 */ public void layout () { @@ -233,20 +235,20 @@ /** * Specify the Control that is to be displayed. * -* <p>Note: The Control provided as the editor <b>must</b> be created with its parent +* <p>Note: The Control provided as the editor <b>must</b> be created with its parent * being the Composite specified in the ControlEditor constructor. -* +* * @param editor the Control that is displayed above the composite being edited */ public void setEditor (Control editor) { - + if (editor == null) { // this is the case where the caller is setting the editor to be blank // set all the values accordingly this.editor = null; return; } - + this.editor = editor; layout(); if (this.editor == null || this.editor.isDisposed()) return; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/CTabFolder2Adapter.java swt4-gtk-4.6.0/org/eclipse/swt/custom/CTabFolder2Adapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/CTabFolder2Adapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/CTabFolder2Adapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -22,22 +22,23 @@ * @see CTabFolder2Listener * @see CTabFolderEvent * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.0 */ public class CTabFolder2Adapter implements CTabFolder2Listener { - + /** * Sent when the user clicks on the close button of an item in the CTabFolder. The item being closed is specified - * in the event.item field. Setting the event.doit field to false will stop the CTabItem from closing. - * When the CTabItem is closed, it is disposed. The contents of the CTabItem (see CTabItem#setControl) will be + * in the event.item field. Setting the event.doit field to false will stop the CTabItem from closing. + * When the CTabItem is closed, it is disposed. The contents of the CTabItem (see CTabItem#setControl) will be * made not visible when the CTabItem is closed. * <p> * The default behaviour is to close the CTabItem. * </p> - * + * * @param event an event indicating the item being closed */ +@Override public void close(CTabFolderEvent event){} /** @@ -45,9 +46,10 @@ * <p> * The default behaviour is to do nothing. * </p> - * + * * @param event an event containing information about the minimize */ +@Override public void minimize(CTabFolderEvent event){} /** @@ -55,9 +57,10 @@ * <p> * The default behaviour is to do nothing. * </p> - * + * * @param event an event containing information about the maximize */ +@Override public void maximize(CTabFolderEvent event){} /** @@ -65,19 +68,21 @@ * <p> * The default behaviour is to do nothing. * </p> - * + * * @param event an event containing information about the restore */ +@Override public void restore(CTabFolderEvent event){} /** * Sent when the user clicks on the chevron button of a CTabFolder. * <p> - * The default behaviour is to show a list of items that are not currently + * The default behaviour is to show a list of items that are not currently * visible and to change the selection based on the item selected from the list. * </p> - * + * * @param event an event containing information about the show list */ +@Override public void showList(CTabFolderEvent event){} } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/CTabFolder2Listener.java swt4-gtk-4.6.0/org/eclipse/swt/custom/CTabFolder2Listener.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/CTabFolder2Listener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/CTabFolder2Listener.java 2016-07-06 19:11:33.000000000 +0000 @@ -14,7 +14,7 @@ /** * Classes which implement this interface provide methods - * that deal with the events that are generated by the CTabFolder + * that deal with the events that are generated by the CTabFolder * control. * <p> * After creating an instance of a class that implements @@ -27,31 +27,31 @@ * * @see CTabFolder2Adapter * @see CTabFolderEvent - * + * * @since 3.0 */ public interface CTabFolder2Listener extends SWTEventListener { - + /** * Sent when the user clicks on the close button of an item in the CTabFolder. - * The item being closed is specified in the event.item field. - * Setting the event.doit field to false will stop the CTabItem from closing. - * When the CTabItem is closed, it is disposed. The contents of the + * The item being closed is specified in the event.item field. + * Setting the event.doit field to false will stop the CTabItem from closing. + * When the CTabItem is closed, it is disposed. The contents of the * CTabItem (see CTabItem.setControl) will be made not visible when * the CTabItem is closed. - * + * * @param event an event indicating the item being closed */ public void close(CTabFolderEvent event); /** * Sent when the user clicks on the minimize button of a CTabFolder. - * The state of the CTabFolder does not change automatically - it + * The state of the CTabFolder does not change automatically - it * is up to the application to change the state of the CTabFolder * in response to this event using CTabFolder.setMinimized(true). - * + * * @param event an event containing information about the minimize - * + * * @see CTabFolder#getMinimized() * @see CTabFolder#setMinimized(boolean) * @see CTabFolder#setMinimizeVisible(boolean) @@ -60,12 +60,12 @@ /** * Sent when the user clicks on the maximize button of a CTabFolder. - * The state of the CTabFolder does not change automatically - it + * The state of the CTabFolder does not change automatically - it * is up to the application to change the state of the CTabFolder * in response to this event using CTabFolder.setMaximized(true). - * + * * @param event an event containing information about the maximize - * + * * @see CTabFolder#getMaximized() * @see CTabFolder#setMaximized(boolean) * @see CTabFolder#setMaximizeVisible(boolean) @@ -74,17 +74,17 @@ /** * Sent when the user clicks on the restore button of a CTabFolder. - * This event is sent either to restore the CTabFolder from the + * This event is sent either to restore the CTabFolder from the * minimized state or from the maximized state. To determine * which restore is requested, use CTabFolder.getMinimized() or * CTabFolder.getMaximized() to determine the current state. - * The state of the CTabFolder does not change automatically - it + * The state of the CTabFolder does not change automatically - it * is up to the application to change the state of the CTabFolder * in response to this event using CTabFolder.setMaximized(false) * or CTabFolder.setMinimized(false). - * + * * @param event an event containing information about the restore - * + * * @see CTabFolder#getMinimized() * @see CTabFolder#getMaximized() * @see CTabFolder#setMinimized(boolean) @@ -96,16 +96,16 @@ /** * Sent when the user clicks on the chevron button of the CTabFolder. - * A chevron appears in the CTabFolder when there are more tabs - * than can be displayed at the current widget size. To select a + * A chevron appears in the CTabFolder when there are more tabs + * than can be displayed at the current widget size. To select a * tab that is not currently visible, the user clicks on the * chevron and selects a tab item from a list. By default, the * CTabFolder provides a list of all the items that are not currently - * visible, however, the application can provide its own list by setting + * visible, however, the application can provide its own list by setting * the event.doit field to <code>false</code> and displaying a selection list. - * - * @param event an event containing information about the show list - * + * + * @param event an event containing information about the show list + * * @see CTabFolder#setSelection(CTabItem) */ public void showList(CTabFolderEvent event); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/CTabFolderAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/custom/CTabFolderAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/CTabFolderAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/CTabFolderAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -14,11 +14,12 @@ /** * This adapter class provides a default implementation for the * method described by the <code>CTabFolderListener</code> interface. - * + * * @see CTabFolderListener * @see CTabFolderEvent * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public class CTabFolderAdapter implements CTabFolderListener { + @Override public void itemClosed(CTabFolderEvent event){} } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/CTabFolderEvent.java swt4-gtk-4.6.0/org/eclipse/swt/custom/CTabFolderEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/CTabFolderEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/CTabFolderEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -17,7 +17,7 @@ /** * This event is sent when an event is generated in the CTabFolder. * - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> + * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public class CTabFolderEvent extends TypedEvent { /** @@ -35,34 +35,34 @@ /** * The widget-relative, x coordinate of the chevron button * at the time of the event. Applies to the showList event. - * + * * @since 3.0 */ public int x; /** * The widget-relative, y coordinate of the chevron button * at the time of the event. Applies to the showList event. - * + * * @since 3.0 */ public int y; /** * The width of the chevron button at the time of the event. * Applies to the showList event. - * + * * @since 3.0 */ public int width; /** * The height of the chevron button at the time of the event. * Applies to the showList event. - * + * * @since 3.0 */ public int height; static final long serialVersionUID = 3760566386225066807L; - + /** * Constructs a new instance of this class. * diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/CTabFolder.java swt4-gtk-4.6.0/org/eclipse/swt/custom/CTabFolder.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/CTabFolder.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/CTabFolder.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -14,10 +14,12 @@ import org.eclipse.swt.accessibility.*; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.*; +import org.eclipse.swt.internal.DPIUtil.*; import org.eclipse.swt.widgets.*; /** - * + * * Instances of this class implement the notebook user interface * metaphor. It allows the user to select a notebook page from * set of pages. @@ -38,7 +40,7 @@ * <dd>"CTabFolder2"</dd> * </dl> * <p> - * Note: Only one of the styles TOP and BOTTOM + * Note: Only one of the styles TOP and BOTTOM * may be specified. * </p><p> * IMPORTANT: This class is <em>not</em> intended to be subclassed. @@ -49,9 +51,9 @@ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> * @noextend This class is not intended to be subclassed by clients. */ - + public class CTabFolder extends Composite { - + /** * marginWidth specifies the number of pixels of horizontal margin * that will be placed along the left and right edges of the form. @@ -66,49 +68,49 @@ * The default value is 0. */ public int marginHeight = 0; - + /** - * A multiple of the tab height that specifies the minimum width to which a tab + * A multiple of the tab height that specifies the minimum width to which a tab * will be compressed before scrolling arrows are used to navigate the tabs. - * + * * NOTE This field is badly named and can not be fixed for backwards compatibility. * It should not be capitalized. - * + * * @deprecated This field is no longer used. See setMinimumCharacters(int) */ @Deprecated public int MIN_TAB_WIDTH = 4; - + /** * Color of innermost line of drop shadow border. - * + * * NOTE This field is badly named and can not be fixed for backwards compatibility. * It should be capitalized. - * + * * @deprecated drop shadow border is no longer drawn in 3.0 */ @Deprecated public static RGB borderInsideRGB = new RGB (132, 130, 132); /** * Color of middle line of drop shadow border. - * + * * NOTE This field is badly named and can not be fixed for backwards compatibility. * It should be capitalized. - * + * * @deprecated drop shadow border is no longer drawn in 3.0 */ @Deprecated public static RGB borderMiddleRGB = new RGB (143, 141, 138); /** * Color of outermost line of drop shadow border. - * + * * NOTE This field is badly named and can not be fixed for backwards compatibility. * It should be capitalized. - * + * * @deprecated drop shadow border is no longer drawn in 3.0 */ @Deprecated - public static RGB borderOutsideRGB = new RGB (171, 168, 165); + public static RGB borderOutsideRGB = new RGB (171, 168, 165); /* sizing, positioning */ boolean onBottom = false; @@ -118,7 +120,7 @@ int tabHeight; int minChars = 20; boolean borderVisible = false; - + /* item management */ CTabFolderRenderer renderer; CTabItem items[] = new CTabItem[0]; @@ -172,12 +174,12 @@ Listener listener; boolean ignoreTraverse; boolean useDefaultRenderer; - + /* External Listener management */ CTabFolder2Listener[] folderListeners = new CTabFolder2Listener[0]; // support for deprecated listener mechanism CTabFolderListener[] tabListeners = new CTabFolderListener[0]; - + /* Selected item appearance */ Image selectionBgImage; Color[] selectionGradientColors; @@ -185,17 +187,17 @@ boolean selectionGradientVertical; Color selectionForeground; Color selectionBackground; - + /* Unselected item appearance */ - Color[] gradientColors; + Color[] gradientColors; int[] gradientPercents; boolean gradientVertical; boolean showUnselectedImage = true; - + // close, min/max and chevron buttons boolean showClose = false; boolean showUnselectedClose = true; - + boolean showMin = false; boolean minimized = false; boolean showMax = false; @@ -209,14 +211,14 @@ Rectangle hoverRect = new Rectangle(0,0,0,0); boolean hovering; boolean hoverTimerRunning; - + boolean showChevron = false; Menu showMenu; ToolBar chevronTb; ToolItem chevronItem; int chevronCount; boolean chevronVisible = true; - + Image chevronImage; Control topRight; int topRightAlignment = SWT.RIGHT; @@ -225,14 +227,14 @@ int[] controlAlignments; Rectangle[] controlRects; Image[] controlBkImages; - + int updateFlags; final static int REDRAW = 1 << 1; final static int REDRAW_TABS = 1 << 2; final static int UPDATE_TAB_HEIGHT = 1 << 3; Runnable updateRun; - - // when disposing CTabFolder, don't try to layout the items or + + // when disposing CTabFolder, don't try to layout the items or // change the selection as each child is destroyed. boolean inDispose = false; @@ -240,17 +242,17 @@ // on Resize Point oldSize; Font oldFont; - + // internal constants static final int DEFAULT_WIDTH = 64; static final int DEFAULT_HEIGHT = 64; - + static final int SELECTION_FOREGROUND = SWT.COLOR_LIST_FOREGROUND; static final int SELECTION_BACKGROUND = SWT.COLOR_LIST_BACKGROUND; - + static final int FOREGROUND = SWT.COLOR_WIDGET_FOREGROUND; static final int BACKGROUND = SWT.COLOR_WIDGET_BACKGROUND; - + //TODO: add setter for spacing? static final int SPACING = 3; static final boolean IS_GTK; @@ -264,7 +266,7 @@ * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -315,9 +317,10 @@ controlRects = new Rectangle[0]; controlBkImages = new Image[0]; updateTabHeight(false); - + // Add all listeners listener = new Listener() { + @Override public void handleEvent(Event event) { switch (event.type) { case SWT.Dispose: onDispose(event); break; @@ -344,25 +347,25 @@ int[] folderEvents = new int[]{ SWT.Dispose, SWT.DragDetect, - SWT.FocusIn, - SWT.FocusOut, + SWT.FocusIn, + SWT.FocusOut, SWT.KeyDown, SWT.MenuDetect, - SWT.MouseDoubleClick, + SWT.MouseDoubleClick, SWT.MouseDown, - SWT.MouseEnter, - SWT.MouseExit, + SWT.MouseEnter, + SWT.MouseExit, SWT.MouseHover, SWT.MouseMove, SWT.MouseUp, SWT.Paint, - SWT.Resize, + SWT.Resize, SWT.Traverse, }; for (int i = 0; i < folderEvents.length; i++) { addListener(folderEvents[i], listener); } - + initAccessible(); } static int checkStyle (Composite parent, int style) { @@ -376,25 +379,25 @@ if ((style & SWT.MULTI) != 0) style = style & ~SWT.SINGLE; // reduce the flash by not redrawing the entire area on a Resize event style |= SWT.NO_REDRAW_RESIZE; - + //TEMPORARY CODE /* - * In Right To Left orientation on Windows, all GC calls that use a brush are drawing + * In Right To Left orientation on Windows, all GC calls that use a brush are drawing * offset by one pixel. This results in some parts of the CTabFolder not drawing correctly. * To alleviate some of the appearance problems, allow the OS to draw the background. * This does not draw correctly but the result is less obviously wrong. */ if ((style & SWT.RIGHT_TO_LEFT) != 0) return style; if ((parent.getStyle() & SWT.MIRRORED) != 0 && (style & SWT.LEFT_TO_RIGHT) == 0) return style; - + return style | SWT.DOUBLE_BUFFERED; } /** - * + * * Adds the listener to the collection of listeners who will * be notified when a tab item is closed, minimized, maximized, - * restored, or to show the list of items that are not + * restored, or to show the list of items that are not * currently visible. * * @param listener the listener which should be notified @@ -402,7 +405,7 @@ * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> - * + * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> @@ -410,7 +413,7 @@ * * @see CTabFolder2Listener * @see #removeCTabFolder2Listener(CTabFolder2Listener) - * + * * @since 3.0 */ public void addCTabFolder2Listener(CTabFolder2Listener listener) { @@ -438,7 +441,7 @@ * * @see CTabFolderListener * @see #removeCTabFolderListener(CTabFolderListener) - * + * * @deprecated use addCTabFolder2Listener(CTabFolder2Listener) */ @Deprecated @@ -456,7 +459,7 @@ updateFolder(REDRAW); } } -/** +/** * Adds the listener to the collection of listeners who will * be notified when the user changes the receiver's selection, by sending * it one of the messages defined in the <code>SelectionListener</code> @@ -532,7 +535,7 @@ for (int i = 0; i < items.length; i++) { if (items[i].showing) itemWidth += items[i].width; } - + int maxWidth = size.x - borderLeft - leftWidth - borderRight; int availableWidth = Math.max(0, maxWidth - itemWidth - rightWidth); if (rightWidth > 0) availableWidth -= SPACING * 2; @@ -548,14 +551,17 @@ rects[i].height = getControlHeight(ctrlSize); rects[i].x = x; rects[i].y = getControlY(size, rects, borderBottom, borderTop, i); - if ((alignment & (SWT.FILL | SWT.WRAP)) != 0) availableWidth -= ctrlSize.x; + if ((alignment & (SWT.FILL | SWT.WRAP)) != 0) availableWidth -= ctrlSize.x; + } + if (tabControlSize[i].y >= tabHeight) { + overflow[i] = true; } } } else { for (int i = 0; i < controls.length; i++) { int alignment = controlAlignments[i]; Point ctrlSize = tabControlSize[i]; - if ((alignment & SWT.TRAIL) != 0) { + if ((alignment & SWT.TRAIL) != 0) { if ((alignment & (SWT.FILL | SWT.WRAP)) == 0) { x -= ctrlSize.x; rects[i].width = ctrlSize.x; @@ -582,7 +588,7 @@ } } } - + //Any space, distribute amongst FILL if (availableWidth > 0) { int fillCount = 0; @@ -609,7 +615,7 @@ } } } - + //Go through overflow laying out all wrapped controls Rectangle bodyTrim = renderer.computeTrim(CTabFolderRenderer.PART_BODY, SWT.NONE, 0, 0, 0, 0); int bodyRight = bodyTrim.width + bodyTrim.x; @@ -635,7 +641,7 @@ y += maxHeight; maxHeight = 0; availableWidth = bodyWidth; - if (availableWidth > ctrlSize.x) { + if (availableWidth > ctrlSize.x) { //Relayout this control in the next line i--; } else { @@ -649,7 +655,7 @@ } } } - + if (showChevron) { int i = 0, lastIndex = -1; while (i < priority.length && items[priority[i]].showing) { @@ -663,7 +669,7 @@ rects[controls.length - 1].x = w; } } - + if (position != null) position[0] = overflow; return rects; } @@ -715,10 +721,10 @@ renderer.draw(button, SWT.NONE, new Rectangle(trim.x, trim.y, size.x, size.y), gc); gc.dispose (); transColor.dispose(); - ImageData imageData = image.getImageData(); + final ImageData imageData = image.getImageDataAtCurrentZoom(); imageData.transparentPixel = imageData.palette.getPixel(transparent); image.dispose(); - image = new Image(display, imageData); + image = new Image(display, new AutoScaleImageDataProvider(display, imageData, DPIUtil.getDeviceZoom())); return image; } void createItem (CTabItem item, int index) { @@ -729,7 +735,7 @@ newItems[index] = item; System.arraycopy(items, index, newItems, index + 1, items.length - index); items = newItems; - if (selectedIndex >= index) selectedIndex ++; + if (selectedIndex >= index) selectedIndex ++; int[] newPriority = new int[priority.length + 1]; int next = 0, priorityIndex = priority.length; for (int i = 0; i < priority.length; i++) { @@ -740,7 +746,7 @@ } newPriority[priorityIndex] = index; priority = newPriority; - + if (items.length == 1) { updateFolder(UPDATE_TAB_HEIGHT | REDRAW); } else { @@ -751,13 +757,13 @@ if (inDispose) return; int index = indexOf(item); if (index == -1) return; - + if (items.length == 1) { items = new CTabItem[0]; priority = new int[0]; firstIndex = -1; selectedIndex = -1; - + Control control = item.control; if (control != null && !control.isDisposed()) { control.setVisible(false); @@ -768,21 +774,21 @@ gc.dispose(); redraw(); return; - } - + } + CTabItem[] newItems = new CTabItem [items.length - 1]; System.arraycopy(items, 0, newItems, 0, index); System.arraycopy(items, index + 1, newItems, index, items.length - index - 1); items = newItems; - + int[] newPriority = new int[priority.length - 1]; int next = 0; for (int i = 0; i < priority.length; i++) { - if (priority [i] == index) continue; + if (priority [i] == index) continue; newPriority[next++] = priority[i] > index ? priority[i] - 1 : priority [i]; } priority = newPriority; - + // move the selection if this item is selected if (selectedIndex == index) { Control control = item.getControl(); @@ -795,7 +801,7 @@ } else if (selectedIndex > index) { selectedIndex --; } - + updateFolder(UPDATE_TAB_HEIGHT | REDRAW_TABS); } @@ -808,7 +814,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.0 */ public boolean getBorderVisible() { @@ -838,7 +844,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * */ /*public*/ boolean getChevronVisible() { checkWidget(); @@ -865,10 +871,10 @@ /** * Return the tab that is located at the specified index. - * + * * @param index the index of the tab item * @return the item at the specified index - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE - if the index is out of range</li> * </ul> @@ -879,7 +885,7 @@ */ public CTabItem getItem (int index) { //checkWidget(); - if (index < 0 || index >= items.length) + if (index < 0 || index >= items.length) SWT.error(SWT.ERROR_INVALID_RANGE); return items [index]; } @@ -888,7 +894,7 @@ * * @param pt the point in coordinates relative to the CTabFolder * @return the item at a point or null - * + * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> @@ -910,9 +916,9 @@ } /** * Return the number of tabs in the folder. - * + * * @return the number of tabs in the folder - * + * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> @@ -924,9 +930,9 @@ } /** * Return the tab items. - * + * * @return the tab items - * + * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> @@ -940,11 +946,11 @@ } int getLeftItemEdge (GC gc, int part){ Rectangle trim = renderer.computeTrim(part, SWT.NONE, 0, 0, 0, 0); - int x = -trim.x; + int x = -trim.x; int width = 0; for (int i = 0; i < controls.length; i++) { if ((controlAlignments[i] & SWT.LEAD) != 0 && !controls[i].isDisposed() && controls[i].getVisible()) { - width += controls[i].computeSize(SWT.DEFAULT, SWT.DEFAULT).x; + width += controls[i].computeSize(SWT.DEFAULT, SWT.DEFAULT).x; } } if (width != 0) width += SPACING * 2; @@ -990,7 +996,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.0 */ public boolean getMinimized() { @@ -1007,19 +1013,19 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.0 */ public boolean getMinimizeVisible() { checkWidget(); return showMin; } -/** +/** * Returns the number of characters that will * appear in a fully compressed tab. - * + * * @return number of characters that will appear in a fully compressed tab - * + * * @since 3.0 */ public int getMinimumCharacters() { @@ -1037,7 +1043,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.0 */ public boolean getMaximized() { @@ -1054,7 +1060,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.0 */ public boolean getMaximizeVisible() { @@ -1066,17 +1072,17 @@ * recently used tabs and <code>false</code> otherwise. * <p> * When there is not enough horizontal space to show all the tabs, - * by default, tabs are shown sequentially from left to right in + * by default, tabs are shown sequentially from left to right in * order of their index. When the MRU visibility is turned on, * the tabs that are visible will be the tabs most recently selected. - * Tabs will still maintain their left to right order based on index + * Tabs will still maintain their left to right order based on index * but only the most recently selected tabs are visible. * <p> * For example, consider a CTabFolder that contains "Tab 1", "Tab 2", * "Tab 3" and "Tab 4" (in order by index). The user selects * "Tab 1" and then "Tab 3". If the CTabFolder is now - * compressed so that only two tabs are visible, by default, - * "Tab 2" and "Tab 3" will be shown ("Tab 3" since it is currently + * compressed so that only two tabs are visible, by default, + * "Tab 2" and "Tab 3" will be shown ("Tab 3" since it is currently * selected and "Tab 2" because it is the previous item in index order). * If MRU visibility is enabled, the two visible tabs will be "Tab 1" * and "Tab 3" (in that order from left to right).</p> @@ -1087,7 +1093,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.1 */ public boolean getMRUVisible() { @@ -1096,7 +1102,7 @@ } /** * Returns the receiver's renderer. - * + * * @return the receiver's renderer * * @exception SWTException <ul> @@ -1106,7 +1112,7 @@ * * @see #setRenderer(CTabFolderRenderer) * @see CTabFolderRenderer - * + * * @since 3.6 */ public CTabFolderRenderer getRenderer() { @@ -1130,9 +1136,9 @@ } /** * Return the selected tab item, or null if there is no selection. - * + * * @return the selected tab item, or null if none has been selected - * + * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> @@ -1152,7 +1158,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.0 */ public Color getSelectionBackground() { @@ -1168,7 +1174,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.0 */ public Color getSelectionForeground() { @@ -1178,9 +1184,9 @@ /** * Return the index of the selected tab item, or -1 if there * is no selection. - * + * * @return the index of the selected tab item or -1 - * + * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> @@ -1193,9 +1199,9 @@ /** * Returns <code>true</code> if the CTabFolder is rendered * with a simple, traditional shape. - * + * * @return <code>true</code> if the CTabFolder is rendered with a simple shape - * + * * @since 3.0 */ public boolean getSimple() { @@ -1205,9 +1211,9 @@ /** * Returns <code>true</code> if the CTabFolder only displays the selected tab * and <code>false</code> if the CTabFolder displays multiple tabs. - * + * * @return <code>true</code> if the CTabFolder only displays the selected tab and <code>false</code> if the CTabFolder displays multiple tabs - * + * * @since 3.0 */ public boolean getSingle() { @@ -1229,9 +1235,9 @@ } /** * Returns the height of the tab - * + * * @return the height of the tab - * + * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> @@ -1244,9 +1250,9 @@ } /** * Returns the position of the tab. Possible values are SWT.TOP or SWT.BOTTOM. - * + * * @return the position of the tab - * + * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> @@ -1257,11 +1263,11 @@ return onBottom ? SWT.BOTTOM : SWT.TOP; } /** - * Returns the control in the top right corner of the tab folder. + * Returns the control in the top right corner of the tab folder. * Typically this is a close button or a composite with a menu and close button. * * @return the control in the top right corner of the tab folder or null - * + * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> @@ -1274,11 +1280,11 @@ return topRight; } /** - * Returns the alignment of the top right control. + * Returns the alignment of the top right control. * * @return the alignment of the top right control which is either - * <code>SWT.RIGHT</code> or <code>SWT.FILL</code> - * + * <code>SWT.RIGHT</code> or <code>SWT.FILL</code> + * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> @@ -1291,11 +1297,11 @@ return topRightAlignment; } /** - * Returns <code>true</code> if the close button appears + * Returns <code>true</code> if the close button appears * when the user hovers over an unselected tabs. - * + * * @return <code>true</code> if the close button appears on unselected tabs - * + * * @since 3.0 */ public boolean getUnselectedCloseVisible() { @@ -1303,11 +1309,11 @@ return showUnselectedClose; } /** - * Returns <code>true</code> if an image appears + * Returns <code>true</code> if an image appears * in unselected tabs. - * + * * @return <code>true</code> if an image appears in unselected tabs - * + * * @since 3.0 */ public boolean getUnselectedImageVisible() { @@ -1315,17 +1321,17 @@ return showUnselectedImage; } /** - * Return the index of the specified tab or -1 if the tab is not + * Return the index of the specified tab or -1 if the tab is not * in the receiver. - * + * * @param item the tab item for which the index is required - * + * * @return the index of the specified tab item or -1 - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> - * + * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> @@ -1369,7 +1375,7 @@ } e.result = help; } - + @Override public void getKeyboardShortcut(AccessibleEvent e) { String shortcut = null; @@ -1377,7 +1383,7 @@ if (childID >= 0 && childID < items.length) { String text = items[childID].getText(); if (text != null) { - char mnemonic = _findMnemonic(text); + char mnemonic = _findMnemonic(text); if (mnemonic != '\0') { shortcut = SWT.getMessage ("SWT_Page_Mnemonic", new Object[] {new Character(mnemonic)}); //$NON-NLS-1$ } @@ -1389,7 +1395,7 @@ e.result = shortcut; } }); - + accessible.addAccessibleControlListener(new AccessibleControlAdapter() { @Override public void getChildAtPoint(AccessibleControlEvent e) { @@ -1435,12 +1441,12 @@ e.height = location.height; } } - + @Override public void getChildCount(AccessibleControlEvent e) { e.detail = items.length; } - + @Override public void getDefaultAction(AccessibleControlEvent e) { String action = null; @@ -1472,15 +1478,15 @@ role = ACC.ROLE_TABFOLDER; } else if (childID >= 0 && childID < items.length) { role = ACC.ROLE_TABITEM; - } + } e.detail = role; } - + @Override public void getSelection(AccessibleControlEvent e) { e.childID = (selectedIndex == -1) ? ACC.CHILDID_NONE : selectedIndex; } - + @Override public void getState(AccessibleControlEvent e) { int state = 0; @@ -1501,19 +1507,20 @@ } e.detail = state; } - + @Override public void getChildren(AccessibleControlEvent e) { int childIdCount = items.length; Object[] children = new Object[childIdCount]; for (int i = 0; i < childIdCount; i++) { - children[i] = new Integer(i); + children[i] = Integer.valueOf(i); } e.children = children; } }); - + addListener(SWT.Selection, new Listener() { + @Override public void handleEvent(Event event) { if (isFocusControl()) { if (selectedIndex == -1) { @@ -1526,6 +1533,7 @@ }); addListener(SWT.FocusIn, new Listener() { + @Override public void handleEvent(Event event) { if (selectedIndex == -1) { accessible.setFocus(ACC.CHILDID_SELF); @@ -1618,7 +1626,7 @@ notifyListeners(SWT.Dispose, event); event.type = SWT.None; /* - * Usually when an item is disposed, destroyItem will change the size of the items array, + * Usually when an item is disposed, destroyItem will change the size of the items array, * reset the bounds of all the tabs and manage the widget associated with the tab. * Since the whole folder is being disposed, this is not necessary. For speed * the inDispose flag is used to skip over this part of the item dispose. @@ -1630,21 +1638,21 @@ showMenu = null; } int length = items.length; - for (int i = 0; i < length; i++) { + for (int i = 0; i < length; i++) { if (items[i] != null) { items[i].dispose(); } } gradientColors = null; - + selectionGradientColors = null; selectionGradientPercents = null; selectionBgImage = null; selectionBackground = null; selectionForeground = null; - + if (controlBkImages != null) { for (int i = 0; i < controlBkImages.length; i++) { if (controlBkImages[i] != null) { @@ -1657,26 +1665,26 @@ controls = null; controlAlignments = null; controlRects = null; - + if (maxImage != null) maxImage.dispose(); maxImage = null; - + if (minImage != null) minImage.dispose(); minImage = null; - + if (chevronImage != null) chevronImage.dispose(); chevronImage = null; - + if (renderer != null) renderer.dispose(); renderer = null; minItem = null; maxItem = null; minMaxTb = null; - + chevronItem = null; chevronTb = null; - + if (folderListeners.length != 0) folderListeners = new CTabFolder2Listener[0]; if (tabListeners.length != 0) tabListeners = new CTabFolderListener[0]; } @@ -1735,9 +1743,9 @@ } } } -void onMouseDoubleClick(Event event) { - if (event.button != 1 || - (event.stateMask & SWT.BUTTON2) != 0 || +void onMouseDoubleClick(Event event) { + if (event.button != 1 || + (event.stateMask & SWT.BUTTON2) != 0 || (event.stateMask & SWT.BUTTON3) != 0) return; Event e = new Event(); e.item = getItem(new Point(event.x, event.y)); @@ -1780,6 +1788,7 @@ updateItems(); hoverTimerRunning = true; event.display.timerExec(2000, new Runnable() { + @Override public void run() { if (isDisposed()) return; if (hovering) { @@ -1941,7 +1950,7 @@ nextItem.closeImageState = SWT.NONE; redraw(nextItem.closeRect.x, nextItem.closeRect.y, nextItem.closeRect.width, nextItem.closeRect.height, false); } - } + } } } return; @@ -1953,7 +1962,7 @@ void onPageTraversal(Event event) { int count = items.length; if (count == 0) return; - int index = selectedIndex; + int index = selectedIndex; if (index == -1) { index = 0; } else { @@ -2013,28 +2022,28 @@ Font gcFont = gc.getFont(); Color gcBackground = gc.getBackground(); Color gcForeground = gc.getForeground(); - + // Useful for debugging paint problems //{ -//Point size = getSize(); +//Point size = getSize(); //gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_GREEN)); //gc.fillRectangle(-10, -10, size.x + 20, size.y+20); //} Point size = getSize(); - Rectangle bodyRect = new Rectangle(0, 0, size.x, size.y); - renderer.draw(CTabFolderRenderer.PART_BODY, SWT.BACKGROUND | SWT.FOREGROUND, bodyRect, gc); + Rectangle bodyRect = new Rectangle(0, 0, size.x, size.y); + renderer.draw(CTabFolderRenderer.PART_BODY, SWT.BACKGROUND | SWT.FOREGROUND, bodyRect, gc); gc.setFont(gcFont); gc.setForeground(gcForeground); gc.setBackground(gcBackground); - + renderer.draw(CTabFolderRenderer.PART_HEADER, SWT.BACKGROUND | SWT.FOREGROUND, bodyRect, gc); - + gc.setFont(gcFont); gc.setForeground(gcForeground); - gc.setBackground(gcBackground); - + gc.setBackground(gcBackground); + if (!single) { for (int i=0; i < items.length; i++) { Rectangle itemBounds = items[i].getBounds(); @@ -2043,19 +2052,19 @@ } } } - + gc.setFont(gcFont); gc.setForeground(gcForeground); - gc.setBackground(gcBackground); - - if (selectedIndex != -1) { + gc.setBackground(gcBackground); + + if (selectedIndex != -1) { renderer.draw(selectedIndex, items[selectedIndex].state | SWT.BACKGROUND | SWT.FOREGROUND, items[selectedIndex].getBounds(), gc); } - + gc.setFont(gcFont); gc.setForeground(gcForeground); - gc.setBackground(gcBackground); - + gc.setBackground(gcBackground); + if (hoverTb) { Rectangle trim = renderer.computeTrim(CTabFolderRenderer.PART_BORDER, SWT.NONE, 0, 0, 0, 0); int x = getSize().x - (trim.width + trim.x); @@ -2095,12 +2104,12 @@ int y1 = Math.min(size.y, oldSize.y); if (size.y != oldSize.y) y1 -= trim.height + trim.y - marginHeight; int x2 = Math.max(size.x, oldSize.x); - int y2 = Math.max(size.y, oldSize.y); + int y2 = Math.max(size.y, oldSize.y); redraw(0, y1, x2, y2 - y1, false); redraw(x1, 0, x2 - x1, y2, false); if (hoverTb) { redraw(hoverRect.x, hoverRect.y, hoverRect.width, hoverRect.height, false); - } + } } } oldSize = size; @@ -2198,7 +2207,7 @@ redraw(0, 0, size.x, -trim.y - marginHeight + 1, false); } } -/** +/** * Removes the listener. * * @param listener the listener which should no longer be notified @@ -2206,14 +2215,14 @@ * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> - * + * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> * </ul> - * + * * @see #addCTabFolder2Listener(CTabFolder2Listener) - * + * * @since 3.0 */ public void removeCTabFolder2Listener(CTabFolder2Listener listener) { @@ -2237,7 +2246,7 @@ System.arraycopy(folderListeners, index + 1, newTabListeners, index, folderListeners.length - index - 1); folderListeners = newTabListeners; } -/** +/** * Removes the listener. * * @param listener the listener which should no longer be notified @@ -2245,12 +2254,12 @@ * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> - * + * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> * </ul> - * + * * @deprecated see removeCTabFolderCloseListener(CTabFolderListener) */ @Deprecated @@ -2275,7 +2284,7 @@ System.arraycopy(tabListeners, index + 1, newTabListeners, index, tabListeners.length - index - 1); tabListeners = newTabListeners; } -/** +/** * Removes the listener from the collection of listeners who will * be notified when the user changes the receiver's selection. * @@ -2298,7 +2307,7 @@ SWT.error(SWT.ERROR_NULL_ARGUMENT); } removeListener(SWT.Selection, listener); - removeListener(SWT.DefaultSelection, listener); + removeListener(SWT.DefaultSelection, listener); } @Override @@ -2321,21 +2330,21 @@ * For example to draw a gradient that varies from dark blue to blue and then to * white, use the following call to setBackground: * <pre> - * cfolder.setBackground(new Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE), + * cfolder.setBackground(new Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE), * display.getSystemColor(SWT.COLOR_BLUE), - * display.getSystemColor(SWT.COLOR_WHITE), + * display.getSystemColor(SWT.COLOR_WHITE), * display.getSystemColor(SWT.COLOR_WHITE)}, * new int[] {25, 50, 100}); * </pre> * - * @param colors an array of Color that specifies the colors to appear in the gradient + * @param colors an array of Color that specifies the colors to appear in the gradient * in order of appearance left to right. The value <code>null</code> clears the - * background gradient. The value <code>null</code> can be used inside the array of + * background gradient. The value <code>null</code> can be used inside the array of * Color to specify the background color. - * @param percents an array of integers between 0 and 100 specifying the percent of the width + * @param percents an array of integers between 0 and 100 specifying the percent of the width * of the widget at which the color should change. The size of the <code>percents</code> * array must be one less than the size of the <code>colors</code> array. - * + * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> @@ -2351,23 +2360,23 @@ * For example to draw a vertical gradient that varies from dark blue to blue and then to * white, use the following call to setBackground: * <pre> - * cfolder.setBackground(new Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE), + * cfolder.setBackground(new Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE), * display.getSystemColor(SWT.COLOR_BLUE), - * display.getSystemColor(SWT.COLOR_WHITE), + * display.getSystemColor(SWT.COLOR_WHITE), * display.getSystemColor(SWT.COLOR_WHITE)}, * new int[] {25, 50, 100}, true); * </pre> * - * @param colors an array of Color that specifies the colors to appear in the gradient + * @param colors an array of Color that specifies the colors to appear in the gradient * in order of appearance left to right. The value <code>null</code> clears the - * background gradient. The value <code>null</code> can be used inside the array of + * background gradient. The value <code>null</code> can be used inside the array of * Color to specify the background color. - * @param percents an array of integers between 0 and 100 specifying the percent of the width + * @param percents an array of integers between 0 and 100 specifying the percent of the width * of the widget at which the color should change. The size of the <code>percents</code> * array must be one less than the size of the <code>colors</code> array. - * - * @param vertical indicate the direction of the gradient. <code>True</code> is vertical and <code>false</code> is horizontal. - * + * + * @param vertical indicate the direction of the gradient. <code>True</code> is vertical and <code>false</code> is horizontal. + * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> @@ -2395,9 +2404,9 @@ percents = new int[] {}; } } - + // Are these settings the same as before? - if ((gradientColors != null) && (colors != null) && + if ((gradientColors != null) && (colors != null) && (gradientColors.length == colors.length)) { boolean same = false; for (int i = 0; i < gradientColors.length; i++) { @@ -2446,9 +2455,9 @@ } /** * Toggle the visibility of the border - * + * * @param show true if the border should be displayed - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -2531,7 +2540,7 @@ if (chevronImage != null) chevronImage.dispose(); chevronImage = createButtonImage(display, CTabFolderRenderer.PART_CHEVRON_BUTTON); chevronItem.setImage(chevronImage); - } + } } boolean[][] overflow = new boolean[1][0]; @@ -2584,7 +2593,7 @@ @Override public boolean setFocus () { checkWidget (); - + /* * Feature in SWT. When a new tab item is selected * and the previous tab item had focus, removing focus @@ -2625,14 +2634,14 @@ redraw(); } /** - * Display an insert marker before or after the specified tab item. - * + * Display an insert marker before or after the specified tab item. + * * A value of null will clear the mark. - * + * * @param item the item with which the mark is associated or null - * + * * @param after true if the mark should be displayed after the specified item - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -2643,17 +2652,17 @@ } /** * Display an insert marker before or after the specified tab item. - * + * * A value of -1 will clear the mark. - * + * * @param index the index of the item with which the mark is associated or -1 - * + * * @param after true if the mark should be displayed after the specified item - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_ARGUMENT when the index is invalid</li> * </ul> - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -2723,22 +2732,22 @@ item.closeRect.x = item.x + item.width - (edgeTrim.width + edgeTrim.x) - closeButtonSize.x; item.closeRect.y = onBottom ? size.y - borderBottom - tabHeight + (tabHeight - closeButtonSize.y)/2: borderTop + (tabHeight - closeButtonSize.y)/2; x = x + item.width; - if (!simple && i == selectedIndex) x -= renderer.curveIndent; //TODO: fix next item position + if (!simple && i == selectedIndex) x -= renderer.curveIndent; //TODO: fix next item position } } } return changed; } /** - * Reorder the items of the receiver. + * Reorder the items of the receiver. * @param indices an array containing the new indices for all items - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the indices array is null</li> - * <li>ERROR_INVALID_ARGUMENT - if the indices array is not the same length as the number of items, + * <li>ERROR_INVALID_ARGUMENT - if the indices array is not the same length as the number of items, * if there are duplicate indices or an index is out of range.</li> * </ul> - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -2796,13 +2805,13 @@ } return changed; } - + if (items.length == 0) return changed; int[] widths; int tabAreaWidth = Math.max(0, getRightItemEdge(gc) - getLeftItemEdge(gc, CTabFolderRenderer.PART_BORDER)); // First, try the minimum tab size at full compression. int minWidth = 0; - int[] minWidths = new int[items.length]; + int[] minWidths = new int[items.length]; for (int i = 0; i < priority.length; i++) { int index = priority[i]; int state = CTabFolderRenderer.MINIMUM_SIZE; @@ -2885,7 +2894,7 @@ } /** * Marks the receiver's maximize button as visible if the argument is <code>true</code>, - * and marks it invisible otherwise. + * and marks it invisible otherwise. * * @param visible the new visibility state * @@ -2893,7 +2902,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.0 */ public void setMaximizeVisible(boolean visible) { @@ -2949,7 +2958,7 @@ } /** * Marks the receiver's minimize button as visible if the argument is <code>true</code>, - * and marks it invisible otherwise. + * and marks it invisible otherwise. * * @param visible the new visibility state * @@ -2957,7 +2966,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.0 */ public void setMinimizeVisible(boolean visible) { @@ -2993,9 +3002,9 @@ } /** - * Sets the minimum number of characters that will + * Sets the minimum number of characters that will * be displayed in a fully compressed tab. - * + * * @param count the minimum number of characters that will be displayed in a fully compressed tab * * @exception SWTException <ul> @@ -3003,7 +3012,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * <li>ERROR_INVALID_RANGE - if the count is less than zero</li> * </ul> - * + * * @since 3.0 */ public void setMinimumCharacters(int count) { @@ -3016,17 +3025,17 @@ /** * When there is not enough horizontal space to show all the tabs, - * by default, tabs are shown sequentially from left to right in + * by default, tabs are shown sequentially from left to right in * order of their index. When the MRU visibility is turned on, * the tabs that are visible will be the tabs most recently selected. - * Tabs will still maintain their left to right order based on index + * Tabs will still maintain their left to right order based on index * but only the most recently selected tabs are visible. * <p> * For example, consider a CTabFolder that contains "Tab 1", "Tab 2", * "Tab 3" and "Tab 4" (in order by index). The user selects * "Tab 1" and then "Tab 3". If the CTabFolder is now - * compressed so that only two tabs are visible, by default, - * "Tab 2" and "Tab 3" will be shown ("Tab 3" since it is currently + * compressed so that only two tabs are visible, by default, + * "Tab 2" and "Tab 3" will be shown ("Tab 3" since it is currently * selected and "Tab 2" because it is the previous item in index order). * If MRU visibility is enabled, the two visible tabs will be "Tab 1" * and "Tab 3" (in that order from left to right).</p> @@ -3037,7 +3046,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.1 */ public void setMRUVisible(boolean show) { @@ -3063,14 +3072,14 @@ * renderer is used. * * @param renderer a new renderer - * + * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> * </ul> * * @see CTabFolderRenderer - * + * * @since 3.6 */ public void setRenderer(CTabFolderRenderer renderer) { @@ -3084,13 +3093,13 @@ } /** * Set the selection to the tab at the specified item. - * + * * @param item the tab item to be selected - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the item is null</li> * </ul> - * + * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> @@ -3104,9 +3113,9 @@ } /** * Set the selection to the tab at the specified index. - * + * * @param index the index of the tab item to be selected - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -3120,7 +3129,7 @@ showItem(selection); return; } - + int oldIndex = selectedIndex; selectedIndex = index; if (oldIndex != -1) { @@ -3136,7 +3145,7 @@ if (oldIndex != -1) { oldControl = items[oldIndex].control; } - + if (newControl != oldControl) { if (newControl != null && !newControl.isDisposed()) { newControl.setBounds(getClientArea()); @@ -3149,7 +3158,7 @@ showItem(selection); redraw(); } -void setSelection(int index, boolean notify) { +void setSelection(int index, boolean notify) { int oldSelectedIndex = selectedIndex; setSelection(index); if (notify && selectedIndex != oldSelectedIndex && selectedIndex != -1) { @@ -3166,7 +3175,7 @@ * @param color the new color (or null) * * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> + * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -3190,21 +3199,21 @@ * For example to draw a gradient that varies from dark blue to blue and then to * white, use the following call to setBackground: * <pre> - * cfolder.setBackground(new Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE), + * cfolder.setBackground(new Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE), * display.getSystemColor(SWT.COLOR_BLUE), - * display.getSystemColor(SWT.COLOR_WHITE), + * display.getSystemColor(SWT.COLOR_WHITE), * display.getSystemColor(SWT.COLOR_WHITE)}, * new int[] {25, 50, 100}); * </pre> * - * @param colors an array of Color that specifies the colors to appear in the gradient + * @param colors an array of Color that specifies the colors to appear in the gradient * in order of appearance left to right. The value <code>null</code> clears the - * background gradient. The value <code>null</code> can be used inside the array of + * background gradient. The value <code>null</code> can be used inside the array of * Color to specify the background color. - * @param percents an array of integers between 0 and 100 specifying the percent of the width - * of the widget at which the color should change. The size of the percents array must be one + * @param percents an array of integers between 0 and 100 specifying the percent of the width + * of the widget at which the color should change. The size of the percents array must be one * less than the size of the colors array. - * + * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> @@ -3218,23 +3227,23 @@ * For example to draw a vertical gradient that varies from dark blue to blue and then to * white, use the following call to setBackground: * <pre> - * cfolder.setBackground(new Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE), + * cfolder.setBackground(new Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE), * display.getSystemColor(SWT.COLOR_BLUE), - * display.getSystemColor(SWT.COLOR_WHITE), + * display.getSystemColor(SWT.COLOR_WHITE), * display.getSystemColor(SWT.COLOR_WHITE)}, * new int[] {25, 50, 100}, true); * </pre> * - * @param colors an array of Color that specifies the colors to appear in the gradient + * @param colors an array of Color that specifies the colors to appear in the gradient * in order of appearance left to right. The value <code>null</code> clears the - * background gradient. The value <code>null</code> can be used inside the array of + * background gradient. The value <code>null</code> can be used inside the array of * Color to specify the background color. - * @param percents an array of integers between 0 and 100 specifying the percent of the width - * of the widget at which the color should change. The size of the percents array must be one + * @param percents an array of integers between 0 and 100 specifying the percent of the width + * of the widget at which the color should change. The size of the percents array must be one * less than the size of the colors array. - * - * @param vertical indicate the direction of the gradient. True is vertical and false is horizontal. - * + * + * @param vertical indicate the direction of the gradient. True is vertical and false is horizontal. + * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> @@ -3250,7 +3259,7 @@ if (colors != null) { //The colors array can optionally have an extra entry which describes the highlight top color //Thus its either one or two larger than the percents array - if (percents == null || + if (percents == null || ! ((percents.length == colors.length - 1) || (percents.length == colors.length - 2))){ SWT.error(SWT.ERROR_INVALID_ARGUMENT); } @@ -3279,10 +3288,10 @@ } else { colorsLength = 0; } - + // Are these settings the same as before? if (selectionBgImage == null) { - if ((selectionGradientColors != null) && (colors != null) && + if ((selectionGradientColors != null) && (colors != null) && (selectionGradientColors.length == colorsLength)) { boolean same = false; for (int i = 0; i < selectionGradientColors.length; i++) { @@ -3341,9 +3350,9 @@ /** * Set the image to be drawn in the background of the selected tab. Image * is stretched or compressed to cover entire selection tab area. - * + * * @param image the image to be drawn in the background - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -3364,9 +3373,9 @@ } /** * Set the foreground color of the selected tab. - * + * * @param color the color of the text displayed in the selected tab - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -3381,10 +3390,10 @@ } /** - * Sets the shape that the CTabFolder will use to render itself. - * + * Sets the shape that the CTabFolder will use to render itself. + * * @param simple <code>true</code> if the CTabFolder should render itself in a simple, traditional style - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -3401,14 +3410,14 @@ } /** * Sets the number of tabs that the CTabFolder should display - * + * * @param single <code>true</code> if only the selected tab should be displayed otherwise, multiple tabs will be shown. - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.0 */ public void setSingle(boolean single) { @@ -3433,11 +3442,11 @@ /** * Specify a fixed height for the tab items. If no height is specified, - * the default height is the height of the text or the image, whichever + * the default height is the height of the text or the image, whichever * is greater. Specifying a height of -1 will revert to the default height. - * + * * @param height the pixel value of the height or -1 - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -3453,17 +3462,17 @@ updateFolder(UPDATE_TAB_HEIGHT); } /** - * Specify whether the tabs should appear along the top of the folder + * Specify whether the tabs should appear along the top of the folder * or along the bottom of the folder. - * + * * @param position <code>SWT.TOP</code> for tabs along the top or <code>SWT.BOTTOM</code> for tabs along the bottom - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * <li>ERROR_INVALID_ARGUMENT - if the position value is not either SWT.TOP or SWT.BOTTOM</li> * </ul> - * + * * @since 3.0 */ public void setTabPosition(int position) { @@ -3478,10 +3487,10 @@ } /** * Set the control that appears in the top right corner of the tab folder. - * Typically this is a close button or a composite with a Menu and close button. - * The topRight control is optional. Setting the top right control to null will + * Typically this is a close button or a composite with a Menu and close button. + * The topRight control is optional. Setting the top right control to null will * remove it from the tab folder. - * + * * @param control the control to be displayed in the top right corner or null * * @exception SWTException <ul> @@ -3489,7 +3498,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * <li>ERROR_INVALID_ARGUMENT - if the control is disposed, or not a child of this CTabFolder</li> * </ul> - * + * * @since 2.1 */ public void setTopRight(Control control) { @@ -3497,13 +3506,13 @@ } /** * Set the control that appears in the top right corner of the tab folder. - * Typically this is a close button or a composite with a Menu and close button. - * The topRight control is optional. Setting the top right control to null + * Typically this is a close button or a composite with a Menu and close button. + * The topRight control is optional. Setting the top right control to null * will remove it from the tab folder. * <p> * The alignment parameter sets the layout of the control in the tab area. - * <code>SWT.RIGHT</code> will cause the control to be positioned on the far - * right of the folder and it will have its default size. <code>SWT.FILL</code> + * <code>SWT.RIGHT</code> will cause the control to be positioned on the far + * right of the folder and it will have its default size. <code>SWT.FILL</code> * will size the control to fill all the available space to the right of the * last tab. If there is no available space, the control will not be visible. * <code>SWT.RIGHT | SWT.WRAP</code> will allow the control to wrap below the @@ -3518,7 +3527,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * <li>ERROR_INVALID_ARGUMENT - if the control is disposed, or not a child of this CTabFolder</li> * </ul> - * + * * @since 3.0 */ public void setTopRight(Control control, int alignment) { @@ -3540,16 +3549,16 @@ /** - * Specify whether the close button appears + * Specify whether the close button appears * when the user hovers over an unselected tabs. - * + * * @param visible <code>true</code> makes the close button appear - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.0 */ public void setUnselectedCloseVisible(boolean visible) { @@ -3561,14 +3570,14 @@ } /** * Specify whether the image appears on unselected tabs. - * + * * @param visible <code>true</code> makes the image appear - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.0 */ public void setUnselectedImageVisible(boolean visible) { @@ -3582,7 +3591,7 @@ * Shows the item. If the item is already showing in the receiver, * this method simply returns. Otherwise, the items are scrolled until * the item is visible. - * + * * @param item the item to be shown * * @exception IllegalArgumentException <ul> @@ -3666,11 +3675,11 @@ * </ul> * * @see CTabFolder#showItem(CTabItem) - * + * * @since 2.0 */ public void showSelection () { - checkWidget (); + checkWidget (); if (selectedIndex != -1) { showItem(getSelection()); } @@ -3734,7 +3743,7 @@ } } } - + } if (firstIndex != priority[0]) { int index = 0; @@ -3750,7 +3759,7 @@ } } } - + boolean oldShowChevron = showChevron; boolean changed = setItemSize(gc); changed |= setItemLocation(gc); @@ -3770,8 +3779,8 @@ tabHeight = renderer.computeSize(CTabFolderRenderer.PART_HEADER, SWT.NONE, gc, SWT.DEFAULT, SWT.DEFAULT).y; gc.dispose(); if (fixedTabHeight == SWT.DEFAULT && controls != null && controls.length > 0) { - for (int i = 0; i < controls.length; i++) { - if ((controlAlignments[i] & SWT.WRAP) == 0 && !controls[i].isDisposed() && (controls[i].getVisible() || controls[i] == chevronTb)) { + for (int i = 0; i < controls.length; i++) { + if ((controlAlignments[i] & SWT.WRAP) == 0 && !controls[i].isDisposed() && controls[i].getVisible()) { int topHeight = controls[i].computeSize(SWT.DEFAULT, SWT.DEFAULT).y; topHeight += renderer.computeTrim(CTabFolderRenderer.PART_HEADER, SWT.NONE, 0,0,0,0).height + 1; tabHeight = Math.max(topHeight, tabHeight); @@ -3787,6 +3796,7 @@ updateFlags |= flags; if (updateRun != null) return; updateRun = new Runnable() { + @Override public void run() { updateRun = null; if (isDisposed()) return; @@ -3797,15 +3807,12 @@ } void runUpdate() { - if (updateFlags == 0) return; + if (updateFlags == 0) return; int flags = updateFlags; updateFlags = 0; Rectangle rectBefore = getClientArea(); - boolean updated = updateTabHeight(false); - updated |= updateItems(selectedIndex); - if (IS_GTK && updated && getParent() != null) { - getParent().layout(true, false); - } + updateTabHeight(false); + updateItems(selectedIndex); if ((flags & REDRAW) != 0) { redraw(); } else if ((flags & REDRAW_TABS) != 0) { @@ -3832,7 +3839,7 @@ Rectangle bounds = control.getBounds(); int tabHeight = getTabHeight(); int height = this.getSize().y; - boolean wrapped = onBottom ? bounds.y + bounds.height < height - tabHeight : bounds.y > tabHeight; + boolean wrapped = onBottom ? bounds.y + bounds.height < height - tabHeight : bounds.y > tabHeight; if (wrapped || gradientColors == null) { control.setBackgroundImage(null); control.setBackground(getBackground()); @@ -3843,13 +3850,13 @@ bounds.height -= 2*bounds.y - 1; } else { bounds.height += height - (bounds.y + bounds.height); - bounds.y = -1; + bounds.y = -1; } bounds.x = 0; if (controlBkImages[i] != null) controlBkImages[i].dispose(); controlBkImages[i] = new Image(control.getDisplay(), bounds); GC gc = new GC(controlBkImages[i]); - renderer.drawBackground(gc, bounds, 0); + renderer.draw(CTabFolderRenderer.PART_BACKGROUND, 0, bounds, gc); gc.dispose(); control.setBackground(null); control.setBackgroundImage(controlBkImages[i]); @@ -3857,7 +3864,7 @@ } } } - + } } String _getToolTip(int x, int y) { @@ -3875,18 +3882,18 @@ * control, see#removeTabControl(Control); * <p> * The flags parameter sets the layout of the control in the tab area. -* <code>SWT.LEAD</code> will cause the control to be positioned on the left +* <code>SWT.LEAD</code> will cause the control to be positioned on the left * of the tabs. <code>SWT.TRAIL</code> will cause the control to be positioned on -* the far right of the folder and it will have its default size. <code>SWT.TRAIL</code> -* can be combined with <code>SWT.FILL</code>to fill all the available space to the -* right of the last tab. <code>SWT.WRAP</code> can also be added to <code>SWT.TRAIL</code> +* the far right of the folder and it will have its default size. <code>SWT.TRAIL</code> +* can be combined with <code>SWT.FILL</code>to fill all the available space to the +* right of the last tab. <code>SWT.WRAP</code> can also be added to <code>SWT.TRAIL</code> * only to cause a control to wrap if there is not enough space to display it in its * entirety. * </p> * @param control the control to be displayed in the top right corner or null * -* @param flags valid combinations are: -* <ul><li>SWT.LEAD +* @param flags valid combinations are: +* <ul><li>SWT.LEAD * <li> SWT.TRAIL (| SWT.FILL | SWT.WRAP) * </ul> * @exception SWTException <ul> @@ -3922,9 +3929,9 @@ } } int length = controls.length; - + control.addListener(SWT.Resize, listener); - + //Grow all 4 arrays Control[] newControls = new Control [length + 1]; System.arraycopy(controls, 0, newControls, 0, length); @@ -3941,7 +3948,7 @@ if (index == -1) { index = length; if (chevronTb != null && control != chevronTb) index--; - } + } System.arraycopy (controls, index, controls, index + 1, length - index); System.arraycopy (controlAlignments, index, controlAlignments, index + 1, length - index); System.arraycopy (controlRects, index, controlRects, index + 1, length - index); @@ -3958,7 +3965,7 @@ * Removes the control from the list of tab controls. * * @param control the control to be removed -* +* * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -3980,16 +3987,16 @@ index = i; break; } - } + } if (index == -1) return; - + if (!control.isDisposed()) { control.removeListener(SWT.Resize, listener); control.setBackground (null); control.setBackgroundImage (null); if (control instanceof Composite) ((Composite) control).setBackgroundMode(SWT.INHERIT_NONE); } - + if (controlBkImages[index] != null && !controlBkImages[index].isDisposed()) controlBkImages[index].dispose(); if (controls.length == 1) { controls = new Control[0]; @@ -4001,17 +4008,17 @@ System.arraycopy(controls, 0, newControls, 0, index); System.arraycopy(controls, index + 1, newControls, index, controls.length - index - 1); controls = newControls; - + int[] newAlignments = new int [controls.length]; System.arraycopy(controlAlignments, 0, newAlignments, 0, index); System.arraycopy(controlAlignments, index + 1, newAlignments, index, controls.length - index); controlAlignments = newAlignments; - + Rectangle[] newRects = new Rectangle [controls.length]; System.arraycopy(controlRects, 0, newRects, 0, index); System.arraycopy(controlRects, index + 1, newRects, index, controls.length - index); controlRects = newRects; - + Image[] newBkImages = new Image [controls.length]; System.arraycopy(controlBkImages, 0, newBkImages, 0, index); System.arraycopy(controlBkImages, index + 1, newBkImages, index, controls.length - index); @@ -4038,7 +4045,7 @@ /** * Sets whether a chevron is shown when there are more items to be displayed. - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE - if the index is out of range</li> * </ul> @@ -4046,7 +4053,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> * </ul> - * + * */ /*public*/ void setChevronVisible(boolean visible) { checkWidget(); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/CTabFolderLayout.java swt4-gtk-4.6.0/org/eclipse/swt/custom/CTabFolderLayout.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/CTabFolderLayout.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/CTabFolderLayout.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,7 +16,7 @@ /** * This class provides the layout for CTabFolder - * + * * @see CTabFolder */ class CTabFolderLayout extends Layout { @@ -39,7 +39,7 @@ tabW += renderer.computeSize(i, state, gc, SWT.DEFAULT, SWT.DEFAULT).x; } } - + int width = 0, wrapHeight = 0; boolean leftControl = false, rightControl = false; if (wHint == SWT.DEFAULT) { @@ -79,7 +79,7 @@ tabW += width; gc.dispose(); - + int controlW = 0; int controlH = 0; // preferred size of controls in tab items @@ -96,10 +96,10 @@ int minHeight = (folder.minimized) ? 0 : controlH + wrapHeight; if (minWidth == 0) minWidth = CTabFolder.DEFAULT_WIDTH; if (minHeight == 0) minHeight = CTabFolder.DEFAULT_HEIGHT; - + if (wHint != SWT.DEFAULT) minWidth = wHint; if (hHint != SWT.DEFAULT) minHeight = hHint; - + return new Point (minWidth, minHeight); } @Override diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/CTabFolderListener.java swt4-gtk-4.6.0/org/eclipse/swt/custom/CTabFolderListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/CTabFolderListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/CTabFolderListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -26,15 +26,15 @@ * @see CTabFolderEvent */ public interface CTabFolderListener extends SWTEventListener { - + /** * Sent when the user clicks on the close button of an item in the CTabFolder. The item being closed is specified - * in the event.item field. Setting the event.doit field to false will stop the CTabItem from closing. - * When the CTabItem is closed, it is disposed. The contents of the CTabItem (see CTabItem.setControl) will be + * in the event.item field. Setting the event.doit field to false will stop the CTabItem from closing. + * When the CTabItem is closed, it is disposed. The contents of the CTabItem (see CTabItem.setControl) will be * made not visible when the CTabItem is closed. - * + * * @param event an event indicating the item being closed - * + * * @see CTabItem#setControl */ public void itemClosed(CTabFolderEvent event); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/CTabFolderRenderer.java swt4-gtk-4.6.0/org/eclipse/swt/custom/CTabFolderRenderer.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/CTabFolderRenderer.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/CTabFolderRenderer.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -16,7 +16,7 @@ import org.eclipse.swt.widgets.*; /** - * Instances of this class provide all of the measuring and drawing functionality + * Instances of this class provide all of the measuring and drawing functionality * required by <code>CTabFolder</code>. This class can be subclassed in order to * customize the look of a CTabFolder. * @@ -24,16 +24,16 @@ * @since 3.6 */ public class CTabFolderRenderer { - + protected CTabFolder parent; - + int[] curve; int[] topCurveHighlightStart; int[] topCurveHighlightEnd; int curveWidth = 0; int curveIndent = 0; int lastTabHeight = -1; - + Color fillColor; /* Selected item appearance */ Color selectionHighlightGradientBegin = null; //null == no highlight @@ -48,12 +48,12 @@ Color selectedOuterColor = null; Color selectedInnerColor = null; Color tabAreaColor = null; - /* + /* * Border color that was used in computing the cached anti-alias Colors. * We have to recompute the colors if the border color changes */ Color lastBorderColor = null; - + //TOP_LEFT_CORNER_HILITE is laid out in reverse (ie. top to bottom) //so can fade in same direction as right swoop curve static final int[] TOP_LEFT_CORNER_HILITE = new int[] {5,2, 4,2, 3,3, 2,4, 2,5, 1,6}; @@ -78,24 +78,24 @@ static final int[] SIMPLE_TOP_RIGHT_CORNER_BORDERLESS= new int[] {-3,0, -2,1, -1,2}; static final int[] SIMPLE_BOTTOM_LEFT_CORNER_BORDERLESS = new int[] {0,-3, 1,-2, 2,-1, 3,0}; static final int[] SIMPLE_BOTTOM_RIGHT_CORNER_BORDERLESS = new int[] {-4,0, -3,-1, -2,-2, -1,-3}; - + static final RGB CLOSE_FILL = new RGB(252, 160, 160); - + static final int BUTTON_SIZE = 16; static final int BUTTON_TRIM = 1; - + static final int BUTTON_BORDER = SWT.COLOR_WIDGET_DARK_SHADOW; static final int BUTTON_FILL = SWT.COLOR_LIST_BACKGROUND; static final int BORDER1_COLOR = SWT.COLOR_WIDGET_NORMAL_SHADOW; - + static final int ITEM_TOP_MARGIN = 2; static final int ITEM_BOTTOM_MARGIN = 2; static final int ITEM_LEFT_MARGIN = 4; static final int ITEM_RIGHT_MARGIN = 4; static final int INTERNAL_SPACING = 4; static final int FLAGS = SWT.DRAW_TRANSPARENT | SWT.DRAW_MNEMONIC; - static final String ELLIPSIS = "..."; //$NON-NLS-1$ - + static final String ELLIPSIS = "..."; //$NON-NLS-1$ + //Part constants /** * Part constant indicating the body of the tab folder. The body is the @@ -175,13 +175,13 @@ /** * Constructs a new instance of this class given its parent. - * + * * @param parent CTabFolder * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_ARGUMENT - if the parent is disposed</li> * </ul> - * + * * @see Widget#getStyle */ protected CTabFolderRenderer(CTabFolder parent) { @@ -189,7 +189,7 @@ if (parent.isDisposed ()) SWT.error (SWT.ERROR_INVALID_ARGUMENT); this.parent = parent; } - + void antialias (int[] shape, Color innerColor, Color outerColor, GC gc){ // Don't perform anti-aliasing on Mac because the platform // already does it. The simple style also does not require anti-aliasing. @@ -239,41 +239,41 @@ * best be displayed at. The width hint and height hint arguments * allow the caller to ask a control questions such as "Given a particular * width, how high does the part need to be to show all of the contents?" - * To indicate that the caller does not wish to constrain a particular - * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint. + * To indicate that the caller does not wish to constrain a particular + * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint. * </p><p> - * The <code>part</code> value indicated what component the preferred size is + * The <code>part</code> value indicated what component the preferred size is * to be calculated for. Valid values are any of the part constants: - * <ul> + * <ul> * <li>PART_BODY</li> - * <li>PART_HEADER</li> + * <li>PART_HEADER</li> * <li>PART_BORDER</li> - * <li>PART_BACKGROUND</li> - * <li>PART_MAX_BUTTON</li> - * <li>PART_MIN_BUTTON</li> + * <li>PART_BACKGROUND</li> + * <li>PART_MAX_BUTTON</li> + * <li>PART_MIN_BUTTON</li> * <li>PART_CHEVRON_BUTTON</li> - * <li>PART_CLOSE_BUTTON</li> + * <li>PART_CLOSE_BUTTON</li> * <li>A positive integer which is the index of an item in the CTabFolder.</li> * </ul> * </p> * <p> - * The <code>state</code> parameter may be one of the following: + * The <code>state</code> parameter may be one of the following: * <ul> * <li>SWT.NONE</li> * <li>SWT.SELECTED - whether the part is selected</li> * </ul> * </p> - * @param part a part constant - * @param state current state + * @param part a part constant + * @param state current state * @param gc the gc to use for measuring * @param wHint the width hint (can be <code>SWT.DEFAULT</code>) * @param hHint the height hint (can be <code>SWT.DEFAULT</code>) * @return the preferred size of the part - * + * * @since 3.6 */ protected Point computeSize (int part, int state, GC gc, int wHint, int hHint) { - int width = 0, height = 0; + int width = 0, height = 0; switch (part) { case PART_HEADER: if (parent.fixedTabHeight != SWT.DEFAULT) { @@ -302,7 +302,7 @@ default: if (0 <= part && part < parent.getItemCount()) { updateCurves(); - CTabItem item = parent.items[part]; + CTabItem item = parent.items[part]; if (item.isDisposed()) return new Point(0,0); Image image = item.getImage(); if (image != null && !image.isDisposed()) { @@ -349,7 +349,7 @@ if (width > 0) width += INTERNAL_SPACING; width += computeSize(PART_CLOSE_BUTTON, SWT.NONE, gc, SWT.DEFAULT, SWT.DEFAULT).x; } - } + } } break; } @@ -372,8 +372,8 @@ * rectangle described by the arguments (relative to the * receiver's parent). * </p> - * - * @param part one of the part constants + * + * @param part one of the part constants * @param state the state of the part * @param x the desired x coordinate of the client area * @param y the desired y coordinate of the client area @@ -382,7 +382,7 @@ * @return the required bounds to produce the given client area * * @see CTabFolderRenderer#computeSize(int, int, GC, int, int) valid part and state values - * + * * @since 3.6 */ protected Rectangle computeTrim (int part, int state, int x, int y, int width, int height) { @@ -397,7 +397,7 @@ int highlight_header = (style & SWT.FLAT) != 0 ? 1 : 3; int highlight_margin = (style & SWT.FLAT) != 0 ? 0 : 2; if (parent.fixedTabHeight == 0 && (style & SWT.FLAT) != 0 && (style & SWT.BORDER) == 0) { - highlight_header = 0; + highlight_header = 0; } int marginWidth = parent.marginWidth; int marginHeight = parent.marginHeight; @@ -412,7 +412,7 @@ } break; case PART_HEADER: - //no trim + //no trim break; case PART_MAX_BUTTON: case PART_MIN_BUTTON: @@ -425,7 +425,7 @@ break; case PART_BORDER: x = x - borderLeft; - width = width + borderLeft + borderRight; + width = width + borderLeft + borderRight; if (!parent.simple) width += 2; // TOP_RIGHT_CORNER needs more space y = y - borderTop; height = height + borderTop + borderBottom; @@ -445,18 +445,18 @@ } return new Rectangle(x, y, width, height); } - + void createAntialiasColors() { disposeAntialiasColors(); lastBorderColor = parent.getDisplay().getSystemColor(BORDER1_COLOR); RGB lineRGB = lastBorderColor.getRGB(); /* compute the selected color */ RGB innerRGB = parent.selectionBackground.getRGB(); - if (parent.selectionBgImage != null || + if (parent.selectionBgImage != null || (parent.selectionGradientColors != null && parent.selectionGradientColors.length > 1)) { innerRGB = null; } - RGB outerRGB = parent.getBackground().getRGB(); + RGB outerRGB = parent.getBackground().getRGB(); if (parent.gradientColors != null && parent.gradientColors.length > 1) { outerRGB = null; } @@ -519,12 +519,12 @@ selectionHighlightGradientColorsCache[i] = new Color(parent.getDisplay(), red, green, blue); } } - + /** * Dispose of any operating system resources associated with * the renderer. Called by the CTabFolder parent upon receiving * the dispose event or when changing the renderer. - * + * * @since 3.6 */ protected void dispose() { @@ -535,7 +535,7 @@ fillColor = null; } } - + void disposeAntialiasColors() { if (tabAreaColor != null) tabAreaColor.dispose(); if (selectedInnerColor != null) selectedInnerColor.dispose(); @@ -551,16 +551,16 @@ } selectionHighlightGradientColorsCache = null; } - + /** - * Draw a specified <code>part</code> of the CTabFolder using the provided <code>bounds</code> and <code>GC</code>. + * Draw a specified <code>part</code> of the CTabFolder using the provided <code>bounds</code> and <code>GC</code>. * <p>The valid CTabFolder <code>part</code> constants are: * <ul> * <li>PART_BODY - the entire body of the CTabFolder</li> * <li>PART_HEADER - the upper tab area of the CTabFolder</li> * <li>PART_BORDER - the border of the CTabFolder</li> * <li>PART_BACKGROUND - the background of the CTabFolder</li> - * <li>PART_MAX_BUTTON</li> + * <li>PART_MAX_BUTTON</li> * <li>PART_MIN_BUTTON</li> * <li>PART_CHEVRON_BUTTON</li> * <li>PART_CLOSE_BUTTON</li> @@ -568,7 +568,7 @@ * </ul> * </p> * <p> - * The <code>state</code> parameter may be a combination of: + * The <code>state</code> parameter may be a combination of: * <ul> * <li>SWT.BACKGROUND - whether the background should be drawn</li> * <li>SWT.FOREGROUND - whether the foreground should be drawn</li> @@ -576,12 +576,12 @@ * <li>SWT.HOT - whether the part is hot (i.e. mouse is over the part)</li> * </ul> * </p> - * - * @param part part to draw - * @param state state of the part + * + * @param part part to draw + * @param state state of the part * @param bounds the bounds of the part * @param gc the gc to draw the part on - * + * * @since 3.6 */ protected void draw (int part, int state, Rectangle bounds, GC gc) { @@ -616,24 +616,24 @@ break; } } - + void drawBackground(GC gc, Rectangle bounds, int state) { boolean selected = (state & SWT.SELECTED) != 0; Color defaultBackground = selected ? parent.selectionBackground : parent.getBackground(); Image image = selected ? parent.selectionBgImage : null; Color[] colors = selected ? parent.selectionGradientColors : parent.gradientColors; int[] percents = selected ? parent.selectionGradientPercents : parent.gradientPercents; - boolean vertical = selected ? parent.selectionGradientVertical : parent.gradientVertical; - + boolean vertical = selected ? parent.selectionGradientVertical : parent.gradientVertical; + drawBackground(gc, null, bounds.x, bounds.y, bounds.width, bounds.height, defaultBackground, image, colors, percents, vertical); } - + void drawBackground(GC gc, int[] shape, boolean selected) { Color defaultBackground = selected ? parent.selectionBackground : parent.getBackground(); Image image = selected ? parent.selectionBgImage : null; Color[] colors = selected ? parent.selectionGradientColors : parent.gradientColors; int[] percents = selected ? parent.selectionGradientPercents : parent.gradientPercents; - boolean vertical = selected ? parent.selectionGradientVertical : parent.gradientVertical; + boolean vertical = selected ? parent.selectionGradientVertical : parent.gradientVertical; Point size = parent.getSize(); int width = size.x; int height = parent.tabHeight + ((parent.getStyle() & SWT.FLAT) != 0 ? 1 : 3); @@ -642,17 +642,17 @@ int borderLeft = parent.borderVisible ? 1 : 0; int borderTop = parent.onBottom ? borderLeft : 0; int borderBottom = parent.onBottom ? 0 : borderLeft; - + if (borderLeft > 0) { x += 1; width -= 2; } int y = parent.onBottom ? size.y - borderBottom - height : borderTop; drawBackground(gc, shape, x, y, width, height, defaultBackground, image, colors, percents, vertical); } - + void drawBackground(GC gc, int[] shape, int x, int y, int width, int height, Color defaultBackground, Image image, Color[] colors, int[] percents, boolean vertical) { Region clipping = null, region = null; - if (shape != null) { + if (shape != null) { clipping = new Region(); gc.getClipping(clipping); region = new Region(); @@ -746,15 +746,15 @@ region.dispose(); } } - + /* * Draw the border of the tab - * + * * @param gc * @param shape */ void drawBorder(GC gc, int[] shape) { - + gc.setForeground(parent.getDisplay().getSystemColor(BORDER1_COLOR)); gc.drawPolyline(shape); } @@ -763,16 +763,16 @@ Point size = new Point(bounds.width, bounds.height); int selectedIndex = parent.selectedIndex; int tabHeight = parent.tabHeight; - + int borderLeft = parent.borderVisible ? 1 : 0; int borderRight = borderLeft; int borderTop = parent.onBottom ? borderLeft : 0; int borderBottom = parent.onBottom ? 0 : borderLeft; - + int style = parent.getStyle(); int highlight_header = (style & SWT.FLAT) != 0 ? 1 : 3; int highlight_margin = (style & SWT.FLAT) != 0 ? 0 : 2; - + // fill in body if (!parent.minimized){ int width = size.x - borderLeft - borderRight - 2*highlight_margin; @@ -788,12 +788,12 @@ shape = new int[] {x1,y1, x2,y1, x2,y2, x2-highlight_margin,y2, x2-highlight_margin, y1+highlight_margin, x1+highlight_margin,y1+highlight_margin, x1+highlight_margin,y2, x1,y2}; - } else { + } else { int x1 = borderLeft; int y1 = borderTop + tabHeight + highlight_header; int x2 = size.x - borderRight; int y2 = size.y - borderBottom; - shape = new int[] {x1,y1, x1+highlight_margin,y1, x1+highlight_margin,y2-highlight_margin, + shape = new int[] {x1,y1, x1+highlight_margin,y1, x1+highlight_margin,y2-highlight_margin, x2-highlight_margin,y2-highlight_margin, x2-highlight_margin,y1, x2,y1, x2,y2, x1,y2}; } @@ -816,7 +816,7 @@ if (parent.onBottom) { yClient = borderTop + highlight_margin + marginHeight; } else { - yClient = borderTop + tabHeight + highlight_header + marginHeight; + yClient = borderTop + tabHeight + highlight_header + marginHeight; } gc.fillRectangle(xClient - marginWidth, yClient - marginHeight, width, height); } @@ -829,7 +829,7 @@ } } } - + //draw 1 pixel border around outside if (borderLeft > 0) { gc.setForeground(parent.getDisplay().getSystemColor(BORDER1_COLOR)); @@ -846,20 +846,20 @@ } } } - + void drawClose(GC gc, Rectangle closeRect, int closeImageState) { if (closeRect.width == 0 || closeRect.height == 0) return; Display display = parent.getDisplay(); - + // draw X 9x9 int x = closeRect.x + Math.max(1, (closeRect.width-9)/2); int y = closeRect.y + Math.max(1, (closeRect.height-9)/2); y += parent.onBottom ? -1 : 1; - + Color closeBorder = display.getSystemColor(BUTTON_BORDER); switch (closeImageState & (SWT.HOT | SWT.SELECTED | SWT.BACKGROUND)) { case SWT.NONE: { - int[] shape = new int[] {x,y, x+2,y, x+4,y+2, x+5,y+2, x+7,y, x+9,y, + int[] shape = new int[] {x,y, x+2,y, x+4,y+2, x+5,y+2, x+7,y, x+9,y, x+9,y+2, x+7,y+4, x+7,y+5, x+9,y+7, x+9,y+9, x+7,y+9, x+5,y+7, x+4,y+7, x+2,y+9, x,y+9, x,y+7, x+2,y+5, x+2,y+4, x,y+2}; @@ -870,7 +870,7 @@ break; } case SWT.HOT: { - int[] shape = new int[] {x,y, x+2,y, x+4,y+2, x+5,y+2, x+7,y, x+9,y, + int[] shape = new int[] {x,y, x+2,y, x+4,y+2, x+5,y+2, x+7,y, x+9,y, x+9,y+2, x+7,y+4, x+7,y+5, x+9,y+7, x+9,y+9, x+7,y+9, x+5,y+7, x+4,y+7, x+2,y+9, x,y+9, x,y+7, x+2,y+5, x+2,y+4, x,y+2}; @@ -881,7 +881,7 @@ break; } case SWT.SELECTED: { - int[] shape = new int[] {x+1,y+1, x+3,y+1, x+5,y+3, x+6,y+3, x+8,y+1, x+10,y+1, + int[] shape = new int[] {x+1,y+1, x+3,y+1, x+5,y+3, x+6,y+3, x+8,y+1, x+10,y+1, x+10,y+3, x+8,y+5, x+8,y+6, x+10,y+8, x+10,y+10, x+8,y+10, x+6,y+8, x+5,y+8, x+3,y+10, x+1,y+10, x+1,y+8, x+3,y+6, x+3,y+5, x+1,y+3}; @@ -935,9 +935,9 @@ gc.drawLine(x+1,y, x+3,y+2); gc.drawLine(x+3,y+2, x+1,y+4); gc.drawLine(x+4,y, x+6,y+2); - gc.drawLine(x+6,y+2, x+5,y+4); + gc.drawLine(x+6,y+2, x+4,y+4); gc.drawLine(x+5,y, x+7,y+2); - gc.drawLine(x+7,y+2, x+4,y+4); + gc.drawLine(x+7,y+2, x+5,y+4); gc.drawString(chevronString, x+7, y+3, true); break; } @@ -952,9 +952,9 @@ gc.drawLine(x+1,y, x+3,y+2); gc.drawLine(x+3,y+2, x+1,y+4); gc.drawLine(x+4,y, x+6,y+2); - gc.drawLine(x+6,y+2, x+5,y+4); + gc.drawLine(x+6,y+2, x+4,y+4); gc.drawLine(x+5,y, x+7,y+2); - gc.drawLine(x+7,y+2, x+4,y+4); + gc.drawLine(x+7,y+2, x+5,y+4); gc.drawString(chevronString, x+7, y+3, true); break; } @@ -969,9 +969,9 @@ gc.drawLine(x+2,y+1, x+4,y+3); gc.drawLine(x+4,y+3, x+2,y+5); gc.drawLine(x+5,y+1, x+7,y+3); - gc.drawLine(x+7,y+3, x+6,y+5); + gc.drawLine(x+7,y+3, x+5,y+5); gc.drawLine(x+6,y+1, x+8,y+3); - gc.drawLine(x+8,y+3, x+5,y+5); + gc.drawLine(x+8,y+3, x+6,y+5); gc.drawString(chevronString, x+8, y+4, true); break; } @@ -988,7 +988,7 @@ //only draw for curvy tabs and only draw for top tabs if(parent.simple || parent.onBottom) return; - + if(selectionHighlightGradientBegin == null) return; @@ -1001,16 +1001,16 @@ int x = bounds.x; int y = bounds.y; - + gc.setForeground(gradients[0]); - + //draw top horizontal line gc.drawLine( TOP_LEFT_CORNER_HILITE[0] + x + 1, //rely on fact that first pair is top/right of curve 1 + y, rightEdge - curveIndent, 1 + y); - + int[] leftHighlightCurve = TOP_LEFT_CORNER_HILITE; int d = parent.tabHeight - topCurveHighlightEnd.length /2; @@ -1018,7 +1018,7 @@ int lastX = 0; int lastY = 0; int lastColorIndex = 0; - + //draw upper left curve highlight for (int i = 0; i < leftHighlightCurve.length /2; i++) { int rawX = leftHighlightCurve[i * 2]; @@ -1034,9 +1034,9 @@ gc.setForeground(gradients[i]); gc.drawPoint(lastX, 1 + lastY++); } - + int rightEdgeOffset = rightEdge - curveIndent; - + //draw right swoop highlight up to diagonal portion for (int i = 0; i < topCurveHighlightStart.length /2; i++) { int rawX = topCurveHighlightStart[i * 2]; @@ -1068,25 +1068,25 @@ break; //can happen if tabs are unusually short and cut off the curve gc.setForeground(gradients[lastColorIndex]); gc.drawPoint(lastX, lastY); - } + } } /* * Draw the unselected border for the receiver on the left. - * + * * @param gc */ void drawLeftUnselectedBorder(GC gc, Rectangle bounds, int state) { int x = bounds.x; int y = bounds.y; int height = bounds.height; - + int[] shape = null; if (parent.onBottom) { int[] left = parent.simple ? SIMPLE_UNSELECTED_INNER_CORNER : BOTTOM_LEFT_CORNER; - + shape = new int[left.length + 2]; int index = 0; shape[index++] = x; @@ -1120,23 +1120,23 @@ // 5x4 or 7x9 int x = maxRect.x + (maxRect.width - 10)/2; int y = maxRect.y + 3; - + gc.setForeground(display.getSystemColor(BUTTON_BORDER)); gc.setBackground(display.getSystemColor(BUTTON_FILL)); - + switch (maxImageState & (SWT.HOT | SWT.SELECTED)) { case SWT.NONE: { if (!parent.getMaximized()) { gc.fillRectangle(x, y, 9, 9); gc.drawRectangle(x, y, 9, 9); - gc.drawLine(x+1, y+2, x+8, y+2); + gc.drawLine(x, y+2, x+9, y+2); } else { gc.fillRectangle(x, y+3, 5, 4); gc.fillRectangle(x+2, y, 5, 4); gc.drawRectangle(x, y+3, 5, 4); gc.drawRectangle(x+2, y, 5, 4); - gc.drawLine(x+3, y+1, x+6, y+1); - gc.drawLine(x+1, y+4, x+4, y+4); + gc.drawLine(x+2, y+1, x+7, y+1); + gc.drawLine(x, y+4, x+5, y+4); } break; } @@ -1146,14 +1146,14 @@ if (!parent.getMaximized()) { gc.fillRectangle(x, y, 9, 9); gc.drawRectangle(x, y, 9, 9); - gc.drawLine(x+1, y+2, x+8, y+2); + gc.drawLine(x, y+2, x+9, y+2); } else { gc.fillRectangle(x, y+3, 5, 4); gc.fillRectangle(x+2, y, 5, 4); gc.drawRectangle(x, y+3, 5, 4); gc.drawRectangle(x+2, y, 5, 4); - gc.drawLine(x+3, y+1, x+6, y+1); - gc.drawLine(x+1, y+4, x+4, y+4); + gc.drawLine(x+2, y+1, x+7, y+1); + gc.drawLine(x, y+4, x+5, y+4); } break; } @@ -1163,14 +1163,14 @@ if (!parent.getMaximized()) { gc.fillRectangle(x+1, y+1, 9, 9); gc.drawRectangle(x+1, y+1, 9, 9); - gc.drawLine(x+2, y+3, x+9, y+3); + gc.drawLine(x+1, y+3, x+10, y+3); } else { gc.fillRectangle(x+1, y+4, 5, 4); gc.fillRectangle(x+3, y+1, 5, 4); gc.drawRectangle(x+1, y+4, 5, 4); gc.drawRectangle(x+3, y+1, 5, 4); - gc.drawLine(x+4, y+2, x+7, y+2); - gc.drawLine(x+2, y+5, x+5, y+5); + gc.drawLine(x+3, y+2, x+8, y+2); + gc.drawLine(x+1, y+5, x+6, y+5); } break; } @@ -1182,10 +1182,10 @@ // 5x4 or 9x3 int x = minRect.x + (minRect.width - 10)/2; int y = minRect.y + 3; - + gc.setForeground(display.getSystemColor(BUTTON_BORDER)); gc.setBackground(display.getSystemColor(BUTTON_FILL)); - + switch (minImageState & (SWT.HOT | SWT.SELECTED)) { case SWT.NONE: { if (!parent.getMinimized()) { @@ -1238,7 +1238,7 @@ /* * Draw the unselected border for the receiver on the right. - * + * * @param gc */ void drawRightUnselectedBorder(GC gc, Rectangle bounds, int state) { @@ -1246,18 +1246,18 @@ int y = bounds.y; int width = bounds.width; int height = bounds.height; - + int[] shape = null; int startX = x + width - 1; - + if (parent.onBottom) { int[] right = parent.simple ? SIMPLE_UNSELECTED_INNER_CORNER : BOTTOM_RIGHT_CORNER; - + shape = new int[right.length + 2]; int index = 0; - + for (int i = 0; i < right.length / 2; i++) { shape[index++] = startX + right[2 * i]; shape[index++] = y + height + right[2 * i + 1] - 1; @@ -1268,22 +1268,22 @@ int[] right = parent.simple ? SIMPLE_UNSELECTED_INNER_CORNER : TOP_RIGHT_CORNER; - + shape = new int[right.length + 2]; int index = 0; - + for (int i = 0; i < right.length / 2; i++) { shape[index++] = startX + right[2 * i]; shape[index++] = y + right[2 * i + 1]; } - + shape[index++] = startX; shape[index++] = y + height; - + } - + drawBorder(gc, shape); - + } void drawSelected(int itemIndex, GC gc, Rectangle bounds, int state ) { @@ -1297,12 +1297,12 @@ int borderRight = borderLeft; int borderTop = parent.onBottom ? borderLeft : 0; int borderBottom = parent.onBottom ? 0 : borderLeft; - + Point size = parent.getSize(); - + int rightEdge = Math.min (x + width, parent.getRightItemEdge(gc)); // Draw selection border across all tabs - + if ((state & SWT.BACKGROUND) != 0) { int highlight_header = (parent.getStyle() & SWT.FLAT) != 0 ? 1 : 3; int xx = borderLeft; @@ -1316,7 +1316,7 @@ gc.setBackground(parent.selectionBackground); gc.fillRectangle(xx, yy, ww, hh); } - + if (parent.single) { if (!item.showing) return; } else { @@ -1330,7 +1330,7 @@ gc.drawLine(x1, y1, x2, y1); return; } - + // draw selected tab background and outline shape = null; if (parent.onBottom) { @@ -1382,13 +1382,13 @@ shape[index++] = parent.simple ? rightEdge - 1 : rightEdge + curveWidth - curveIndent; shape[index++] = y + height + 1; } - + Rectangle clipping = gc.getClipping(); Rectangle clipBounds = item.getBounds(); clipBounds.height += 1; if (parent.onBottom) clipBounds.y -= 1; boolean tabInPaint = clipping.intersects(clipBounds); - + if (tabInPaint) { // fill in tab background if (parent.selectionGradientColors != null && !parent.selectionGradientVertical) { @@ -1407,15 +1407,15 @@ drawBackground(gc, shape, xx, yy, ww, hh, defaultBackground, image, colors, percents, vertical); } } - + //Highlight MUST be drawn before the outline so that outline can cover it in the right spots (start of swoop) //otherwise the curve looks jagged drawHighlight(gc, bounds, state, rightEdge); - + // draw outline shape[0] = Math.max(0, borderLeft - 1); if (borderLeft == 0 && itemIndex == parent.firstIndex) { - shape[1] = parent.onBottom ? y + height - 1 : y; + shape[1] = parent.onBottom ? y + height - 1 : y; shape[5] = shape[3] = shape[1]; } shape[shape.length - 2] = size.x - borderRight + 1; @@ -1427,16 +1427,16 @@ antialias(shape, selectedInnerColor, selectedOuterColor, gc); gc.setForeground(borderColor); gc.drawPolyline(shape); - + if (!tabInPaint) return; } } - + if ((state & SWT.FOREGROUND) != 0) { // draw Image Rectangle trim = computeTrim(itemIndex, SWT.NONE, 0, 0, 0, 0); int xDraw = x - trim.x; - if (parent.single && (parent.showClose || item.showClose)) xDraw += item.closeRect.width; + if (parent.single && (parent.showClose || item.showClose)) xDraw += item.closeRect.width; Image image = item.getImage(); if (image != null && !image.isDisposed()) { Rectangle imageBounds = image.getBounds(); @@ -1451,26 +1451,26 @@ xDraw += imageBounds.width + INTERNAL_SPACING; } } - + // draw Text int textWidth = rightEdge - xDraw - (trim.width + trim.x); if (!parent.single && item.closeRect.width > 0) textWidth -= item.closeRect.width + INTERNAL_SPACING; if (textWidth > 0) { Font gcFont = gc.getFont(); gc.setFont(item.font == null ? parent.getFont() : item.font); - + if (item.shortenedText == null || item.shortenedTextWidth != textWidth) { item.shortenedText = shortenText(gc, item.getText(), textWidth); item.shortenedTextWidth = textWidth; } - Point extent = gc.textExtent(item.shortenedText, FLAGS); + Point extent = gc.textExtent(item.shortenedText, FLAGS); int textY = y + (height - extent.y) / 2; textY += parent.onBottom ? -1 : 1; - + gc.setForeground(parent.selectionForeground); gc.drawText(item.shortenedText, xDraw, textY, FLAGS); gc.setFont(gcFont); - + // draw a Focus rectangle if (parent.isFocusControl()) { Display display = parent.getDisplay(); @@ -1494,12 +1494,12 @@ Color borderColor = parent.getDisplay().getSystemColor(BORDER1_COLOR); int tabHeight = parent.tabHeight; int style = parent.getStyle(); - + int borderLeft = parent.borderVisible ? 1 : 0; int borderRight = borderLeft; int borderTop = parent.onBottom ? borderLeft : 0; int borderBottom = parent.onBottom ? 0 : borderLeft; - + int selectedIndex = parent.selectedIndex; int highlight_header = (style & SWT.FLAT) != 0 ? 1 : 3; if (tabHeight == 0) { @@ -1509,9 +1509,9 @@ int y1 = parent.onBottom ? size.y - borderBottom - highlight_header - 1 : borderTop + highlight_header; int y2 = parent.onBottom ? size.y - borderBottom : borderTop; if (borderLeft > 0 && parent.onBottom) y2 -= 1; - + shape = new int[] {x1, y1, x1,y2, x2,y2, x2,y1}; - + // If horizontal gradient, show gradient across the whole area if (selectedIndex != -1 && parent.selectionGradientColors != null && parent.selectionGradientColors.length > 1 && !parent.selectionGradientVertical) { drawBackground(gc, shape, true); @@ -1521,15 +1521,15 @@ gc.setBackground(selectedIndex == -1 ? parent.getBackground() : parent.selectionBackground); gc.fillPolygon(shape); } - + //draw 1 pixel border if (borderLeft > 0) { gc.setForeground(borderColor); - gc.drawPolyline(shape); + gc.drawPolyline(shape); } return; } - + int x = Math.max(0, borderLeft - 1); int y = parent.onBottom ? size.y - borderBottom - tabHeight : borderTop; int width = size.x - borderLeft - borderRight + 1; @@ -1596,7 +1596,7 @@ gc.setBackground(parent.getParent().getBackground()); fillRegion(gc, r); r.dispose(); - + // Draw selected tab if (selectedIndex == -1) { // if no selected tab - draw line across bottom of all tabs @@ -1606,14 +1606,14 @@ gc.setForeground(borderColor); gc.drawLine(x1, y1, x2, y1); } - + // Draw border line if (borderLeft > 0) { if (! borderColor.equals(lastBorderColor)) createAntialiasColors(); antialias(shape, null, tabAreaColor, gc); gc.setForeground(borderColor); gc.drawPolyline(shape); - } + } } void drawUnselected(int index, GC gc, Rectangle bounds, int state) { @@ -1622,13 +1622,13 @@ int y = bounds.y; int height = bounds.height; int width = bounds.width; - + // Do not draw partial items if (!item.showing) return; - + Rectangle clipping = gc.getClipping(); if (!clipping.intersects(bounds)) return; - + if ((state & SWT.BACKGROUND) != 0) { if (index > 0 && index < parent.selectedIndex) drawLeftUnselectedBorder(gc, bounds, state); @@ -1636,7 +1636,7 @@ if (index > parent.selectedIndex) drawRightUnselectedBorder(gc, bounds, state); } - + if ((state & SWT.FOREGROUND) != 0) { // draw Image Rectangle trim = computeTrim(index, SWT.NONE, 0, 0, 0, 0); @@ -1649,13 +1649,13 @@ if (parent.showUnselectedClose && (parent.showClose || item.showClose)) { maxImageWidth -= item.closeRect.width + INTERNAL_SPACING; } - if (imageBounds.width < maxImageWidth) { + if (imageBounds.width < maxImageWidth) { int imageX = xDraw; int imageHeight = imageBounds.height; int imageY = y + (height - imageHeight) / 2; imageY += parent.onBottom ? -1 : 1; int imageWidth = imageBounds.width * imageHeight / imageBounds.height; - gc.drawImage(image, + gc.drawImage(image, imageBounds.x, imageBounds.y, imageBounds.width, imageBounds.height, imageX, imageY, imageWidth, imageHeight); xDraw += imageWidth + INTERNAL_SPACING; @@ -1672,7 +1672,7 @@ if (item.shortenedText == null || item.shortenedTextWidth != textWidth) { item.shortenedText = shortenText(gc, item.getText(), textWidth); item.shortenedTextWidth = textWidth; - } + } Point extent = gc.textExtent(item.shortenedText, FLAGS); int textY = y + (height - extent.y) / 2; textY += parent.onBottom ? -1 : 1; @@ -1695,14 +1695,14 @@ gc.setClipping(clipping); clipping.dispose(); } - + Color getFillColor() { if (fillColor == null) { fillColor = new Color(parent.getDisplay(), CLOSE_FILL); } return fillColor; } - + /* * Return true if given start color, the cache of highlight colors we have * would match the highlight colors we'd compute. @@ -1711,7 +1711,7 @@ if(selectionHighlightGradientColorsCache == null) return false; - + //this case should never happen but check to be safe before accessing array indexes if(selectionHighlightGradientColorsCache.length < 2) return false; @@ -1720,16 +1720,16 @@ Color highlightEnd = selectionHighlightGradientColorsCache[selectionHighlightGradientColorsCache.length - 1]; if(! highlightBegin.equals(start)) - return false; - + return false; + //Compare number of colours we have vs. we'd compute if(selectionHighlightGradientColorsCache.length != parent.tabHeight) return false; - + //Compare existing highlight end to what it would be (selectionBackground) if(! highlightEnd.equals(parent.selectionBackground)) return false; - + return true; } @@ -1738,25 +1738,25 @@ //Set to null to match all the early return cases. //For early returns, don't realloc the cache, we may get a cache hit next time we're given the highlight selectionHighlightGradientBegin = null; - + if(start == null) return; - + //don't bother on low colour if (parent.getDisplay().getDepth() < 15) return; - + //don't bother if we don't have a background gradient - if(parent.selectionGradientColors.length < 2) + if(parent.selectionGradientColors.length < 2) return; - + //OK we know its a valid gradient now selectionHighlightGradientBegin = start; - + if(! isSelectionHighlightColorsCacheHit(start)) createSelectionHighlightGradientColors(start); //if no cache hit then compute new ones } - + String shortenText(GC gc, String text, int width) { return useEllipses() ? shortenText(gc, text, width, ELLIPSIS) @@ -1781,7 +1781,7 @@ layout.dispose(); return end == 0 ? text.substring(0, 1) : text + ellipses; } - + void updateCurves () { //Temp fix for Bug 384743 if (this.getClass().getName().equals("org.eclipse.e4.ui.workbench.renderers.swt.CTabRendering")) return; @@ -1791,9 +1791,9 @@ int d = tabHeight - 12; curve = new int[]{0,13+d, 0,12+d, 2,12+d, 3,11+d, 5,11+d, 6,10+d, 7,10+d, 9,8+d, 10,8+d, 11,7+d, 11+d,7, - 12+d,6, 13+d,6, 15+d,4, 16+d,4, 17+d,3, 19+d,3, 20+d,2, 22+d,2, 23+d,1}; + 12+d,6, 13+d,6, 15+d,4, 16+d,4, 17+d,3, 19+d,3, 20+d,2, 22+d,2, 23+d,1}; curveWidth = 26+d; - curveIndent = curveWidth/3; + curveIndent = curveWidth/3; } else { int d = tabHeight - 12; curve = new int[]{0,0, 0,1, 2,1, 3,2, 5,2, 6,3, 7,3, 9,5, 10,5, @@ -1801,24 +1801,24 @@ 12+d,7+d, 13+d,7+d, 15+d,9+d, 16+d,9+d, 17+d,10+d, 19+d,10+d, 20+d,11+d, 22+d,11+d, 23+d,12+d}; curveWidth = 26+d; curveIndent = curveWidth/3; - + //this could be static but since values depend on curve, better to keep in one place - topCurveHighlightStart = new int[] { - 0, 2, 1, 2, 2, 2, - 3, 3, 4, 3, 5, 3, + topCurveHighlightStart = new int[] { + 0, 2, 1, 2, 2, 2, + 3, 3, 4, 3, 5, 3, 6, 4, 7, 4, - 8, 5, + 8, 5, 9, 6, 10, 6}; - + //also, by adding in 'd' here we save some math cost when drawing the curve - topCurveHighlightEnd = new int[] { + topCurveHighlightEnd = new int[] { 10+d, 6+d, 11+d, 7+d, 12+d, 8+d, 13+d, 8+d, 14+d, 9+d, 15+d, 10+d, 16+d, 10+d, 17+d, 11+d, 18+d, 11+d, 19+d, 11+d, - 20+d, 12+d, 21+d, 12+d, 22+d, 12+d }; + 20+d, 12+d, 21+d, 12+d, 22+d, 12+d }; } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/CTabItem.java swt4-gtk-4.6.0/org/eclipse/swt/custom/CTabItem.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/CTabItem.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/CTabItem.java 2016-07-06 19:11:33.000000000 +0000 @@ -18,7 +18,7 @@ /** * Instances of this class represent a selectable user interface object * that represent a page in a notebook widget. - * + * * <dl> * <dt><b>Styles:</b></dt> * <dd>SWT.CLOSE</dd> @@ -37,15 +37,15 @@ CTabFolder parent; int x,y,width,height = 0; Control control; // the tab page - + String toolTipText; String shortenedText; int shortenedTextWidth; - + // Appearance Font font; - Image disabledImage; - + Image disabledImage; + Rectangle closeRect = new Rectangle(0, 0, 0, 0); int closeImageState = SWT.BACKGROUND; int state = SWT.NONE; @@ -60,7 +60,7 @@ * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -91,7 +91,7 @@ * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -165,14 +165,14 @@ } /** * Get the image displayed in the tab if the tab is disabled. - * + * * @return the disabled image or null - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @deprecated the disabled image is not used */ @Deprecated @@ -189,7 +189,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.0 */ public Font getFont() { @@ -201,7 +201,7 @@ * Returns the receiver's parent, which must be a <code>CTabFolder</code>. * * @return the receiver's parent - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -215,14 +215,14 @@ * Returns <code>true</code> to indicate that the receiver's close button should be shown. * Otherwise return <code>false</code>. The initial value is defined by the style (SWT.CLOSE) * that was used to create the receiver. - * + * * @return <code>true</code> if the close button should be shown * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.4 */ public boolean getShowClose() { @@ -250,14 +250,14 @@ } /** * Returns <code>true</code> if the item will be rendered in the visible area of the CTabFolder. Returns false otherwise. -* +* * @return <code>true</code> if the item will be rendered in the visible area of the CTabFolder. Returns false otherwise. -* +* * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.0 */ public boolean isShowing () { @@ -272,7 +272,7 @@ * @param control the new control (or null) * * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li> + * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li> * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree</li> * </ul> * @exception SWTException <ul> @@ -310,14 +310,14 @@ /** * Sets the image that is displayed if the tab item is disabled. * Null will clear the image. - * + * * @param image the image to be displayed when the item is disabled or null * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @deprecated This image is not used */ @Deprecated @@ -339,13 +339,13 @@ * @param font the new font (or null) * * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> + * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.0 */ public void setFont (Font font){ @@ -374,14 +374,14 @@ * Sets to <code>true</code> to indicate that the receiver's close button should be shown. * If the parent (CTabFolder) was created with SWT.CLOSE style, changing this value has * no effect. - * + * * @param close the new state of the close button * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.4 */ public void setShowClose(boolean close) { @@ -402,14 +402,14 @@ } /** * Sets the receiver's tool tip text to the argument, which - * may be null indicating that the default tool tip for the + * may be null indicating that the default tool tip for the * control will be shown. For a control that has a default * tool tip, such as the Tree control on Windows, setting * the tool tip text to an empty string replaces the default, * causing no tool tip text to be shown. * <p> * The mnemonic indicator (character '&') is not displayed in a tool tip. - * To display a single '&' in the tool tip, the character '&' can be + * To display a single '&' in the tool tip, the character '&' can be * escaped by doubling it in the string. * </p> * diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/DefaultContent.java swt4-gtk-4.6.0/org/eclipse/swt/custom/DefaultContent.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/DefaultContent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/DefaultContent.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -10,29 +10,30 @@ *******************************************************************************/ package org.eclipse.swt.custom; +import java.util.*; +import java.util.List; + import org.eclipse.swt.*; -import org.eclipse.swt.internal.Compatibility; +import org.eclipse.swt.internal.*; import org.eclipse.swt.widgets.*; -import java.util.Vector; - class DefaultContent implements StyledTextContent { private final static String LineDelimiter = System.getProperty("line.separator"); - Vector<StyledTextListener> textListeners = new Vector<StyledTextListener>(); // stores text listeners for event sending + List<StyledTextListener> textListeners = new ArrayList<>(); // stores text listeners for event sending char[] textStore = new char[0]; // stores the actual text int gapStart = -1; // the character position start of the gap int gapEnd = -1; // the character position after the end of the gap int gapLine = -1; // the line on which the gap exists, the gap will always be associated with one line - int highWatermark = 300; - int lowWatermark = 50; - + int highWatermark = 300; + int lowWatermark = 50; + int[][] lines = new int[50][2]; // array of character positions and lengths representing the lines of text - int lineCount = 0; // the number of lines of text + int lineCount = 0; // the number of lines of text int expandExp = 1; // the expansion exponent, used to increase the lines array exponentially int replaceExpandExp = 1; // the expansion exponent, used to increase the lines array exponentially -/** +/** * Creates a new DefaultContent and initializes it. A <code>StyledTextContent</> will always have * at least one empty line. */ @@ -40,7 +41,7 @@ super(); setText(""); } -/** +/** * Adds a line to the end of the line indexes array. Increases the size of the array if necessary. * <code>lineCount</code> is updated to reflect the new entry. * <p> @@ -61,8 +62,8 @@ lines[lineCount] = range; lineCount++; } -/** - * Adds a line index to the end of <code>linesArray</code>. Increases the +/** + * Adds a line index to the end of <code>linesArray</code>. Increases the * size of the array if necessary and returns a new array. * <p> * @@ -85,10 +86,10 @@ return newLines; } /** - * Adds a <code>TextChangeListener</code> listening for - * <code>TextChangingEvent</code> and <code>TextChangedEvent</code>. A + * Adds a <code>TextChangeListener</code> listening for + * <code>TextChangingEvent</code> and <code>TextChangedEvent</code>. A * <code>TextChangingEvent</code> is sent before changes to the text occur. - * A <code>TextChangedEvent</code> is sent after changes to the text + * A <code>TextChangedEvent</code> is sent after changes to the text * occurred. * <p> * @@ -97,6 +98,7 @@ * <li>ERROR_NULL_ARGUMENT when listener is null</li> * </ul> */ +@Override public void addTextChangeListener(TextChangeListener listener) { if (listener == null) error(SWT.ERROR_NULL_ARGUMENT); StyledTextListener typedListener = new StyledTextListener(listener); @@ -125,7 +127,7 @@ moveAndResizeGap(position, sizeHint, line); } /** - * Calculates the indexes of each line in the text store. Assumes no gap exists. + * Calculates the indexes of each line in the text store. Assumes no gap exists. * Optimized to do less checking. */ void indexLines(){ @@ -134,7 +136,7 @@ int textLength = textStore.length; int i; for (i = start; i < textLength; i++) { - char ch = textStore[i]; + char ch = textStore[i]; if (ch == SWT.CR) { // see if the next character is a LF if (i + 1 < textLength) { @@ -152,8 +154,8 @@ } addLineIndex(start, i - start); } -/** - * Returns whether or not the given character is a line delimiter. Both CR and LF +/** + * Returns whether or not the given character is a line delimiter. Both CR and LF * are valid line delimiters. * <p> * @@ -164,7 +166,7 @@ if (ch == SWT.CR) return true; if (ch == SWT.LF) return true; return false; -} +} /** * Determine whether or not the replace operation is valid. DefaultContent will not allow * the /r/n line delimiter to be split or partially deleted. @@ -203,7 +205,7 @@ if (after == '\n') return false; } } - } + } return true; } /** @@ -214,7 +216,7 @@ * @param length the length of the text to lineate, includes gap * @param numLines the number of lines to initially allocate for the line index array, * passed in for efficiency (the exact number of lines may be known) - * @return a line indexes array where each line is identified by a start offset and + * @return a line indexes array where each line is identified by a start offset and * a length */ int[][] indexLines(int offset, int length, int numLines){ @@ -224,18 +226,18 @@ int i; replaceExpandExp = 1; for (i = start; i < length; i++) { - int location = i + offset; + int location = i + offset; if ((location >= gapStart) && (location < gapEnd)) { // ignore the gap } else { - char ch = textStore[location]; + char ch = textStore[location]; if (ch == SWT.CR) { // see if the next character is a LF if (location+1 < textStore.length) { ch = textStore[location+1]; if (ch == SWT.LF) { i++; - } + } } indexedLines = addLineIndex(start, i - start + 1, indexedLines, lineCount); lineCount++; @@ -251,7 +253,7 @@ System.arraycopy(indexedLines, 0, newLines, 0, lineCount); int[] range = new int[] {start, i - start}; newLines[lineCount] = range; - return newLines; + return newLines; } /** * Inserts text. @@ -260,9 +262,9 @@ * @param position the position at which to insert the text * @param text the text to insert */ -void insert(int position, String text) { +void insert(int position, String text) { if (text.length() == 0) return; - + int startLine = getLineAtOffset(position); int change = text.length(); boolean endInsert = position == getCharCount(); @@ -270,20 +272,20 @@ // during an insert the gap will be adjusted to start at // position and it will be associated with startline, the - // inserted text will be placed in the gap + // inserted text will be placed in the gap int startLineOffset = getOffsetAtLine(startLine); // at this point, startLineLength will include the start line // and all of the newly inserted text int startLineLength = getPhysicalLine(startLine).length(); - + if (change > 0) { - // shrink gap + // shrink gap gapStart += (change); for (int i = 0; i < text.length(); i++) { textStore[position + i]= text.charAt(i); } } - + // figure out the number of new lines that have been inserted int [][] newLines = indexLines(startLineOffset, startLineLength, 10); // only insert an empty line if it is the last line in the text @@ -293,13 +295,13 @@ if (endInsert) { // insert happening at end of the text, leave numNewLines as // is since the last new line will not be concatenated with another - // line + // line numNewLines += 1; } else { numNewLines -= 1; } } - + // make room for the new lines expandLinesBy(numNewLines); // shift down the lines after the replace line @@ -316,13 +318,13 @@ newLines[numNewLines][0] += startLineOffset; lines[startLine + numNewLines] = newLines[numNewLines]; } - + lineCount += numNewLines; gapLine = getLineAtPhysicalOffset(gapStart); } /** - * Moves the gap and adjusts its size in anticipation of a text change. - * The gap is resized to actual size + the specified size and moved to the given + * Moves the gap and adjusts its size in anticipation of a text change. + * The gap is resized to actual size + the specified size and moved to the given * position. * <p> * @@ -348,7 +350,7 @@ lines[i][0] = lines[i][0] - oldSize; } } - + if (newSize < 0) { if (oldSize > 0) { // removing the gap @@ -365,7 +367,7 @@ int newGapEnd = newGapStart + newSize; if (oldSize == 0) { System.arraycopy(textStore, 0, content, 0, newGapStart); - System.arraycopy(textStore, newGapStart, content, newGapEnd, content.length - newGapEnd); + System.arraycopy(textStore, newGapStart, content, newGapEnd, content.length - newGapEnd); } else if (newGapStart < gapStart) { int delta = gapStart - newGapStart; System.arraycopy(textStore, 0, content, 0, newGapStart); @@ -380,7 +382,7 @@ textStore = content; gapStart = newGapStart; gapEnd = newGapEnd; - + // add the new gap to the lines information if (gapExists()) { gapLine = newGapLine; @@ -393,7 +395,7 @@ } } } -/** +/** * Returns the number of lines that are in the specified text. * <p> * @@ -415,7 +417,7 @@ if ((i >= gapStart) && (i < gapEnd)) { // ignore the gap } else { - char ch = textStore[i]; + char ch = textStore[i]; if (ch == SWT.CR) { // see if the next character is a LF if (i + 1 < textStore.length) { @@ -423,8 +425,8 @@ if (ch == SWT.LF) { i++; count++; - } - } + } + } lineCount++; } else if (ch == SWT.LF) { lineCount++; @@ -435,7 +437,7 @@ } return lineCount; } -/** +/** * Returns the number of lines that are in the specified text. * <p> * @@ -456,11 +458,12 @@ lineCount++; } } - return lineCount; + return lineCount; } /** * @return the logical length of the text store */ +@Override public int getCharCount() { int length = gapEnd - gapStart; return (textStore.length - length); @@ -475,6 +478,7 @@ * <li>ERROR_INVALID_ARGUMENT when index is out of range</li> * </ul> */ +@Override public String getLine(int index) { if ((index >= lineCount) || (index < 0)) error(SWT.ERROR_INVALID_ARGUMENT); int start = lines[index][0]; @@ -500,7 +504,7 @@ } } /** - * Returns the line delimiter that should be used by the StyledText + * Returns the line delimiter that should be used by the StyledText * widget when inserting new lines. This delimiter may be different than the * delimiter that is used by the <code>StyledTextContent</code> interface. * <p> @@ -508,6 +512,7 @@ * @return the platform line delimiter as specified in the line.separator * system property. */ +@Override public String getLineDelimiter() { return LineDelimiter; } @@ -538,7 +543,7 @@ * <p> * * @param index the line index - * @return the physical line + * @return the physical line */ String getPhysicalLine(int index) { int start = lines[index][0]; @@ -548,6 +553,7 @@ /** * @return the number of lines in the text store */ +@Override public int getLineCount(){ return lineCount; } @@ -561,6 +567,7 @@ * <li>ERROR_INVALID_ARGUMENT when charPosition is out of range</li> * </ul> */ +@Override public int getLineAtOffset(int charPosition){ if ((charPosition > getCharCount()) || (charPosition < 0)) error(SWT.ERROR_INVALID_ARGUMENT); int position; @@ -572,12 +579,12 @@ position = charPosition + (gapEnd - gapStart); } - // if last line and the line is not empty you can ask for - // a position that doesn't exist (the one to the right of the + // if last line and the line is not empty you can ask for + // a position that doesn't exist (the one to the right of the // last character) - for inserting if (lineCount > 0) { int lastLine = lineCount - 1; - if (position == lines[lastLine][0] + lines[lastLine][1]) + if (position == lines[lastLine][0] + lines[lastLine][1]) return lastLine; } @@ -629,13 +636,14 @@ * Returns the logical offset of the given line. * <p> * - * @param lineIndex index of line + * @param lineIndex index of line * @return the logical starting offset of the line. When there are not any lines, * getOffsetAtLine(0) is a valid call that should answer 0. * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_ARGUMENT when lineIndex is out of range</li> * </ul> */ +@Override public int getOffsetAtLine(int lineIndex) { if (lineIndex == 0) return 0; if ((lineIndex >= lineCount) || (lineIndex < 0)) error(SWT.ERROR_INVALID_ARGUMENT); @@ -645,7 +653,7 @@ } else { return start; } -} +} /** * Increases the line indexes array to accommodate more lines. * <p> @@ -661,7 +669,7 @@ System.arraycopy(lines, 0, newLines, 0, size); lines = newLines; } -/** +/** * Reports an SWT error. * <p> * @@ -670,7 +678,7 @@ void error (int code) { SWT.error(code); } -/** +/** * Returns whether or not a gap exists in the text store. * <p> * @@ -700,6 +708,7 @@ * @param length the logical length of the text to return * @return the text */ +@Override public String getTextRange(int start, int length) { if (textStore == null) return ""; @@ -722,11 +731,12 @@ * <p> * * @param listener the listener which should no longer be notified - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when listener is null</li> * </ul> */ +@Override public void removeTextChangeListener(TextChangeListener listener){ if (listener == null) error(SWT.ERROR_NULL_ARGUMENT); for (int i = 0; i < textListeners.size(); i++) { @@ -738,13 +748,13 @@ } } /** - * Replaces the text with <code>newText</code> starting at position <code>start</code> + * Replaces the text with <code>newText</code> starting at position <code>start</code> * for a length of <code>replaceLength</code>. Notifies the appropriate listeners. * <p> * - * When sending the TextChangingEvent, <code>newLineCount</code> is the number of - * lines that are going to be inserted and <code>replaceLineCount</code> is - * the number of lines that are going to be deleted, based on the change + * When sending the TextChangingEvent, <code>newLineCount</code> is the number of + * lines that are going to be inserted and <code>replaceLineCount</code> is + * the number of lines that are going to be deleted, based on the change * that occurs visually. For example: * <ul> * <li>(replaceText,newText) ==> (replaceLineCount,newLineCount) @@ -756,17 +766,18 @@ * @param start start offset of text to replace * @param replaceLength start offset of text to replace * @param newText start offset of text to replace - * + * * @exception SWTException <ul> * <li>ERROR_INVALID_ARGUMENT when the text change results in a multi byte - * line delimiter being split or partially deleted. Splitting a line - * delimiter by inserting text between the CR and LF characters of the + * line delimiter being split or partially deleted. Splitting a line + * delimiter by inserting text between the CR and LF characters of the * \r\n delimiter or deleting part of this line delimiter is not supported</li> * </ul> */ +@Override public void replaceTextRange(int start, int replaceLength, String newText){ // check for invalid replace operations - if (!isValidReplace(start, replaceLength, newText)) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + if (!isValidReplace(start, replaceLength, newText)) SWT.error(SWT.ERROR_INVALID_ARGUMENT); // inform listeners StyledTextEvent event = new StyledTextEvent(this); @@ -797,12 +808,13 @@ } } /** - * Sets the content to text and removes the gap since there are no sensible predictions + * Sets the content to text and removes the gap since there are no sensible predictions * about where the next change will occur. * <p> * * @param text the text */ +@Override public void setText (String text){ textStore = text.toCharArray(); gapStart = -1; @@ -823,7 +835,7 @@ */ void delete(int position, int length, int numLines) { if (length == 0) return; - + int startLine = getLineAtOffset(position); int startLineOffset = getOffsetAtLine(startLine); int endLine = getLineAtOffset(position + length); @@ -839,14 +851,14 @@ adjustGap(position + length, -length, startLine); int [][] oldLines = indexLines(position, length + (gapEnd - gapStart), numLines); - + // enlarge the gap - the gap can be enlarged either to the // right or left if (position + length == gapStart) { gapStart -= length; } else { gapEnd += length; - } + } // figure out the length of the new concatenated line, do so by // finding the first line delimiter after position @@ -862,7 +874,7 @@ } } eol = true; - } + } } j++; } @@ -877,6 +889,6 @@ lines[i - numOldLines] = lines[i]; } lineCount -= numOldLines; - gapLine = getLineAtPhysicalOffset(gapStart); + gapLine = getLineAtPhysicalOffset(gapStart); } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/ExtendedModifyEvent.java swt4-gtk-4.6.0/org/eclipse/swt/custom/ExtendedModifyEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/ExtendedModifyEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/ExtendedModifyEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -19,12 +19,12 @@ */ public final class ExtendedModifyEvent extends TypedEvent { /** start offset of the new text */ - public int start; + public int start; /** length of the new text */ public int length; /** replaced text or empty string if no text was replaced */ public String replacedText; - + static final long serialVersionUID = 3258696507027830832L; /** diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/LineBackgroundEvent.java swt4-gtk-4.6.0/org/eclipse/swt/custom/LineBackgroundEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/LineBackgroundEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/LineBackgroundEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -19,22 +19,22 @@ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public class LineBackgroundEvent extends TypedEvent { - + /** * line start offset */ public int lineOffset; - + /** * line text */ public String lineText; - + /** * line background color */ - public Color lineBackground; - + public Color lineBackground; + static final long serialVersionUID = 3978711687853324342L; /** diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/LineBackgroundListener.java swt4-gtk-4.6.0/org/eclipse/swt/custom/LineBackgroundListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/LineBackgroundListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/LineBackgroundListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -21,7 +21,7 @@ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public interface LineBackgroundListener extends SWTEventListener { - + /** * This method is called when a line is about to be drawn in order to get its * background color. diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/LineStyleEvent.java swt4-gtk-4.6.0/org/eclipse/swt/custom/LineStyleEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/LineStyleEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/LineStyleEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -18,27 +18,27 @@ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public class LineStyleEvent extends TypedEvent { - + /** * line start offset (input) */ public int lineOffset; - + /** * line text (input) */ public String lineText; - + /** * line ranges (output) - * + * * @since 3.2 */ public int[] ranges; - + /** * line styles (output) - * + * * Note: Because a StyleRange includes the start and length, the * same instance cannot occur multiple times in the array of styles. * If the same style attributes, such as font and color, occur in @@ -47,30 +47,30 @@ */ public StyleRange[] styles; - /** + /** * line alignment (input, output) - * + * * @since 3.2 */ public int alignment; /** * line indent (input, output) - * + * * @since 3.2 */ public int indent; /** * line wrap indent (input, output) - * + * * @since 3.6 */ public int wrapIndent; - /** + /** * line justification (input, output) - * + * * @since 3.2 */ public boolean justify; @@ -93,7 +93,7 @@ */ public int[] tabStops; - + static final long serialVersionUID = 3906081274027192884L; /** diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/MovementEvent.java swt4-gtk-4.6.0/org/eclipse/swt/custom/MovementEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/MovementEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/MovementEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -15,44 +15,44 @@ /** * This event is sent when a new offset is required based on the current * offset and a movement type. - * + * * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> * * @since 3.3 */ public class MovementEvent extends TypedEvent { - + /** * line start offset (input) */ public int lineOffset; - + /** * line text (input) */ public String lineText; - + /** * the current offset (input) */ public int offset; - + /** * the new offset (input, output) */ public int newOffset; - + /** * the movement type (input) - * + * * @see org.eclipse.swt.SWT#MOVEMENT_WORD - * @see org.eclipse.swt.SWT#MOVEMENT_WORD_END + * @see org.eclipse.swt.SWT#MOVEMENT_WORD_END * @see org.eclipse.swt.SWT#MOVEMENT_WORD_START * @see org.eclipse.swt.SWT#MOVEMENT_CHAR * @see org.eclipse.swt.SWT#MOVEMENT_CLUSTER */ public int movement; - + static final long serialVersionUID = 3978765487853324342L; /** diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/MovementListener.java swt4-gtk-4.6.0/org/eclipse/swt/custom/MovementListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/MovementListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/MovementListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -17,18 +17,18 @@ * offset and a movement type. * * @see org.eclipse.swt.SWT#MOVEMENT_WORD - * @see org.eclipse.swt.SWT#MOVEMENT_WORD_END + * @see org.eclipse.swt.SWT#MOVEMENT_WORD_END * @see org.eclipse.swt.SWT#MOVEMENT_WORD_START * @see org.eclipse.swt.SWT#MOVEMENT_CHAR * @see org.eclipse.swt.SWT#MOVEMENT_CLUSTER - * + * * @since 3.3 */ public interface MovementListener extends SWTEventListener { /** * This method is called when a new offset is required based on the current * offset and a movement type. - * + * * <p> * The following event fields are used:<ul> * <li>event.lineOffset line start offset (input)</li> @@ -39,7 +39,7 @@ * </ul> * * @param event the event - * + * * @see MovementEvent * @see StyledText#addWordMovementListener(MovementListener) */ @@ -47,7 +47,7 @@ /** * This method is called when a new offset is required based on the current * offset and a movement type. - * + * * <p> * The following event fields are used:<ul> * <li>event.lineOffset line start offset (input)</li> @@ -58,7 +58,7 @@ * </ul> * * @param event the event - * + * * @see MovementEvent * @see StyledText#addWordMovementListener(MovementListener) */ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/PaintObjectEvent.java swt4-gtk-4.6.0/org/eclipse/swt/custom/PaintObjectEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/PaintObjectEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/PaintObjectEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -15,53 +15,53 @@ /** * This event is sent when an object needs to be drawn. - * + * * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> * * @since 3.2 */ public class PaintObjectEvent extends TypedEvent { - + /** * the GC */ public GC gc; - + /** * the x location */ public int x; - + /** * the y location */ public int y; - + /** * the line ascent */ public int ascent; - + /** * the line descent */ public int descent; - + /** * the StyleRange */ public StyleRange style; - + /** * the Bullet */ public Bullet bullet; - + /** * the bullet index */ public int bulletIndex; - + static final long serialVersionUID = 3906081274027192855L; /** diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/PaintObjectListener.java swt4-gtk-4.6.0/org/eclipse/swt/custom/PaintObjectListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/PaintObjectListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/PaintObjectListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -20,7 +20,7 @@ public interface PaintObjectListener extends SWTEventListener { /** * This method is called when an object needs to be drawn. - * + * * <p> * The following event fields are used:<ul> * <li>event.x the x location (input)</li> @@ -32,7 +32,7 @@ * </ul> * * @param event the event - * + * * @see PaintObjectEvent * @see StyledText#addPaintObjectListener(PaintObjectListener) */ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/PopupList.java swt4-gtk-4.6.0/org/eclipse/swt/custom/PopupList.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/PopupList.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/PopupList.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -21,7 +21,7 @@ * list that appears when you open a Combo box). * * The list will be positioned so that it does not run off the screen and the largest number of items -* are visible. It may appear above the current cursor location or below it depending how close you +* are visible. It may appear above the current cursor location or below it depending how close you * are to the edge of the screen. * * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> @@ -30,63 +30,71 @@ Shell shell; List list; int minimumWidth; -/** +/** * Creates a PopupList above the specified shell. -* +* * @param parent a Shell control which will be the parent of the new instance (cannot be null) */ public PopupList(Shell parent) { this (parent, 0); } -/** +/** * Creates a PopupList above the specified shell. -* +* * @param parent a widget which will be the parent of the new instance (cannot be null) * @param style the style of widget to construct -* -* @since 3.0 +* +* @since 3.0 */ public PopupList(Shell parent, int style) { int listStyle = SWT.SINGLE | SWT.V_SCROLL; if ((style & SWT.H_SCROLL) != 0) listStyle |= SWT.H_SCROLL; - + shell = new Shell(parent, checkStyle(style)); - - list = new List(shell, listStyle); + + list = new List(shell, listStyle); // close dialog if user selects outside of the shell shell.addListener(SWT.Deactivate, new Listener() { - public void handleEvent(Event e){ + @Override + public void handleEvent(Event e){ shell.setVisible (false); } }); - + // resize shell when list resizes shell.addControlListener(new ControlListener() { + @Override public void controlMoved(ControlEvent e){} + @Override public void controlResized(ControlEvent e){ Rectangle shellSize = shell.getClientArea(); list.setSize(shellSize.width, shellSize.height); } }); - + // return list selection on Mouse Up or Carriage Return list.addMouseListener(new MouseListener() { + @Override public void mouseDoubleClick(MouseEvent e){} + @Override public void mouseDown(MouseEvent e){} + @Override public void mouseUp(MouseEvent e){ shell.setVisible (false); } }); list.addKeyListener(new KeyListener() { + @Override public void keyReleased(KeyEvent e){} + @Override public void keyPressed(KeyEvent e){ if (e.character == '\r'){ shell.setVisible (false); } } }); - + } private static int checkStyle (int style) { int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT; @@ -155,7 +163,7 @@ listSize.y += 2; } y = rect.y - listSize.y; - + } else { // place popup list below table cell if (listSize.y > spaceBelow){ @@ -165,18 +173,18 @@ } y = rect.y + rect.height; } - + // Make dialog as wide as the cell listSize.x = rect.width; // dialog width should not be less than minimumWidth if (listSize.x < minimumWidth) listSize.x = minimumWidth; - + // Align right side of dialog with right side of cell int x = rect.x + rect.width - listSize.x; - + shell.setBounds(x, y, listSize.x, listSize.y); - + shell.open(); list.setFocus(); @@ -184,7 +192,7 @@ while (!shell.isDisposed () && shell.isVisible ()) { if (!display.readAndDispatch()) display.sleep(); } - + String result = null; if (!shell.isDisposed ()) { String [] strings = list.getSelection (); @@ -196,8 +204,8 @@ /** * Selects an item with text that starts with specified String. * <p> -* If the item is not currently selected, it is selected. -* If the item at an index is selected, it remains selected. +* If the item is not currently selected, it is selected. +* If the item at an index is selected, it remains selected. * If the string is not matched, it is ignored. * * @param string the text of the item @@ -229,7 +237,7 @@ * to the default system font for the widget. * * @param font the new font (or null) -* +* * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -250,7 +258,7 @@ * * This operation will fail when an item is null * or could not be added in the OS. -* +* * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the items array is null</li> * <li>ERROR_INVALID_ARGUMENT - if an item in the items array is null</li> @@ -271,7 +279,7 @@ public void setMinimumWidth (int width) { if (width < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - + minimumWidth = width; } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/SashForm.java swt4-gtk-4.6.0/org/eclipse/swt/custom/SashForm.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/SashForm.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/SashForm.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -58,7 +58,7 @@ * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -86,6 +86,7 @@ if ((style & SWT.BORDER) != 0) sashStyle |= SWT.BORDER; if ((style & SWT.SMOOTH) != 0) sashStyle |= SWT.SMOOTH; sashListener = new Listener() { + @Override public void handleEvent(Event e) { onDragSash(e); } @@ -106,12 +107,12 @@ /** * Returns SWT.HORIZONTAL if the controls in the SashForm are laid out side by side * or SWT.VERTICAL if the controls in the SashForm are laid out top to bottom. - * + * * <p> * To retrieve the bidi orientation of the SashForm use <code>{@link #getStyle()}</code> * and test if the SWT.RIGHT_TO_LEFT or SWT.LEFT_TO_RIGHT bits are set. * </p> - * + * * @return SWT.HORIZONTAL or SWT.VERTICAL */ @Override @@ -120,16 +121,16 @@ return (sashStyle & SWT.VERTICAL) != 0 ? SWT.HORIZONTAL : SWT.VERTICAL; } /** - * Returns the width of the sashes when the controls in the SashForm are + * Returns the width of the sashes when the controls in the SashForm are * laid out. - * + * * @return the width of the sashes - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.4 */ public int getSashWidth() { @@ -144,9 +145,9 @@ return style; } /** - * Answer the control that currently is maximized in the SashForm. + * Answer the control that currently is maximized in the SashForm. * This value may be null. - * + * * @return the control that currently is maximized or null */ public Control getMaximizedControl(){ @@ -155,13 +156,13 @@ } /** * Answer the relative weight of each child in the SashForm. The weight represents the - * percent of the total width (if SashForm has Horizontal orientation) or + * percent of the total width (if SashForm has Horizontal orientation) or * total height (if SashForm has Vertical orientation) each control occupies. * The weights are returned in order of the creation of the widgets (weight[0] * corresponds to the weight of the first child created). - * + * * @return the relative weight of each child - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -211,13 +212,13 @@ Control c2 = controls[sashIndex + 1]; Rectangle b1 = c1.getBounds(); Rectangle b2 = c2.getBounds(); - + Rectangle sashBounds = sash.getBounds(); Rectangle area = getClientArea(); boolean correction = false; if (getOrientation() == SWT.HORIZONTAL) { correction = b1.width < DRAG_MINIMUM || b2.width < DRAG_MINIMUM; - int totalWidth = b2.x + b2.width - b1.x; + int totalWidth = b2.x + b2.width - b1.x; int shift = event.x - sashBounds.x; b1.width += shift; b2.x += shift; @@ -289,19 +290,19 @@ } } /** - * If orientation is SWT.HORIZONTAL, lay the controls in the SashForm - * out side by side. If orientation is SWT.VERTICAL, lay the + * If orientation is SWT.HORIZONTAL, lay the controls in the SashForm + * out side by side. If orientation is SWT.VERTICAL, lay the * controls in the SashForm out top to bottom. - * + * * <p> - * Since 3.7, this method can also be called with SWT.RIGHT_TO_LEFT or SWT.LEFT_TO_RIGHT + * Since 3.7, this method can also be called with SWT.RIGHT_TO_LEFT or SWT.LEFT_TO_RIGHT * to change the bidi orientation of the SashForm. * </p> - * + * * @param orientation SWT.HORIZONTAL or SWT.VERTICAL, SWT.RIGHT_TO_LEFT or SWT.LEFT_TO_RIGHT - * + * * @see Control#setOrientation(int) - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -364,14 +365,14 @@ return; } /** - * Specify the control that should take up the entire client area of the SashForm. - * If one control has been maximized, and this method is called with a different control, + * Specify the control that should take up the entire client area of the SashForm. + * If one control has been maximized, and this method is called with a different control, * the previous control will be minimized and the new control will be maximized. * If the value of control is null, the SashForm will minimize all controls and return to * the default layout where all controls are laid out separated by sashes. - * + * * @param control the control to be maximized or null - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -389,7 +390,7 @@ } return; } - + for (int i= 0; i < sashes.length; i++){ sashes[i].setVisible(false); } @@ -398,16 +399,16 @@ } /** - * Specify the width of the sashes when the controls in the SashForm are + * Specify the width of the sashes when the controls in the SashForm are * laid out. - * + * * @param width the width of the sashes - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.4 */ public void setSashWidth(int width) { @@ -425,13 +426,13 @@ } /** * Specify the relative weight of each child in the SashForm. This will determine - * what percent of the total width (if SashForm has Horizontal orientation) or + * what percent of the total width (if SashForm has Horizontal orientation) or * total height (if SashForm has Vertical orientation) each control will occupy. * The weights must be positive values and there must be an entry for each * non-sash child of the SashForm. - * + * * @param weights the relative weight of each child - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -444,7 +445,7 @@ if (weights == null || weights.length != cArray.length) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); } - + int total = 0; for (int i = 0; i < weights.length; i++) { if (weights[i] < 0) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/SashFormLayout.java swt4-gtk-4.6.0/org/eclipse/swt/custom/SashFormLayout.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/SashFormLayout.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/SashFormLayout.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,7 +16,7 @@ /** * This class provides the layout for SashForm - * + * * @see SashForm */ class SashFormLayout extends Layout { @@ -26,7 +26,7 @@ Control[] cArray = sashForm.getControls(true); int width = 0; int height = 0; - if (cArray.length == 0) { + if (cArray.length == 0) { if (wHint != SWT.DEFAULT) width = wHint; if (hHint != SWT.DEFAULT) height = hHint; return new Point(width, height); @@ -63,7 +63,7 @@ data = new SashFormData(); cArray[i].setLayoutData(data); ((SashFormData)data).weight = ratios[i] = ((200 << 16) + 999) / 1000; - + } total += ratios[i]; } @@ -92,13 +92,13 @@ SashForm sashForm = (SashForm)composite; Rectangle area = sashForm.getClientArea(); if (area.width <= 1 || area.height <= 1) return; - + Control[] newControls = sashForm.getControls(true); if (sashForm.controls.length == 0 && newControls.length == 0) return; sashForm.controls = newControls; - + Control[] controls = sashForm.controls; - + if (sashForm.maxControl != null && !sashForm.maxControl.isDisposed()) { for (int i= 0; i < controls.length; i++){ if (controls[i] != sashForm.maxControl) { @@ -109,7 +109,7 @@ } return; } - + // keep just the right number of sashes if (sashForm.sashes.length < controls.length - 1) { Sash[] newSashes = new Sash[controls.length - 1]; @@ -147,11 +147,11 @@ data = new SashFormData(); controls[i].setLayoutData(data); ((SashFormData)data).weight = ratios[i] = ((200 << 16) + 999) / 1000; - + } total += ratios[i]; } - + int sashwidth = sashes.length > 0 ? sashForm.SASH_WIDTH + sashes [0].getBorderWidth() * 2 : sashForm.SASH_WIDTH; if (sashForm.getOrientation() == SWT.HORIZONTAL) { int width = (int)(ratios[0] * (area.width - sashes.length * sashwidth) / total); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/ScrolledComposite.java swt4-gtk-4.6.0/org/eclipse/swt/custom/ScrolledComposite.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/ScrolledComposite.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/ScrolledComposite.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -21,17 +21,17 @@ * * * <p>There are two ways to use the ScrolledComposite: - * + * * <p> - * 1) Set the size of the control that is being scrolled and the ScrolledComposite + * 1) Set the size of the control that is being scrolled and the ScrolledComposite * will show scrollbars when the contained control can not be fully seen. - * + * * 2) The second way imitates the way a browser would work. Set the minimum size of - * the control and the ScrolledComposite will show scroll bars if the visible area is - * less than the minimum size of the control and it will expand the size of the control - * if the visible area is greater than the minimum size. This requires invoking + * the control and the ScrolledComposite will show scroll bars if the visible area is + * less than the minimum size of the control and it will expand the size of the control + * if the visible area is greater than the minimum size. This requires invoking * both setMinWidth(), setMinHeight() and setExpandHorizontal(), setExpandVertical(). - * + * * <code><pre> * public static void main (String [] args) { * Display display = new Display (); @@ -39,7 +39,7 @@ * Color blue = display.getSystemColor(SWT.COLOR_BLUE); * Shell shell = new Shell (display); * shell.setLayout(new FillLayout()); - * + * * // set the size of the scrolled content - method 1 * final ScrolledComposite sc1 = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); * final Composite c1 = new Composite(sc1, SWT.NONE); @@ -51,7 +51,7 @@ * Button b1 = new Button (c1, SWT.PUSH); * b1.setText("first button"); * c1.setSize(c1.computeSize(SWT.DEFAULT, SWT.DEFAULT)); - * + * * // set the minimum width and height of the scrolled content - method 2 * final ScrolledComposite sc2 = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); * sc2.setExpandHorizontal(true); @@ -65,7 +65,7 @@ * Button b2 = new Button (c2, SWT.PUSH); * b2.setText("first button"); * sc2.setMinSize(c2.computeSize(SWT.DEFAULT, SWT.DEFAULT)); - * + * * Button add = new Button (shell, SWT.PUSH); * add.setText("add children"); * final int[] index = new int[]{0}; @@ -77,7 +77,7 @@ * // reset size of content so children can be seen - method 1 * c1.setSize(c1.computeSize(SWT.DEFAULT, SWT.DEFAULT)); * c1.layout(); - * + * * button = new Button(c2, SWT.PUSH); * button.setText("button "+index[0]); * // reset the minimum width and height so children can be seen - method 2 @@ -85,7 +85,7 @@ * c2.layout(); * } * }); - * + * * shell.open (); * while (!shell.isDisposed ()) { * if (!display.readAndDispatch ()) display.sleep (); @@ -106,7 +106,7 @@ Control content; Listener contentListener; Listener filter; - + int minHeight = 0; int minWidth = 0; boolean expandHorizontal = false; @@ -121,7 +121,7 @@ * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -141,7 +141,7 @@ * @see SWT#H_SCROLL * @see SWT#V_SCROLL * @see #getStyle() - */ + */ public ScrolledComposite(Composite parent, int style) { super(parent, checkStyle(style)); super.setLayout(new ScrolledCompositeLayout()); @@ -149,30 +149,34 @@ if (hBar != null) { hBar.setVisible(false); hBar.addListener (SWT.Selection, new Listener () { + @Override public void handleEvent (Event e) { hScroll(); } }); } - + ScrollBar vBar = getVerticalBar (); if (vBar != null) { vBar.setVisible(false); vBar.addListener (SWT.Selection, new Listener () { + @Override public void handleEvent (Event e) { vScroll(); } }); } - + contentListener = new Listener() { + @Override public void handleEvent(Event e) { if (e.type != SWT.Resize) return; layout(false); } }; - + filter = new Listener() { + @Override public void handleEvent(Event event) { if (event.type == SWT.FocusIn) { if (!showNextFocusedControl) { @@ -184,13 +188,14 @@ } else { Widget w = event.widget; if (w instanceof Control) { - showNextFocusedControl = w.getDisplay().getActiveShell() == ((Control) w).getShell(); + showNextFocusedControl = w.getDisplay().getActiveShell() == ((Control) w).getShell(); } } } }; - + addDisposeListener(new DisposeListener() { + @Override public void widgetDisposed(DisposeEvent e) { getDisplay().removeFilter(SWT.FocusIn, filter); getDisplay().removeFilter(SWT.FocusOut, filter); @@ -215,12 +220,12 @@ } /** - * Returns the Always Show Scrollbars flag. True if the scrollbars are - * always shown even if they are not required. False if the scrollbars are only + * Returns the Always Show Scrollbars flag. True if the scrollbars are + * always shown even if they are not required. False if the scrollbars are only * visible when some part of the composite needs to be scrolled to be seen. - * The H_SCROLL and V_SCROLL style bits are also required to enable scrollbars in the + * The H_SCROLL and V_SCROLL style bits are also required to enable scrollbars in the * horizontal and vertical directions. - * + * * @return the Always Show Scrollbars flag value */ public boolean getAlwaysShowScrollBars() { @@ -229,7 +234,7 @@ } /** - * Returns <code>true</code> if the content control + * Returns <code>true</code> if the content control * will be expanded to fill available horizontal space. * * @return the receiver's horizontal expansion state @@ -238,7 +243,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.2 */ public boolean getExpandHorizontal() { @@ -247,7 +252,7 @@ } /** - * Returns <code>true</code> if the content control + * Returns <code>true</code> if the content control * will be expanded to fill available vertical space. * * @return the receiver's vertical expansion state @@ -256,7 +261,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.2 */ public boolean getExpandVertical() { @@ -273,7 +278,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.2 */ public int getMinWidth() { @@ -290,7 +295,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.2 */ public int getMinHeight() { @@ -300,7 +305,7 @@ /** * Get the content that is being scrolled. - * + * * @return the control displayed in the content area */ public Control getContent() { @@ -309,16 +314,16 @@ } /** - * Returns <code>true</code> if the receiver automatically scrolls to a focused child control + * Returns <code>true</code> if the receiver automatically scrolls to a focused child control * to make it visible. Otherwise, returns <code>false</code>. - * + * * @return a boolean indicating whether focused child controls are automatically scrolled into the viewport * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.4 */ public boolean getShowFocusedControl() { @@ -336,13 +341,13 @@ boolean needHScroll(Rectangle contentRect, boolean vVisible) { ScrollBar hBar = getHorizontalBar(); if (hBar == null) return false; - + Rectangle hostRect = getBounds(); int border = getBorderWidth(); hostRect.width -= 2*border; ScrollBar vBar = getVerticalBar(); if (vVisible && vBar != null) hostRect.width -= vBar.getSize().x; - + if (!expandHorizontal && contentRect.width > hostRect.width) return true; if (expandHorizontal && minWidth > hostRect.width) return true; return false; @@ -351,31 +356,31 @@ boolean needVScroll(Rectangle contentRect, boolean hVisible) { ScrollBar vBar = getVerticalBar(); if (vBar == null) return false; - + Rectangle hostRect = getBounds(); int border = getBorderWidth(); hostRect.height -= 2*border; ScrollBar hBar = getHorizontalBar(); if (hVisible && hBar != null) hostRect.height -= hBar.getSize().y; - + if (!expandVertical && contentRect.height > hostRect.height) return true; if (expandVertical && minHeight > hostRect.height) return true; return false; } /** - * Return the point in the content that currently appears in the top left + * Return the point in the content that currently appears in the top left * corner of the scrolled composite. - * - * @return the point in the content that currently appears in the top left + * + * @return the point in the content that currently appears in the top left * corner of the scrolled composite. If no content has been set, this returns * (0, 0). - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 2.0 */ public Point getOrigin() { @@ -385,14 +390,14 @@ return new Point(-location.x, -location.y); } /** - * Scrolls the content so that the specified point in the content is in the top - * left corner. If no content has been set, nothing will occur. - * - * Negative values will be ignored. Values greater than the maximum scroll + * Scrolls the content so that the specified point in the content is in the top + * left corner. If no content has been set, nothing will occur. + * + * Negative values will be ignored. Values greater than the maximum scroll * distance will result in scrolling to the end of the scrollbar. * - * @param origin the point on the content to appear in the top left corner - * + * @param origin the point on the content to appear in the top left corner + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -404,21 +409,21 @@ setOrigin(origin.x, origin.y); } /** - * Scrolls the content so that the specified point in the content is in the top - * left corner. If no content has been set, nothing will occur. - * - * Negative values will be ignored. Values greater than the maximum scroll + * Scrolls the content so that the specified point in the content is in the top + * left corner. If no content has been set, nothing will occur. + * + * Negative values will be ignored. Values greater than the maximum scroll * distance will result in scrolling to the end of the scrollbar. * - * @param x the x coordinate of the content to appear in the top left corner - * - * @param y the y coordinate of the content to appear in the top left corner - * + * @param x the x coordinate of the content to appear in the top left corner + * + * @param y the y coordinate of the content to appear in the top left corner + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 2.0 */ public void setOrigin(int x, int y) { @@ -441,14 +446,14 @@ content.setLocation(x, y); } /** - * Set the Always Show Scrollbars flag. True if the scrollbars are - * always shown even if they are not required. False if the scrollbars are only + * Set the Always Show Scrollbars flag. True if the scrollbars are + * always shown even if they are not required. False if the scrollbars are only * visible when some part of the composite needs to be scrolled to be seen. - * The H_SCROLL and V_SCROLL style bits are also required to enable scrollbars in the + * The H_SCROLL and V_SCROLL style bits are also required to enable scrollbars in the * horizontal and vertical directions. - * + * * @param show true to show the scrollbars even when not required, false to show scrollbars only when required - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -467,9 +472,9 @@ /** * Set the content that will be scrolled. - * + * * @param content the control to be displayed in the content area - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -479,9 +484,9 @@ checkWidget(); if (this.content != null && !this.content.isDisposed()) { this.content.removeListener(SWT.Resize, contentListener); - this.content.setBounds(new Rectangle(-200, -200, 0, 0)); + this.content.setBounds(new Rectangle(-200, -200, 0, 0)); } - + this.content = content; ScrollBar vBar = getVerticalBar (); ScrollBar hBar = getHorizontalBar (); @@ -505,15 +510,15 @@ } } /** - * Configure the ScrolledComposite to resize the content object to be as wide as the + * Configure the ScrolledComposite to resize the content object to be as wide as the * ScrolledComposite when the width of the ScrolledComposite is greater than the * minimum width specified in setMinWidth. If the ScrolledComposite is less than the * minimum width, the content will not be resized and instead the horizontal scroll bar will be * used to view the entire width. * If expand is false, this behaviour is turned off. By default, this behaviour is turned off. - * + * * @param expand true to expand the content control to fill available horizontal space - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -526,15 +531,15 @@ layout(false); } /** - * Configure the ScrolledComposite to resize the content object to be as tall as the + * Configure the ScrolledComposite to resize the content object to be as tall as the * ScrolledComposite when the height of the ScrolledComposite is greater than the * minimum height specified in setMinHeight. If the ScrolledComposite is less than the * minimum height, the content will not be resized and instead the vertical scroll bar will be * used to view the entire height. * If expand is false, this behaviour is turned off. By default, this behaviour is turned off. - * + * * @param expand true to expand the content control to fill available vertical space - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -568,11 +573,11 @@ } /** * Specify the minimum height at which the ScrolledComposite will begin scrolling the - * content with the vertical scroll bar. This value is only relevant if + * content with the vertical scroll bar. This value is only relevant if * setExpandVertical(true) has been set. - * + * * @param height the minimum height or 0 for default height - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -583,11 +588,11 @@ } /** * Specify the minimum width and height at which the ScrolledComposite will begin scrolling the - * content with the horizontal scroll bar. This value is only relevant if + * content with the horizontal scroll bar. This value is only relevant if * setExpandHorizontal(true) and setExpandVertical(true) have been set. - * + * * @param size the minimum size or null for the default size - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -602,12 +607,12 @@ } /** * Specify the minimum width and height at which the ScrolledComposite will begin scrolling the - * content with the horizontal scroll bar. This value is only relevant if + * content with the horizontal scroll bar. This value is only relevant if * setExpandHorizontal(true) and setExpandVertical(true) have been set. - * + * * @param width the minimum width or 0 for default width * @param height the minimum height or 0 for default height - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -622,11 +627,11 @@ } /** * Specify the minimum width at which the ScrolledComposite will begin scrolling the - * content with the horizontal scroll bar. This value is only relevant if + * content with the horizontal scroll bar. This value is only relevant if * setExpandHorizontal(true) has been set. - * + * * @param width the minimum width or 0 for default width - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -639,17 +644,17 @@ /** * Configure the receiver to automatically scroll to a focused child control * to make it visible. - * - * If show is <code>false</code>, show a focused control is off. + * + * If show is <code>false</code>, show a focused control is off. * By default, show a focused control is off. - * + * * @param show <code>true</code> to show a focused control. - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.4 */ public void setShowFocusedControl(boolean show) { @@ -687,7 +692,7 @@ if (control == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (control.isDisposed ()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); if (!contains(control)) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - + Rectangle itemRect = getDisplay().map(control.getParent(), this, control.getBounds()); Rectangle area = getClientArea(); Point origin = getOrigin(); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/ScrolledCompositeLayout.java swt4-gtk-4.6.0/org/eclipse/swt/custom/ScrolledCompositeLayout.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/ScrolledCompositeLayout.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/ScrolledCompositeLayout.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,15 +16,15 @@ /** * This class provides the layout for ScrolledComposite - * + * * @see ScrolledComposite */ class ScrolledCompositeLayout extends Layout { - + boolean inLayout = false; static final int DEFAULT_WIDTH = 64; static final int DEFAULT_HEIGHT = 64; - + @Override protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) { ScrolledComposite sc = (ScrolledComposite)composite; @@ -75,7 +75,7 @@ } Rectangle hostRect = sc.getClientArea(); if (sc.expandHorizontal) { - contentRect.width = Math.max(sc.minWidth, hostRect.width); + contentRect.width = Math.max(sc.minWidth, hostRect.width); } if (sc.expandVertical) { contentRect.height = Math.max(sc.minHeight, hostRect.height); @@ -114,7 +114,7 @@ } } gc.dispose (); - + sc.content.setBounds (contentRect); inLayout = false; } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/StackLayout.java swt4-gtk-4.6.0/org/eclipse/swt/custom/StackLayout.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/StackLayout.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/StackLayout.java 2016-07-06 19:11:33.000000000 +0000 @@ -19,18 +19,18 @@ * This Layout stacks all the controls one on top of the other and resizes all controls * to have the same size and location. * The control specified in topControl is visible and all other controls are not visible. - * Users must set the topControl value to flip between the visible items and then call + * Users must set the topControl value to flip between the visible items and then call * layout() on the composite which has the StackLayout. - * - * <p> Here is an example which places ten buttons in a stack layout and + * + * <p> Here is an example which places ten buttons in a stack layout and * flips between them: - * + * * <pre><code> * public static void main(String[] args) { * Display display = new Display(); * Shell shell = new Shell(display); * shell.setLayout(new GridLayout()); - * + * * final Composite parent = new Composite(shell, SWT.NONE); * parent.setLayoutData(new GridData(GridData.FILL_BOTH)); * final StackLayout layout = new StackLayout(); @@ -41,7 +41,7 @@ * bArray[i].setText("Button "+i); * } * layout.topControl = bArray[0]; - * + * * Button b = new Button(shell, SWT.PUSH); * b.setText("Show Next Button"); * final int[] index = new int[1]; @@ -52,12 +52,12 @@ * parent.layout(); * } * }); - * + * * shell.open(); * while (shell != null && !shell.isDisposed()) { * if (!display.readAndDispatch()) - * display.sleep(); - * } + * display.sleep(); + * } * } * </code></pre> * @@ -67,7 +67,7 @@ */ public class StackLayout extends Layout { - + /** * marginWidth specifies the number of pixels of horizontal margin * that will be placed along the left and right edges of the layout. diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/ST.java swt4-gtk-4.6.0/org/eclipse/swt/custom/ST.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/ST.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/ST.java 2016-07-06 19:11:33.000000000 +0000 @@ -17,11 +17,11 @@ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public class ST { - + /* * Navigation Key Actions. Key bindings for the actions are set * by the StyledText widget. - */ + */ public static final int LINE_UP = 16777217; // binding = SWT.ARROW_UP public static final int LINE_DOWN = 16777218; // binding = SWT.ARROW_DOWN public static final int LINE_START = 16777223; // binding = SWT.HOME @@ -37,8 +37,8 @@ public static final int WINDOW_START = 17039365; // binding = SWT.MOD1 + SWT.PAGE_UP public static final int WINDOW_END = 17039366; // binding = SWT.MOD1 + SWT.PAGE_DOWN - /* - * Selection Key Actions + /* + * Selection Key Actions */ public static final int SELECT_ALL = 262209; // binding = SWT.MOD1 + 'A' public static final int SELECT_LINE_UP = 16908289; // binding = SWT.MOD2 + SWT.ARROW_UP @@ -57,7 +57,7 @@ public static final int SELECT_WINDOW_END = 17170438; // binding = SWT.MOD1 + SWT.MOD2 + SWT.PAGE_DOWN /* - * Modification Key Actions + * Modification Key Actions */ public static final int CUT = 131199; // binding = SWT.MOD2 + SWT.DEL public static final int COPY = 17039369; // binding = SWT.MOD1 + SWT.INSERT; @@ -67,156 +67,156 @@ public static final int DELETE_WORD_PREVIOUS = 262152; // binding = SWT.BS | SWT.MOD1; public static final int DELETE_WORD_NEXT = 262271; // binding = SWT.DEL | SWT.MOD1; - /* - * Miscellaneous Key Actions + /* + * Miscellaneous Key Actions */ public static final int TOGGLE_OVERWRITE = 16777225; // binding = SWT.INSERT; - + /** * TEMPORARY CODE - API SUBJECT TO CHANGE - * + * * Toggle block selection mode - * + * * @since 3.5 */ public static final int TOGGLE_BLOCKSELECTION = 16777226; - + /** * Bullet style dot. - * + * * @see Bullet - * + * * @since 3.2 */ public static final int BULLET_DOT = 1 << 0; /** * Bullet style number. - * + * * @see Bullet - * + * * @since 3.2 */ public static final int BULLET_NUMBER = 1 << 1; /** * Bullet style lower case letter. - * + * * @see Bullet - * + * * @since 3.2 */ public static final int BULLET_LETTER_LOWER = 1 << 2; /** * Bullet style upper case letter. - * + * * @see Bullet - * + * * @since 3.2 */ public static final int BULLET_LETTER_UPPER = 1 << 3; /** * Bullet style text. - * + * * @see Bullet - * + * * @since 3.2 */ public static final int BULLET_TEXT = 1 << 4; /** * Bullet style custom draw. - * + * * @see StyledText#addPaintObjectListener(PaintObjectListener) * @see StyledText#removePaintObjectListener(PaintObjectListener) - * @see Bullet - * + * @see Bullet + * * @since 3.2 */ public static final int BULLET_CUSTOM = 1 << 5; - + /** * The ExtendedModify event type (value is 3000). - * + * * @since 3.8 */ public static final int ExtendedModify = 3000; /** * The LineGetBackground event type (value is 3001). - * + * * @since 3.8 */ public static final int LineGetBackground = 3001; - + /** * The LineGetStyle event type (value is 3002). - * + * * @since 3.8 */ public static final int LineGetStyle = 3002; - + /** * The TextChanging event type (value is 3003). - * + * * @since 3.8 */ public static final int TextChanging = 3003; - + /** * The TextSet event type (value is 3004). - * + * * @since 3.8 */ public static final int TextSet = 3004; - + /** * The VerifyKey event type (value is 3005). - * + * * @since 3.8 */ public static final int VerifyKey = 3005; - + /** * The TextChanged event type (value is 3006). - * + * * @since 3.8 */ public static final int TextChanged = 3006; - + /** * The LineGetSegments event type (value is 3007). - * + * * @since 3.8 */ public static final int LineGetSegments = 3007; - + /** * The PaintObject event type (value is 3008). - * + * * @since 3.8 */ public static final int PaintObject = 3008; - + /** * The WordNext event type (value is 3009). - * + * * @since 3.8 */ public static final int WordNext = 3009; - + /** * The WordPrevious event type (value is 3010). - * + * * @since 3.8 */ public static final int WordPrevious = 3010; - + /** * The CaretMoved event type (value is 3011). - * + * * @since 3.8 */ public static final int CaretMoved = 3011; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/StyledTextContent.java swt4-gtk-4.6.0/org/eclipse/swt/custom/StyledTextContent.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/StyledTextContent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/StyledTextContent.java 2016-07-06 19:11:33.000000000 +0000 @@ -12,10 +12,10 @@ /** - * Clients may implement the StyledTextContent interface to provide a - * custom store for the StyledText widget content. The StyledText widget - * interacts with its StyledTextContent in order to access and update - * the text that is being displayed and edited in the widget. + * Clients may implement the StyledTextContent interface to provide a + * custom store for the StyledText widget content. The StyledText widget + * interacts with its StyledTextContent in order to access and update + * the text that is being displayed and edited in the widget. * A custom content implementation can be set in the widget using the * StyledText.setContent API. */ @@ -46,8 +46,8 @@ * Return the line at the given line index without delimiters. * <p> * - * @param lineIndex index of the line to return. Does not include - * delimiters of preceding lines. Index 0 is the first line of the + * @param lineIndex index of the line to return. Does not include + * delimiters of preceding lines. Index 0 is the first line of the * content. * @return the line text without delimiters */ @@ -57,12 +57,12 @@ * Return the line index at the given character offset. * <p> * - * @param offset offset of the line to return. The first character of the - * document is at offset 0. An offset of getLength() is valid and should - * answer the number of lines. - * @return the line index. The first line is at index 0. If the character - * at offset is a delimiter character, answer the line index of the line - * that is delimited. + * @param offset offset of the line to return. The first character of the + * document is at offset 0. An offset of getLength() is valid and should + * answer the number of lines. + * @return the line index. The first line is at index 0. If the character + * at offset is a delimiter character, answer the line index of the line + * that is delimited. * For example, if text = "\r\n\r\n", and delimiter = "\r\n", then: * <ul> * <li>getLineAtOffset(0) == 0 @@ -81,18 +81,18 @@ * * @return the number of lines. For example: * <ul> - * <li> text value ==> getLineCount - * <li> null ==> 1 - * <li> "" ==> 1 - * <li> "a\n" ==> 2 - * <li> "\n\n" ==> 3 + * <li> text value ==> getLineCount + * <li> null ==> 1 + * <li> "" ==> 1 + * <li> "a\n" ==> 2 + * <li> "\n\n" ==> 3 * </ul> */ public int getLineCount(); /** - * Return the line delimiter that should be used by the StyledText - * widget when inserting new lines. New lines entered using key strokes + * Return the line delimiter that should be used by the StyledText + * widget when inserting new lines. New lines entered using key strokes * and paste operations use this line delimiter. * Implementors may use System.getProperty("line.separator") to return * the platform line delimiter. @@ -106,14 +106,14 @@ /** * Return the character offset of the first character of the given line. * <p> - * <b>NOTE:</b> When there is no text (i.e., no lines), getOffsetAtLine(0) + * <b>NOTE:</b> When there is no text (i.e., no lines), getOffsetAtLine(0) * is a valid call that should return 0. * </p> * * @param lineIndex index of the line. The first line is at index 0. - * @return offset offset of the first character of the line. The first - * character of the document is at offset 0. The return value should - * include line delimiters. + * @return offset offset of the first character of the line. The first + * character of the document is at offset 0. The return value should + * include line delimiters. * For example, if text = "\r\ntest\r\n" and delimiter = "\r\n", then: * <ul> * <li>getOffsetAtLine(0) == 0 @@ -127,7 +127,7 @@ * Returns a string representing the content at the given range. * <p> * - * @param start the start offset of the text to return. Offset 0 is the + * @param start the start offset of the text to return. Offset 0 is the * first character of the document. * @param length the length of the text to return * @return the text at the given range @@ -139,7 +139,7 @@ * <p> * * @param listener the listener which should no longer be notified - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when listener is null</li> * </ul> @@ -147,33 +147,33 @@ public void removeTextChangeListener(TextChangeListener listener); /** - * Replace the text with "newText" starting at position "start" + * Replace the text with "newText" starting at position "start" * for a length of "replaceLength". * <p> - * Implementors have to notify the TextChangeListeners that were added - * using <code>addTextChangeListener</code> before and after the content - * is changed. A <code>TextChangingEvent</code> has to be sent to the - * textChanging method before the content is changed and a + * Implementors have to notify the TextChangeListeners that were added + * using <code>addTextChangeListener</code> before and after the content + * is changed. A <code>TextChangingEvent</code> has to be sent to the + * textChanging method before the content is changed and a * <code>TextChangedEvent</code> has to be sent to the textChanged method * after the content has changed. - * The text change that occurs after the <code>TextChangingEvent</code> - * has been sent has to be consistent with the data provided in the + * The text change that occurs after the <code>TextChangingEvent</code> + * has been sent has to be consistent with the data provided in the * <code>TextChangingEvent</code>. - * This data will be cached by the widget and will be used when the + * This data will be cached by the widget and will be used when the * <code>TextChangedEvent</code> is received. * <p> * The <code>TextChangingEvent</code> should be set as follows: * <ul> * <li>event.start = start of the replaced text - * <li>event.newText = text that is going to be inserted or empty String + * <li>event.newText = text that is going to be inserted or empty String * if no text will be inserted * <li>event.replaceCharCount = length of text that is going to be replaced * <li>event.newCharCount = length of text that is going to be inserted * <li>event.replaceLineCount = number of lines that are going to be replaced * <li>event.newLineCount = number of new lines that are going to be inserted * </ul> - * <b>NOTE:</b> newLineCount is the number of inserted lines and replaceLineCount - * is the number of deleted lines based on the change that occurs visually. + * <b>NOTE:</b> newLineCount is the number of inserted lines and replaceLineCount + * is the number of deleted lines based on the change that occurs visually. * For example: * <ul> * <li>(replaceText, newText) ==> (replaceLineCount, newLineCount) @@ -184,9 +184,9 @@ * </ul> * </p> * - * @param start start offset of text to replace, none of the offsets include - * delimiters of preceding lines, offset 0 is the first character of the - * document + * @param start start offset of text to replace, none of the offsets include + * delimiters of preceding lines, offset 0 is the first character of the + * document * @param replaceLength length of text to replace * @param text text to replace * @see TextChangeListener @@ -195,8 +195,8 @@ /** * Set text to "text". - * Implementors have to send a <code>TextChangedEvent</code> to the - * textSet method of the TextChangeListeners that were added using + * Implementors have to send a <code>TextChangedEvent</code> to the + * textSet method of the TextChangeListeners that were added using * <code>addTextChangeListener</code>. * <p> * diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/StyledTextDropTargetEffect.java swt4-gtk-4.6.0/org/eclipse/swt/custom/StyledTextDropTargetEffect.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/StyledTextDropTargetEffect.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/StyledTextDropTargetEffect.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -16,22 +16,22 @@ import org.eclipse.swt.widgets.*; /** - * This adapter class provides a default drag under effect (eg. select and scroll) + * This adapter class provides a default drag under effect (eg. select and scroll) * when a drag occurs over a <code>StyledText</code>. - * + * * <p>Classes that wish to provide their own drag under effect for a <code>StyledText</code> * can extend this class, override the <code>StyledTextDropTargetEffect.dragOver</code> - * method and override any other applicable methods in <code>StyledTextDropTargetEffect</code> to + * method and override any other applicable methods in <code>StyledTextDropTargetEffect</code> to * display their own drag under effect.</p> * * Subclasses that override any methods of this class should call the corresponding * <code>super</code> method to get the default drag under effect implementation. * - * <p>The feedback value is either one of the FEEDBACK constants defined in - * class <code>DND</code> which is applicable to instances of this class, - * or it must be built by <em>bitwise OR</em>'ing together + * <p>The feedback value is either one of the FEEDBACK constants defined in + * class <code>DND</code> which is applicable to instances of this class, + * or it must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more - * of those <code>DND</code> effect constants. + * of those <code>DND</code> effect constants. * </p> * <p> * <dl> @@ -39,32 +39,33 @@ * <dd>FEEDBACK_SELECT, FEEDBACK_SCROLL</dd> * </dl> * </p> - * + * * @see DropTargetAdapter * @see DropTargetEvent * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.3 */ public class StyledTextDropTargetEffect extends DropTargetEffect { static final int CARET_WIDTH = 2; static final int SCROLL_HYSTERESIS = 100; // milli seconds static final int SCROLL_TOLERANCE = 20; // pixels - + int currentOffset = -1; long scrollBeginTime; int scrollX = -1, scrollY = -1; Listener paintListener; - + /** - * Creates a new <code>StyledTextDropTargetEffect</code> to handle the drag under effect on the specified + * Creates a new <code>StyledTextDropTargetEffect</code> to handle the drag under effect on the specified * <code>StyledText</code>. - * + * * @param styledText the <code>StyledText</code> over which the user positions the cursor to drop the data */ public StyledTextDropTargetEffect(StyledText styledText) { super(styledText); paintListener = new Listener () { + @Override public void handleEvent (Event event) { if (currentOffset != -1) { StyledText text = (StyledText) getControl(); @@ -76,18 +77,18 @@ } }; } - + /** * This implementation of <code>dragEnter</code> provides a default drag under effect * for the feedback specified in <code>event.feedback</code>. - * + * * For additional information see <code>DropTargetAdapter.dragEnter</code>. - * + * * Subclasses that override this method should call <code>super.dragEnter(event)</code> * to get the default drag under effect implementation. * * @param event the information associated with the drag start event - * + * * @see DropTargetAdapter * @see DropTargetEvent */ @@ -100,18 +101,18 @@ getControl().removeListener(SWT.Paint, paintListener); getControl().addListener (SWT.Paint, paintListener); } - + /** * This implementation of <code>dragLeave</code> provides a default drag under effect * for the feedback specified in <code>event.feedback</code>. - * + * * For additional information see <code>DropTargetAdapter.dragLeave</code>. - * + * * Subclasses that override this method should call <code>super.dragLeave(event)</code> * to get the default drag under effect implementation. * * @param event the information associated with the drag leave event - * + * * @see DropTargetAdapter * @see DropTargetEvent */ @@ -130,14 +131,14 @@ /** * This implementation of <code>dragOver</code> provides a default drag under effect * for the feedback specified in <code>event.feedback</code>. - * + * * For additional information see <code>DropTargetAdapter.dragOver</code>. - * + * * Subclasses that override this method should call <code>super.dragOver(event)</code> * to get the default drag under effect implementation. * * @param event the information associated with the drag over event - * + * * @see DropTargetAdapter * @see DropTargetEvent * @see DND#FEEDBACK_SELECT @@ -147,7 +148,7 @@ public void dragOver(DropTargetEvent event) { int effect = event.feedback; StyledText text = (StyledText) getControl(); - + Point pt = text.getDisplay().map(null, text, event.x, event.y); if ((effect & DND.FEEDBACK_SCROLL) == 0) { scrollBeginTime = 0; @@ -194,7 +195,7 @@ } } } - + if ((effect & DND.FEEDBACK_SELECT) != 0) { int[] trailing = new int [1]; int newOffset = text.getOffsetAtPoint(pt.x, pt.y, trailing, false); @@ -224,14 +225,14 @@ /** * This implementation of <code>dropAccept</code> provides a default drag under effect * for the feedback specified in <code>event.feedback</code>. - * + * * For additional information see <code>DropTargetAdapter.dropAccept</code>. - * + * * Subclasses that override this method should call <code>super.dropAccept(event)</code> * to get the default drag under effect implementation. * * @param event the information associated with the drop accept event - * + * * @see DropTargetAdapter * @see DropTargetEvent */ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/StyledTextEvent.java swt4-gtk-4.6.0/org/eclipse/swt/custom/StyledTextEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/StyledTextEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/StyledTextEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -15,7 +15,7 @@ /** * - */ + */ class StyledTextEvent extends Event { // used by LineStyleEvent int[] ranges; @@ -30,8 +30,8 @@ // used by LineBackgroundEvent Color lineBackground; // used by TextChangedEvent - int replaceCharCount; - int newCharCount; + int replaceCharCount; + int newCharCount; int replaceLineCount; int newLineCount; // used by PaintObjectEvent @@ -43,7 +43,7 @@ StyledTextEvent (StyledTextContent content) { super(); - data = content; + data = content; } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/StyledText.java swt4-gtk-4.6.0/org/eclipse/swt/custom/StyledText.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/StyledText.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/StyledText.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -7,11 +7,14 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Andrey Loskutov <loskutov@gmx.de> - bug 488172 + * Stefan Xenos (Google) - bug 487254 - StyledText.getTopIndex() can return negative values *******************************************************************************/ package org.eclipse.swt.custom; import java.util.*; +import java.util.List; import org.eclipse.swt.*; import org.eclipse.swt.accessibility.*; @@ -23,23 +26,23 @@ import org.eclipse.swt.widgets.*; /** - * A StyledText is an editable user interface object that displays lines - * of text. The following style attributes can be defined for the text: + * A StyledText is an editable user interface object that displays lines + * of text. The following style attributes can be defined for the text: * <ul> - * <li>foreground color + * <li>foreground color * <li>background color * <li>font style (bold, italic, bold-italic, regular) * <li>underline * <li>strikeout * </ul> * <p> - * In addition to text style attributes, the background color of a line may + * In addition to text style attributes, the background color of a line may * be specified. * </p><p> - * There are two ways to use this widget when specifying text style information. - * You may use the API that is defined for StyledText or you may define your own - * LineStyleListener. If you define your own listener, you will be responsible - * for maintaining the text style information for the widget. IMPORTANT: You may + * There are two ways to use this widget when specifying text style information. + * You may use the API that is defined for StyledText or you may define your own + * LineStyleListener. If you define your own listener, you will be responsible + * for maintaining the text style information for the widget. IMPORTANT: You may * not define your own listener and use the StyledText API. The following * StyledText API is not supported if you have defined a LineStyleListener: * <ul> @@ -51,11 +54,11 @@ * </ul> * </p><p> * There are two ways to use this widget when specifying line background colors. - * You may use the API that is defined for StyledText or you may define your own - * LineBackgroundListener. If you define your own listener, you will be responsible - * for maintaining the line background color information for the widget. - * IMPORTANT: You may not define your own listener and use the StyledText API. - * The following StyledText API is not supported if you have defined a + * You may use the API that is defined for StyledText or you may define your own + * LineBackgroundListener. If you define your own listener, you will be responsible + * for maintaining the line background color information for the widget. + * IMPORTANT: You may not define your own listener and use the StyledText API. + * The following StyledText API is not supported if you have defined a * LineBackgroundListener: * <ul> * <li>getLineBackground(int) @@ -64,7 +67,7 @@ * </p><p> * The content implementation for this widget may also be user-defined. To do so, * you must implement the StyledTextContent interface and use the StyledText API - * setContent(StyledTextContent) to initialize the widget. + * setContent(StyledTextContent) to initialize the widget. * </p><p> * <dl> * <dt><b>Styles:</b><dd>FULL_SELECTION, MULTI, READ_ONLY, SINGLE, WRAP @@ -89,7 +92,7 @@ static final int H_SCROLL_RATE = 10; static final int PREVIOUS_OFFSET_TRAILING = 0; static final int OFFSET_LEADING = 1; - + Color selectionBackground; // selection background color Color selectionForeground; // selection foreground color StyledTextContent content; // native content (default or user specified) @@ -114,26 +117,26 @@ int columnX; // keep track of the horizontal caret position when changing lines/pages. Fixes bug 5935 int caretOffset; int caretAlignment; - Point selection = new Point(0, 0); // x and y are start and end caret offsets of selection + Point selection = new Point(0, 0); // x and y are start and end caret offsets of selection (x <= y) Point clipboardSelection; // x and y are start and end caret offsets of previous selection int selectionAnchor; // position of selection anchor. 0 based offset from beginning of text Point doubleClickSelection; // selection after last mouse double click boolean editable = true; boolean wordWrap = false; // text is wrapped automatically boolean visualWrap = false; // process line breaks inside logical lines (inserted by BidiSegmentEvent) - boolean doubleClickEnabled = true; // see getDoubleClickEnabled + boolean doubleClickEnabled = true; // see getDoubleClickEnabled boolean overwrite = false; // insert/overwrite edit mode int textLimit = -1; // limits the number of characters the user can type in the widget. Unlimited by default. - Hashtable<Integer, Integer> keyActionMap = new Hashtable<Integer, Integer>(); + Map<Integer, Integer> keyActionMap = new HashMap<>(); Color background = null; // workaround for bug 4791 Color foreground = null; // Clipboard clipboard; int clickCount; int autoScrollDirection = SWT.NULL; // the direction of autoscrolling (up, down, right, left) int autoScrollDistance = 0; - int lastTextChangeStart; // cache data of the - int lastTextChangeNewLineCount; // last text changing - int lastTextChangeNewCharCount; // event for use in the + int lastTextChangeStart; // cache data of the + int lastTextChangeNewLineCount; // last text changing + int lastTextChangeNewCharCount; // event for use in the int lastTextChangeReplaceLineCount; // text changed handler int lastTextChangeReplaceCharCount; int lastCharCount = 0; @@ -162,12 +165,12 @@ AccessibleEditableTextListener accEditableTextListener; AccessibleTextExtendedAdapter accTextExtendedAdapter; AccessibleAdapter accAdapter; - + //block selection boolean blockSelection; int blockXAnchor = -1, blockYAnchor = -1; int blockXLocation = -1, blockYLocation = -1; - + final static boolean IS_MAC, IS_GTK; static { @@ -178,8 +181,8 @@ /** * The Printing class implements printing of a range of text. - * An instance of <code>Printing</code> is returned in the - * StyledText#print(Printer) API. The run() method may be + * An instance of <code>Printing</code> is returned in the + * StyledText#print(Printer) API. The run() method may be * invoked from any thread. */ static class Printing implements Runnable { @@ -193,7 +196,7 @@ Rectangle clientArea; FontData fontData; Font printerFont; - Hashtable<Resource, Resource> resources; + Map<Resource, Resource> resources; int tabLength; GC gc; // printer GC int pageWidth; // width of a printer page in pixels @@ -210,13 +213,13 @@ /** * Creates an instance of <code>Printing</code>. - * Copies the widget content and rendering data that needs + * Copies the widget content and rendering data that needs * to be requested from listeners. * </p> * @param parent StyledText widget to print. * @param printer printer device to print on. * @param printOptions print options - */ + */ Printing(StyledText styledText, Printer printer, StyledTextPrintOptions printOptions) { this.printer = printer; this.printOptions = printOptions; @@ -244,7 +247,7 @@ /** * Caches all line data that needs to be requested from a listener. * </p> - * @param printerContent <code>StyledTextContent</code> to request + * @param printerContent <code>StyledTextContent</code> to request * line data for. */ void cacheLineData(StyledText styledText) { @@ -282,7 +285,7 @@ } Point screenDPI = styledText.getDisplay().getDPI(); Point printerDPI = printer.getDPI(); - resources = new Hashtable<Resource, Resource> (); + resources = new HashMap<> (); for (int i = 0; i < lineCount; i++) { Color color = printerRenderer.getLineBackground(i, null); if (color != null) { @@ -290,7 +293,7 @@ Color printerColor = (Color)resources.get(color); if (printerColor == null) { printerColor = new Color (printer, color.getRGB()); - resources.put(color, printerColor); + resources.put(color, printerColor); } printerRenderer.setLineBackground(i, 1, printerColor); } else { @@ -310,7 +313,7 @@ Font printerFont = (Font)resources.get(font); if (printerFont == null) { printerFont = new Font (printer, font.getFontData()); - resources.put(font, printerFont); + resources.put(font, printerFont); } style.font = printerFont; } @@ -320,7 +323,7 @@ if (printOptions.printTextForeground) { if (printerColor == null) { printerColor = new Color (printer, color.getRGB()); - resources.put(color, printerColor); + resources.put(color, printerColor); } style.foreground = printerColor; } else { @@ -333,7 +336,7 @@ if (printOptions.printTextBackground) { if (printerColor == null) { printerColor = new Color (printer, color.getRGB()); - resources.put(color, printerColor); + resources.put(color, printerColor); } style.background = printerColor; } else { @@ -385,9 +388,9 @@ gc = null; } if (resources != null) { - Enumeration<Resource> enumeration = resources.elements(); - while (enumeration.hasMoreElements()) { - Resource resource = enumeration.nextElement(); + Iterator<Resource> enumeration = resources.values().iterator(); + while (enumeration.hasNext()) { + Resource resource = enumeration.next(); resource.dispose(); } resources = null; @@ -404,15 +407,15 @@ void init() { Rectangle trim = printer.computeTrim(0, 0, 0, 0); Point dpi = printer.getDPI(); - + printerFont = new Font(printer, fontData.getName(), fontData.getHeight(), SWT.NORMAL); clientArea = printer.getClientArea(); pageWidth = clientArea.width; // one inch margin around text - clientArea.x = dpi.x + trim.x; + clientArea.x = dpi.x + trim.x; clientArea.y = dpi.y + trim.y; clientArea.width -= (clientArea.x + trim.width); - clientArea.height -= (clientArea.y + trim.height); + clientArea.height -= (clientArea.y + trim.height); int style = mirrored ? SWT.RIGHT_TO_LEFT : SWT.LEFT_TO_RIGHT; gc = new GC(printer, style); @@ -426,7 +429,7 @@ if (printOptions.footer != null) { clientArea.height -= lineHeight * 2; } - + // TODO not wrapped StyledTextContent content = printerRenderer.content; startLine = 0; @@ -490,7 +493,7 @@ } TextLayout layout = printerRenderer.getTextLayout(i, orientation, width, lineSpacing); Color lineBackground = printerRenderer.getLineBackground(i, background); - int paragraphBottom = paintY + layout.getBounds().height; + int paragraphBottom = paintY + layout.getBounds().height; if (paragraphBottom <= pageBottom) { //normal case, the whole paragraph fits in the current page printLine(paintX, paintY, gc, foreground, lineBackground, layout, printLayout, i); @@ -520,7 +523,7 @@ printLine(paintX, paintY, gc, foreground, lineBackground, layout, printLayout, i); gc.setClipping((Rectangle)null); printDecoration(page, false, printLayout); - printer.endPage(); + printer.endPage(); page++; if (page <= endPage) { printer.startPage(); @@ -545,7 +548,7 @@ } /** * Print header or footer decorations. - * + * * @param page page number to print, if specified in the StyledTextPrintOptions header or footer. * @param header true = print the header, false = print the footer */ @@ -571,13 +574,13 @@ * Print one segment of a header or footer decoration. * Headers and footers have three different segments. * One each for left aligned, centered, and right aligned text. - * + * * @param segment decoration segment to print - * @param alignment alignment of the segment. 0=left, 1=center, 2=right + * @param alignment alignment of the segment. 0=left, 1=center, 2=right * @param page page number to print, if specified in the decoration segment. * @param header true = print the header, false = print the footer */ - void printDecorationSegment(String segment, int alignment, int page, boolean header, TextLayout layout) { + void printDecorationSegment(String segment, int alignment, int page, boolean header, TextLayout layout) { int pageIndex = segment.indexOf(StyledTextPrintOptions.PAGE_TAG); if (pageIndex != -1) { int pageTagLength = StyledTextPrintOptions.PAGE_TAG.length(); @@ -611,7 +614,7 @@ Rectangle rect = layout.getBounds(); gc.setBackground(background); gc.fillRectangle(x, y, rect.width, rect.height); - + // int lineCount = layout.getLineCount(); // for (int i = 0; i < lineCount; i++) { // Rectangle rect = layout.getLineBounds(i); @@ -646,6 +649,7 @@ /** * Starts a print job and prints the pages specified in the constructor. */ + @Override public void run() { String jobName = printOptions.jobName; if (jobName == null) { @@ -657,43 +661,43 @@ dispose(); printer.endJob(); } - } + } } /** * The <code>RTFWriter</code> class is used to write widget content as - * rich text. The implementation complies with the RTF specification + * rich text. The implementation complies with the RTF specification * version 1.5. * <p> - * toString() is guaranteed to return a valid RTF string only after - * close() has been called. + * toString() is guaranteed to return a valid RTF string only after + * close() has been called. * </p><p> * Whole and partial lines and line breaks can be written. Lines will be - * formatted using the styles queried from the LineStyleListener, if + * formatted using the styles queried from the LineStyleListener, if * set, or those set directly in the widget. All styles are applied to - * the RTF stream like they are rendered by the widget. In addition, the + * the RTF stream like they are rendered by the widget. In addition, the * widget font name and size is used for the whole text. * </p> */ class RTFWriter extends TextWriter { static final int DEFAULT_FOREGROUND = 0; static final int DEFAULT_BACKGROUND = 1; - Vector<Color> colorTable; - Vector<Font> fontTable; + List<Color> colorTable; + List<Font> fontTable; boolean WriteUnicode; - + /** * Creates a RTF writer that writes content starting at offset "start" - * in the document. <code>start</code> and <code>length</code>can be set to specify partial + * in the document. <code>start</code> and <code>length</code>can be set to specify partial * lines. * - * @param start start offset of content to write, 0 based from + * @param start start offset of content to write, 0 based from * beginning of document * @param length length of content to write */ public RTFWriter(int start, int length) { super(start, length); - colorTable = new Vector<Color>(); - fontTable = new Vector<Font>(); + colorTable = new ArrayList<>(); + fontTable = new ArrayList<>(); colorTable.add(getForeground()); colorTable.add(getBackground()); fontTable.add(getFont()); @@ -701,7 +705,7 @@ } /** * Closes the RTF writer. Once closed no more content can be written. - * <b>NOTE:</b> <code>toString()</code> does not return a valid RTF string until + * <b>NOTE:</b> <code>toString()</code> does not return a valid RTF string until * <code>close()</code> has been called. */ @Override @@ -711,7 +715,7 @@ write("\n}}\0"); super.close(); } - } + } /** * Returns the index of the specified color in the RTF color table. * @@ -752,12 +756,12 @@ void setUnicode() { final String Win95 = "windows 95"; final String Win98 = "windows 98"; - final String WinME = "windows me"; + final String WinME = "windows me"; final String WinNT = "windows nt"; String osName = System.getProperty("os.name").toLowerCase(); String osVersion = System.getProperty("os.version"); int majorVersion = 0; - + if (osName.startsWith(WinNT) && osVersion != null) { int majorIndex = osVersion.indexOf('.'); if (majorIndex != -1) { @@ -788,7 +792,7 @@ for (int index = start; index < end; index++) { char ch = string.charAt(index); if (ch > 0x7F && WriteUnicode) { - // write the sub string from the last escaped character + // write the sub string from the last escaped character // to the current one. Fixes bug 21698. if (index > start) { write(string.substring(start, index)); @@ -798,7 +802,7 @@ write('?'); // ANSI representation (1 byte long, \\uc1) start = index + 1; } else if (ch == '}' || ch == '{' || ch == '\\') { - // write the sub string from the last escaped character + // write the sub string from the last escaped character // to the current one. Fixes bug 21698. if (index > start) { write(string.substring(start, index)); @@ -821,7 +825,7 @@ StringBuffer header = new StringBuffer(); FontData fontData = getFont().getFontData()[0]; header.append("{\\rtf1\\ansi"); - // specify code page, necessary for copy to work in bidi + // specify code page, necessary for copy to work in bidi // systems that don't support Unicode RTF. String cpg = System.getProperty("file.encoding").toLowerCase(); if (cpg.startsWith("cp") || cpg.startsWith("ms")) { @@ -838,7 +842,7 @@ header.append(" "); FontData fd = fontTable.get(i).getFontData()[0]; header.append(fd.getName()); - header.append(";"); + header.append(";"); } header.append("}}\n{\\colortbl"); for (int i = 0; i < colorTable.size(); i++) { @@ -851,7 +855,7 @@ header.append(color.getBlue()); header.append(";"); } - // some RTF readers ignore the deff0 font tag. Explicitly + // some RTF readers ignore the deff0 font tag. Explicitly // set the font for the whole document to work around this. header.append("}\n{\\f0\\fs"); // font size is specified in half points @@ -860,14 +864,14 @@ write(header.toString(), 0); } /** - * Appends the specified line text to the RTF data. Lines will be formatted - * using the styles queried from the LineStyleListener, if set, or those set + * Appends the specified line text to the RTF data. Lines will be formatted + * using the styles queried from the LineStyleListener, if set, or those set * directly in the widget. * * @param line line text to write as RTF. Must not contain line breaks * Line breaks should be written using writeLineDelimiter() - * @param lineOffset offset of the line. 0 based from the start of the - * widget document. Any text occurring before the start offset or after the + * @param lineOffset offset of the line. 0 based from the start of the + * widget document. Any text occurring before the start offset or after the * end offset specified during object creation is ignored. * @exception SWTException <ul> * <li>ERROR_IO when the writer is closed.</li> @@ -892,12 +896,12 @@ styles = event.styles; } else { lineAlignment = renderer.getLineAlignment(lineIndex, alignment); - lineIndent = renderer.getLineIndent(lineIndex, indent); + lineIndent = renderer.getLineIndent(lineIndex, indent); lineJustify = renderer.getLineJustify(lineIndex, justify); ranges = renderer.getRanges(lineOffset, line.length()); styles = renderer.getStyleRanges(lineOffset, line.length(), false); } - if (styles == null) styles = new StyleRange[0]; + if (styles == null) styles = new StyleRange[0]; Color lineBackground = renderer.getLineBackground(lineIndex, null); event = getLineBackgroundData(lineOffset, line); if (event != null && event.lineBackground != null) lineBackground = event.lineBackground; @@ -930,11 +934,11 @@ * * @param line line text to write as RTF. Must not contain line breaks * Line breaks should be written using writeLineDelimiter() - * @param lineOffset offset of the line. 0 based from the start of the - * widget document. Any text occurring before the start offset or after the + * @param lineOffset offset of the line. 0 based from the start of the + * widget document. Any text occurring before the start offset or after the * end offset specified during object creation is ignored. * @param styles styles to use for formatting. Must not be null. - * @param lineBackground line background color to use for formatting. + * @param lineBackground line background color to use for formatting. * May be null. */ void writeStyledLine(String line, int lineOffset, int ranges[], StyleRange[] styles, Color lineBackground, int indent, int alignment, boolean justify) { @@ -943,7 +947,7 @@ int writeOffset = startOffset - lineOffset; if (writeOffset >= lineLength) return; int lineIndex = Math.max(0, writeOffset); - + write("\\fi"); write(indent); switch (alignment) { @@ -953,11 +957,11 @@ } if (justify) write("\\qj"); write(" "); - + if (lineBackground != null) { write("{\\highlight"); write(getColorIndex(lineBackground, DEFAULT_BACKGROUND)); - write(" "); + write(" "); } int endOffset = startOffset + super.getCharCount(); int lineEndOffset = Math.min(lineLength, endOffset - lineOffset); @@ -982,7 +986,7 @@ // write any unstyled text if (lineIndex < start) { // copy to start of style - // style starting beyond end of write range or end of line + // style starting beyond end of write range or end of line // is guarded against above. write(line, lineIndex, start); lineIndex = start; @@ -1018,7 +1022,7 @@ if (style.strikeout) { write("\\strike"); } - write(" "); + write(" "); // copy to end of style or end of write range or end of line int copyEnd = Math.min(end, lineEndOffset); // guard against invalid styles and let style processing continue @@ -1048,21 +1052,21 @@ } /** * The <code>TextWriter</code> class is used to write widget content to - * a string. Whole and partial lines and line breaks can be written. To write - * partial lines, specify the start and length of the desired segment + * a string. Whole and partial lines and line breaks can be written. To write + * partial lines, specify the start and length of the desired segment * during object creation. * <p> - * </b>NOTE:</b> <code>toString()</code> is guaranteed to return a valid string only after close() + * </b>NOTE:</b> <code>toString()</code> is guaranteed to return a valid string only after close() * has been called. * </p> */ class TextWriter { private StringBuffer buffer; private int startOffset; // offset of first character that will be written - private int endOffset; // offset of last character that will be written. - // 0 based from the beginning of the widget text. + private int endOffset; // offset of last character that will be written. + // 0 based from the beginning of the widget text. private boolean isClosed = false; - + /** * Creates a writer that writes content starting at offset "start" * in the document. <code>start</code> and <code>length</code> can be set to specify partial lines. @@ -1085,15 +1089,15 @@ isClosed = true; } } - /** + /** * Returns the number of characters to write. * @return the integer number of characters to write */ public int getCharCount() { return endOffset - startOffset; - } - /** - * Returns the offset where writing starts. 0 based from the start of + } + /** + * Returns the offset where writing starts. 0 based from the start of * the widget text. Used to write partial lines. * @return the integer offset where writing starts */ @@ -1108,7 +1112,7 @@ return isClosed; } /** - * Returns the string. <code>close()</code> must be called before <code>toString()</code> + * Returns the string. <code>close()</code> must be called before <code>toString()</code> * is guaranteed to return a valid string. * * @return the string @@ -1155,17 +1159,17 @@ * * @param line line text to write. Must not contain line breaks * Line breaks should be written using writeLineDelimiter() - * @param lineOffset offset of the line. 0 based from the start of the - * widget document. Any text occurring before the start offset or after the + * @param lineOffset offset of the line. 0 based from the start of the + * widget document. Any text occurring before the start offset or after the * end offset specified during object creation is ignored. * @exception SWTException <ul> * <li>ERROR_IO when the writer is closed.</li> * </ul> */ - public void writeLine(String line, int lineOffset) { + public void writeLine(String line, int lineOffset) { if (isClosed) { SWT.error(SWT.ERROR_IO); - } + } int writeOffset = startOffset - lineOffset; int lineLength = line.length(); int lineIndex; @@ -1203,7 +1207,7 @@ * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -1257,6 +1261,7 @@ if (isBidiCaret()) { createCaretBitmaps(); Runnable runnable = new Runnable() { + @Override public void run() { int direction = BidiUtil.getKeyboardLanguage() == BidiUtil.KEYBOARD_BIDI ? SWT.RIGHT : SWT.LEFT; if (direction == caretDirection) return; @@ -1267,7 +1272,7 @@ }; BidiUtil.addLanguageListener(this, runnable); } - setCaret(defaultCaret); + setCaret(defaultCaret); calculateScrollBars(); createKeyBindings(); super.setCursor(display.getSystemCursor(SWT.CURSOR_IBEAM)); @@ -1275,8 +1280,8 @@ initializeAccessible(); setData("DEFAULT_DROP_TARGET_EFFECT", new StyledTextDropTargetEffect(this)); } -/** - * Adds an extended modify listener. An ExtendedModify event is sent by the +/** + * Adds an extended modify listener. An ExtendedModify event is sent by the * widget when the widget text has changed. * * @param extendedModifyListener the listener @@ -1297,15 +1302,15 @@ /** * Adds a bidirectional segment listener. * <p> - * A BidiSegmentEvent is sent - * whenever a line of text is measured or rendered. You can - * specify text ranges in the line that should be treated as if they + * A BidiSegmentEvent is sent + * whenever a line of text is measured or rendered. You can + * specify text ranges in the line that should be treated as if they * had a different direction than the surrounding text. * This may be used when adjacent segments of right-to-left text should - * not be reordered relative to each other. + * not be reordered relative to each other. * E.g., multiple Java string literals in a right-to-left language * should generally remain in logical order to each other, that is, the - * way they are stored. + * way they are stored. * </p> * * @param listener the listener @@ -1329,7 +1334,7 @@ } /** * Adds a caret listener. CaretEvent is sent when the caret offset changes. - * + * * @param listener the listener * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -1338,7 +1343,7 @@ * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when listener is null</li> * </ul> - * + * * @since 3.5 */ public void addCaretListener(CaretListener listener) { @@ -1347,7 +1352,7 @@ addListener(ST.CaretMoved, new StyledTextListener(listener)); } /** - * Adds a line background listener. A LineGetBackground event is sent by the + * Adds a line background listener. A LineGetBackground event is sent by the * widget to determine the background color for a line. * * @param listener the listener @@ -1368,7 +1373,7 @@ addListener(ST.LineGetBackground, new StyledTextListener(listener)); } /** - * Adds a line style listener. A LineGetStyle event is sent by the widget to + * Adds a line style listener. A LineGetStyle event is sent by the widget to * determine the styles for a line. * * @param listener the listener @@ -1390,8 +1395,8 @@ addListener(ST.LineGetStyle, new StyledTextListener(listener)); setCaretLocation(); } -/** - * Adds a modify listener. A Modify event is sent by the widget when the widget text +/** + * Adds a modify listener. A Modify event is sent by the widget when the widget text * has changed. * * @param modifyListener the listener @@ -1408,7 +1413,7 @@ if (modifyListener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); addListener(SWT.Modify, new TypedListener(modifyListener)); } -/** +/** * Adds a paint object listener. A paint object event is sent by the widget when an object * needs to be drawn. * @@ -1420,9 +1425,9 @@ * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when listener is null</li> * </ul> - * + * * @since 3.2 - * + * * @see PaintObjectListener * @see PaintObjectEvent */ @@ -1431,15 +1436,18 @@ if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); addListener(ST.PaintObject, new StyledTextListener(listener)); } -/** - * Adds a selection listener. A Selection event is sent by the widget when the +/** + * Adds a selection listener. A Selection event is sent by the widget when the * user changes the selection. * <p> * When <code>widgetSelected</code> is called, the event x and y fields contain - * the start and end caret indices of the selection. + * the start and end caret indices of the selection. The selection values returned are visual + * (i.e., x will always always be <= y). + * No event is sent when the caret is moved while the selection length is 0. + * </p><p> * <code>widgetDefaultSelected</code> is not called for StyledTexts. * </p> - * + * * @param listener the listener which should be notified when the user changes the receiver's selection * @exception IllegalArgumentException <ul> @@ -1459,10 +1467,10 @@ if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); addListener(SWT.Selection, new TypedListener(listener)); } -/** - * Adds a verify key listener. A VerifyKey event is sent by the widget when a key - * is pressed. The widget ignores the key press if the listener sets the doit field - * of the event to false. +/** + * Adds a verify key listener. A VerifyKey event is sent by the widget when a key + * is pressed. The widget ignores the key press if the listener sets the doit field + * of the event to false. * * @param listener the listener * @exception SWTException <ul> @@ -1478,10 +1486,10 @@ if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); addListener(ST.VerifyKey, new StyledTextListener(listener)); } -/** - * Adds a verify listener. A Verify event is sent by the widget when the widget text - * is about to change. The listener can set the event text and the doit field to - * change the text that is set in the widget or to force the widget to ignore the +/** + * Adds a verify listener. A Verify event is sent by the widget when the widget text + * is about to change. The listener can set the event text and the doit field to + * change the text that is set in the widget or to force the widget to ignore the * text change. * * @param verifyListener the listener @@ -1498,9 +1506,9 @@ if (verifyListener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); addListener(SWT.Verify, new TypedListener(verifyListener)); } -/** - * Adds a word movement listener. A movement event is sent when the boundary - * of a word is needed. For example, this occurs during word next and word +/** + * Adds a word movement listener. A movement event is sent when the boundary + * of a word is needed. For example, this occurs during word next and word * previous actions. * * @param movementListener the listener @@ -1511,12 +1519,12 @@ * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when listener is null</li> * </ul> - * + * * @see MovementEvent * @see MovementListener * @see #removeWordMovementListener - * - * @since 3.3 + * + * @since 3.3 */ public void addWordMovementListener(MovementListener movementListener) { checkWidget(); @@ -1524,7 +1532,7 @@ addListener(ST.WordNext, new StyledTextListener(movementListener)); addListener(ST.WordPrevious, new StyledTextListener(movementListener)); } -/** +/** * Appends a string to the text at the end of the widget. * * @param string the string to be appended @@ -1554,7 +1562,7 @@ setScrollBars(true); if (verticalBar != null) { verticalBar.setIncrement(getVerticalIncrement()); - } + } if (horizontalBar != null) { horizontalBar.setIncrement(getHorizontalIncrement()); } @@ -1566,6 +1574,7 @@ * The top index starts at 0. */ void calculateTopIndex(int delta) { + int oldDelta = delta; int oldTopIndex = topIndex; int oldTopIndexY = topIndexY; if (isFixedLineHeight()) { @@ -1574,7 +1583,7 @@ return; } topIndex = Compatibility.ceil(getVerticalScrollOffset(), verticalIncrement); - // Set top index to partially visible top line if no line is fully + // Set top index to partially visible top line if no line is fully // visible but at least some of the widget client area is visible. // Fixes bug 15088. if (topIndex > 0) { @@ -1582,11 +1591,11 @@ int bottomPixel = getVerticalScrollOffset() + clientAreaHeight; int fullLineTopPixel = topIndex * verticalIncrement; int fullLineVisibleHeight = bottomPixel - fullLineTopPixel; - // set top index to partially visible line if no line fully fits in + // set top index to partially visible line if no line fully fits in // client area or if space is available but not used (the latter should // never happen because we use claimBottomFreeSpace) if (fullLineVisibleHeight < verticalIncrement) { - topIndex--; + topIndex = getVerticalScrollOffset() / verticalIncrement; } } else if (topIndex >= content.getLineCount()) { topIndex = content.getLineCount() - 1; @@ -1626,6 +1635,21 @@ } } } + if (topIndex < 0) { + // TODO: This logging is in place to determine why topIndex is getting set to negative values. + // It should be deleted once we fix the root cause of this issue. See bug 487254 for details. + System.err.println("StyledText: topIndex was " + topIndex + + ", isFixedLineHeight() = " + isFixedLineHeight() + + ", delta = " + delta + + ", content.getLineCount() = " + content.getLineCount() + + ", clientAreaHeight = " + clientAreaHeight + + ", oldTopIndex = " + oldTopIndex + + ", oldTopIndexY = " + oldTopIndexY + + ", getVerticalScrollOffset = " + getVerticalScrollOffset() + + ", oldDelta = " + oldDelta + + ", getVerticalIncrement() = " + getVerticalIncrement()); + topIndex = 0; + } if (topIndex != oldTopIndex || oldTopIndexY != topIndexY) { int width = renderer.getWidth(); renderer.calculateClientArea(); @@ -1651,7 +1675,7 @@ return style & ~SWT.CENTER; } /** - * Scrolls down the text to use new space made available by a resize or by + * Scrolls down the text to use new space made available by a resize or by * deleted lines. */ void claimBottomFreeSpace() { @@ -1676,9 +1700,9 @@ int newHorizontalOffset = Math.max(0, renderer.getWidth() - clientAreaWidth); if (newHorizontalOffset < horizontalScrollOffset) { // item is no longer drawn past the right border of the client area - // align the right end of the item with the right border of the + // align the right end of the item with the right border of the // client area (window is scrolled right). - scrollHorizontal(newHorizontalOffset - horizontalScrollOffset, true); + scrollHorizontal(newHorizontalOffset - horizontalScrollOffset, true); } } void clearBlockSelection(boolean reset, boolean sendEvent) { @@ -1697,7 +1721,7 @@ */ void clearSelection(boolean sendEvent) { int selectionStart = selection.x; - int selectionEnd = selection.y; + int selectionEnd = selection.y; resetSelection(); // redraw old selection, if any if (selectionEnd - selectionStart > 0) { @@ -1743,7 +1767,7 @@ if (height == 0) height = DEFAULT_HEIGHT; if (wHint != SWT.DEFAULT) width = wHint; if (hHint != SWT.DEFAULT) height = hHint; - int wTrim = leftMargin + rightMargin + getCaretWidth(); + int wTrim = getLeftMargin() + rightMargin + getCaretWidth(); int hTrim = topMargin + bottomMargin; Rectangle rect = computeTrim(0, 0, width + wTrim, height + hTrim); return new Point (rect.width, rect.height); @@ -1753,7 +1777,7 @@ * <p> * The text will be put on the clipboard in plain text format and RTF format. * The <code>DND.CLIPBOARD</code> clipboard is used for data that is - * transferred by keyboard accelerator (such as Ctrl+C/Ctrl+V) or + * transferred by keyboard accelerator (such as Ctrl+C/Ctrl+V) or * by menu action. * </p> * @@ -1767,24 +1791,24 @@ copySelection(DND.CLIPBOARD); } /** - * Copies the selected text to the specified clipboard. The text will be put in the + * Copies the selected text to the specified clipboard. The text will be put in the * clipboard in plain text format and RTF format. * <p> - * The clipboardType is one of the clipboard constants defined in class - * <code>DND</code>. The <code>DND.CLIPBOARD</code> clipboard is - * used for data that is transferred by keyboard accelerator (such as Ctrl+C/Ctrl+V) - * or by menu action. The <code>DND.SELECTION_CLIPBOARD</code> - * clipboard is used for data that is transferred by selecting text and pasting + * The clipboardType is one of the clipboard constants defined in class + * <code>DND</code>. The <code>DND.CLIPBOARD</code> clipboard is + * used for data that is transferred by keyboard accelerator (such as Ctrl+C/Ctrl+V) + * or by menu action. The <code>DND.SELECTION_CLIPBOARD</code> + * clipboard is used for data that is transferred by selecting text and pasting * with the middle mouse button. * </p> - * + * * @param clipboardType indicates the type of clipboard * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.1 */ public void copy(int clipboardType) { @@ -1812,7 +1836,7 @@ } } } catch (SWTError error) { - // Copy to clipboard failed. This happens when another application + // Copy to clipboard failed. This happens when another application // is accessing the clipboard while we copy. Ignore the error. // Rethrow all other errors. Fixes bug 17578. if (error.code != DND.ERROR_CANNOT_SET_CLIPBOARD) { @@ -1823,16 +1847,16 @@ } /** * Returns the alignment of the widget. - * + * * @return the alignment - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @see #getLineAlignment(int) - * + * * @since 3.2 */ public int getAlignment() { @@ -1840,19 +1864,19 @@ return alignment; } /** - * Returns the Always Show Scrollbars flag. True if the scrollbars are - * always shown even if they are not required. False if the scrollbars are only + * Returns the Always Show Scrollbars flag. True if the scrollbars are + * always shown even if they are not required. False if the scrollbars are only * visible when some part of the content needs to be scrolled to be seen. - * The H_SCROLL and V_SCROLL style bits are also required to enable scrollbars in the + * The H_SCROLL and V_SCROLL style bits are also required to enable scrollbars in the * horizontal and vertical directions. - * + * * @return the Always Show Scrollbars flag value - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.8 */ public boolean getAlwaysShowScrollBars() { @@ -1889,15 +1913,15 @@ } return Math.min(height, availableHeight); } -/** +/** * Returns the color of the margins. - * + * * @return the color of the margins. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.5 */ public Color getMarginColor() { @@ -1905,24 +1929,24 @@ return marginColor != null ? marginColor : getBackground(); } /** - * Returns a string that uses only the line delimiter specified by the + * Returns a string that uses only the line delimiter specified by the * StyledTextContent implementation. * <p> * Returns only the first line if the widget has the SWT.SINGLE style. * </p> * - * @param text the text that may have line delimiters that don't - * match the model line delimiter. Possible line delimiters + * @param text the text that may have line delimiters that don't + * match the model line delimiter. Possible line delimiters * are CR ('\r'), LF ('\n'), CR/LF ("\r\n") - * @return the converted text that only uses the line delimiter - * specified by the model. Returns only the first line if the widget + * @return the converted text that only uses the line delimiter + * specified by the model. Returns only the first line if the widget * has the SWT.SINGLE style. */ -String getModelDelimitedText(String text) { +String getModelDelimitedText(String text) { int length = text.length(); if (length == 0) { return text; - } + } int crIndex = 0; int lfIndex = 0; int i = 0; @@ -1953,7 +1977,7 @@ } convertedText.append(delimiter); } - // copy remaining text if any and if not in single line mode or no + // copy remaining text if any and if not in single line mode or no // text copied thus far (because there only is one line) if (i < length && (!isSingleLine() || convertedText.length() == 0)) { convertedText.append(text.substring(i)); @@ -1983,9 +2007,9 @@ void createKeyBindings() { int nextKey = isMirrored() ? SWT.ARROW_LEFT : SWT.ARROW_RIGHT; int previousKey = isMirrored() ? SWT.ARROW_RIGHT : SWT.ARROW_LEFT; - + // Navigation - setKeyBinding(SWT.ARROW_UP, ST.LINE_UP); + setKeyBinding(SWT.ARROW_UP, ST.LINE_UP); setKeyBinding(SWT.ARROW_DOWN, ST.LINE_DOWN); if (IS_MAC) { setKeyBinding(previousKey | SWT.MOD1, ST.LINE_START); @@ -2010,23 +2034,23 @@ setKeyBinding(SWT.PAGE_DOWN | SWT.MOD1, ST.WINDOW_END); setKeyBinding(nextKey, ST.COLUMN_NEXT); setKeyBinding(previousKey, ST.COLUMN_PREVIOUS); - + // Selection - setKeyBinding(SWT.ARROW_UP | SWT.MOD2, ST.SELECT_LINE_UP); + setKeyBinding(SWT.ARROW_UP | SWT.MOD2, ST.SELECT_LINE_UP); setKeyBinding(SWT.ARROW_DOWN | SWT.MOD2, ST.SELECT_LINE_DOWN); if (IS_MAC) { setKeyBinding(previousKey | SWT.MOD1 | SWT.MOD2, ST.SELECT_LINE_START); setKeyBinding(nextKey | SWT.MOD1 | SWT.MOD2, ST.SELECT_LINE_END); - setKeyBinding(SWT.HOME | SWT.MOD2, ST.SELECT_TEXT_START); + setKeyBinding(SWT.HOME | SWT.MOD2, ST.SELECT_TEXT_START); setKeyBinding(SWT.END | SWT.MOD2, ST.SELECT_TEXT_END); - setKeyBinding(SWT.ARROW_UP | SWT.MOD1 | SWT.MOD2, ST.SELECT_TEXT_START); + setKeyBinding(SWT.ARROW_UP | SWT.MOD1 | SWT.MOD2, ST.SELECT_TEXT_START); setKeyBinding(SWT.ARROW_DOWN | SWT.MOD1 | SWT.MOD2, ST.SELECT_TEXT_END); setKeyBinding(nextKey | SWT.MOD2 | SWT.MOD3, ST.SELECT_WORD_NEXT); setKeyBinding(previousKey | SWT.MOD2 | SWT.MOD3, ST.SELECT_WORD_PREVIOUS); } else { setKeyBinding(SWT.HOME | SWT.MOD2, ST.SELECT_LINE_START); setKeyBinding(SWT.END | SWT.MOD2, ST.SELECT_LINE_END); - setKeyBinding(SWT.HOME | SWT.MOD1 | SWT.MOD2, ST.SELECT_TEXT_START); + setKeyBinding(SWT.HOME | SWT.MOD1 | SWT.MOD2, ST.SELECT_TEXT_START); setKeyBinding(SWT.END | SWT.MOD1 | SWT.MOD2, ST.SELECT_TEXT_END); setKeyBinding(nextKey | SWT.MOD1 | SWT.MOD2, ST.SELECT_WORD_NEXT); setKeyBinding(previousKey | SWT.MOD1 | SWT.MOD2, ST.SELECT_WORD_PREVIOUS); @@ -2036,8 +2060,8 @@ setKeyBinding(SWT.PAGE_UP | SWT.MOD1 | SWT.MOD2, ST.SELECT_WINDOW_START); setKeyBinding(SWT.PAGE_DOWN | SWT.MOD1 | SWT.MOD2, ST.SELECT_WINDOW_END); setKeyBinding(nextKey | SWT.MOD2, ST.SELECT_COLUMN_NEXT); - setKeyBinding(previousKey | SWT.MOD2, ST.SELECT_COLUMN_PREVIOUS); - + setKeyBinding(previousKey | SWT.MOD2, ST.SELECT_COLUMN_PREVIOUS); + // Modification // Cut, Copy, Paste setKeyBinding('X' | SWT.MOD1, ST.CUT); @@ -2058,7 +2082,7 @@ setKeyBinding(SWT.DEL, ST.DELETE_NEXT); setKeyBinding(SWT.BS | SWT.MOD1, ST.DELETE_WORD_PREVIOUS); setKeyBinding(SWT.DEL | SWT.MOD1, ST.DELETE_WORD_NEXT); - + // Miscellaneous setKeyBinding(SWT.INSERT, ST.TOGGLE_OVERWRITE); } @@ -2078,15 +2102,15 @@ } int lineHeight = renderer.getLineHeight(); leftCaretBitmap = new Image(display, caretWidth, lineHeight); - GC gc = new GC (leftCaretBitmap); + GC gc = new GC (leftCaretBitmap); gc.setBackground(display.getSystemColor(SWT.COLOR_BLACK)); gc.fillRectangle(0, 0, caretWidth, lineHeight); gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE)); gc.drawLine(0,0,0,lineHeight); gc.drawLine(0,0,caretWidth-1,0); gc.drawLine(0,1,1,1); - gc.dispose(); - + gc.dispose(); + if (rightCaretBitmap != null) { if (defaultCaret != null && rightCaretBitmap.equals(defaultCaret.getImage())) { defaultCaret.setImage(null); @@ -2094,7 +2118,7 @@ rightCaretBitmap.dispose(); } rightCaretBitmap = new Image(display, caretWidth, lineHeight); - gc = new GC (rightCaretBitmap); + gc = new GC (rightCaretBitmap); gc.setBackground(display.getSystemColor(SWT.COLOR_BLACK)); gc.fillRectangle(0, 0, caretWidth, lineHeight); gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE)); @@ -2104,7 +2128,7 @@ gc.dispose(); } /** - * Moves the selected text to the clipboard. The text will be put in the + * Moves the selected text to the clipboard. The text will be put in the * clipboard in plain text format and RTF format. * * @exception SWTException <ul> @@ -2124,9 +2148,9 @@ } } } -/** +/** * A mouse move event has occurred. See if we should start autoscrolling. If - * the move position is outside of the client area, initiate autoscrolling. + * the move position is outside of the client area, initiate autoscrolling. * Otherwise, we've moved back into the widget so end autoscrolling. */ void doAutoScroll(Event event) { @@ -2143,7 +2167,7 @@ endAutoScroll(); } } -/** +/** * Initiates autoscrolling. * * @param direction SWT.UP, SWT.DOWN, SWT.COLUMN_NEXT, SWT.COLUMN_PREVIOUS @@ -2154,13 +2178,14 @@ if (autoScrollDirection == direction) { return; } - + Runnable timer = null; final Display display = getDisplay(); // Set a timer that will simulate the user pressing and holding // down a cursor key (i.e., arrowUp, arrowDown). if (direction == SWT.UP) { timer = new Runnable() { + @Override public void run() { /* Bug 437357 - NPE in StyledText.getCaretLine * StyledText.content is null at times, probably because the @@ -2187,6 +2212,7 @@ display.timerExec(V_SCROLL_RATE, timer); } else if (direction == SWT.DOWN) { timer = new Runnable() { + @Override public void run() { /* Bug 437357 - NPE in StyledText.getCaretLine * StyledText.content is null at times, probably because the @@ -2214,6 +2240,7 @@ display.timerExec(V_SCROLL_RATE, timer); } else if (direction == ST.COLUMN_NEXT) { timer = new Runnable() { + @Override public void run() { /* Bug 437357 - NPE in StyledText.getCaretLine * StyledText.content is null at times, probably because the @@ -2242,6 +2269,7 @@ display.timerExec(H_SCROLL_RATE, timer); } else if (direction == ST.COLUMN_PREVIOUS) { timer = new Runnable() { + @Override public void run() { /* Bug 437357 - NPE in StyledText.getCaretLine * StyledText.content is null at times, probably because the @@ -2394,7 +2422,7 @@ if (lineIndex + 1 < lineCount) { y = getLinePixel(lineIndex + 2) - 1; setBlockSelectionLocation(blockXLocation - horizontalScrollOffset, y, true); - int bottom = clientAreaHeight - bottomMargin; + int bottom = clientAreaHeight - bottomMargin; if (y > bottom) { scrollVertical(y - bottom, true); } @@ -2455,10 +2483,10 @@ sendAccessibleTextCaretMoved(); } /** - * Replaces the selection with the character or insert the character at the + * Replaces the selection with the character or insert the character at the * current caret position if no selection exists. * <p> - * If a carriage return was typed replace it with the line break character + * If a carriage return was typed replace it with the line break character * used by the widget on this platform. * </p> * @@ -2469,7 +2497,7 @@ insertBlockSelectionText(key, SWT.NULL); return; } - + Event event = new Event(); event.start = selection.x; event.end = selection.y; @@ -2482,11 +2510,11 @@ } } else if (selection.x == selection.y && overwrite && key != TAB) { // no selection and overwrite mode is on and the typed key is not a - // tab character (tabs are always inserted without overwriting)? + // tab character (tabs are always inserted without overwriting)? int lineIndex = content.getLineAtOffset(event.end); int lineOffset = content.getOffsetAtLine(lineIndex); String line = content.getLine(lineIndex); - // replace character at caret offset if the caret is not at the + // replace character at caret offset if the caret is not at the // end of the line if (event.end < lineOffset + line.length()) { event.end++; @@ -2506,12 +2534,12 @@ * Moves the caret after the last character of the widget content. */ void doContentEnd() { - // place caret at end of first line if receiver is in single + // place caret at end of first line if receiver is in single // line mode. fixes 4820. if (isSingleLine()) { doLineEnd(); } else { - int length = content.getCharCount(); + int length = content.getCharCount(); setCaretOffset(length, SWT.DEFAULT); showCaret(); } @@ -2525,7 +2553,7 @@ } /** * Moves the caret to the start of the selection if a selection exists. - * Otherwise, if no selection exists move the cursor according to the + * Otherwise, if no selection exists move the cursor according to the * cursor selection rules. * * @see #doSelectionCursorPrevious @@ -2540,7 +2568,7 @@ } /** * Moves the caret to the end of the selection if a selection exists. - * Otherwise, if no selection exists move the cursor according to the + * Otherwise, if no selection exists move the cursor according to the * cursor selection rules. * * @see #doSelectionCursorNext @@ -2582,7 +2610,7 @@ */ void doDeleteWordNext() { if (selection.x != selection.y) { - // if a selection exists, treat the as if + // if a selection exists, treat the as if // only the delete key was pressed doDelete(); } else { @@ -2598,7 +2626,7 @@ */ void doDeleteWordPrevious() { if (selection.x != selection.y) { - // if a selection exists, treat as if + // if a selection exists, treat as if // only the backspace key was pressed doBackspace(); } else { @@ -2610,8 +2638,8 @@ } } /** - * Moves the caret one line down and to the same character offset relative - * to the beginning of the line. Move the caret to the end of the new line + * Moves the caret one line down and to the same character offset relative + * to the beginning of the line. Move the caret to the end of the new line * if the new line is shorter than the character offset. Moves the caret to * the end of the text if the caret already is on the last line. */ @@ -2631,6 +2659,7 @@ caretLine++; } else { y = layout.getLineBounds(lineIndex + 1).y; + y++; // bug 485722: workaround for fractional line heights } renderer.disposeTextLayout(layout); } else { @@ -2641,14 +2670,14 @@ setCaretOffset(content.getCharCount(), SWT.DEFAULT); } else { int[] alignment = new int[1]; - int offset = getOffsetAtPoint(columnX, y, caretLine, alignment); + int offset = getOffsetAtPoint(columnX, y, caretLine, alignment); setCaretOffset(offset, alignment[0]); } int oldColumnX = columnX; int oldHScrollOffset = horizontalScrollOffset; if (select) { - setMouseWordSelectionAnchor(); - // select first and then scroll to reduce flash when key + setMouseWordSelectionAnchor(); + // select first and then scroll to reduce flash when key // repeat scrolls lots of lines doSelection(ST.COLUMN_NEXT); } @@ -2661,7 +2690,7 @@ */ void doLineEnd() { int caretLine = getCaretLine(); - int lineOffset = content.getOffsetAtLine(caretLine); + int lineOffset = content.getOffsetAtLine(caretLine); int lineEndOffset; if (wordWrap || visualWrap) { TextLayout layout = renderer.getTextLayout(caretLine); @@ -2695,8 +2724,8 @@ showCaret(); } /** - * Moves the caret one line up and to the same character offset relative - * to the beginning of the line. Move the caret to the end of the new line + * Moves the caret one line up and to the same character offset relative + * to the beginning of the line. Move the caret to the end of the new line * if the new line is shorter than the character offset. Moves the caret to * the beginning of the document if it is already on the first line. */ @@ -2713,9 +2742,11 @@ if (!firstLine) { caretLine--; y = renderer.getLineHeight(caretLine) - 1; + y--; // bug 485722: workaround for fractional line heights } } else { y = layout.getLineBounds(lineIndex - 1).y; + y++; // bug 485722: workaround for fractional line heights } renderer.disposeTextLayout(layout); } else { @@ -2726,7 +2757,7 @@ setCaretOffset(0, SWT.DEFAULT); } else { int[] alignment = new int[1]; - int offset = getOffsetAtPoint(columnX, y, caretLine, alignment); + int offset = getOffsetAtPoint(columnX, y, caretLine, alignment); setCaretOffset(offset, alignment[0]); } int oldColumnX = columnX; @@ -2769,7 +2800,7 @@ int line = getLineIndex(y); updateCaretDirection = true; - + if (blockSelection) { x = Math.max(leftMargin, Math.min(x, clientAreaWidth - rightMargin)); y = Math.max(topMargin, Math.min(y, clientAreaHeight - bottomMargin)); @@ -2777,7 +2808,7 @@ boolean wordSelect = (clickCount & 1) == 0; if (wordSelect) { Point left = getPointAtOffset(doubleClickSelection.x); - int[] trailing = new int[1]; + int[] trailing = new int[1]; int offset = getOffsetAtPoint(x, y, trailing, true); if (offset != -1) { if (x > left.x) { @@ -2807,7 +2838,7 @@ } else { clearBlockSelection(true, false); } - int[] trailing = new int[1]; + int[] trailing = new int[1]; int offset = getOffsetAtPoint(x, y, trailing, true); if (offset != -1) { if (select) { @@ -2816,7 +2847,7 @@ } } else { if (isFixedLineHeight() && renderer.fixedPitch) { - int avg = renderer.averageCharWidth; + int avg = renderer.averageCharWidth; x = ((x + avg / 2 - leftMargin + horizontalScrollOffset) / avg * avg) + leftMargin - horizontalScrollOffset; } setBlockSelectionLocation(x, y, true); @@ -2824,8 +2855,8 @@ } } } - - // allow caret to be placed below first line only if receiver is + + // allow caret to be placed below first line only if receiver is // not in single line mode. fixes 4820. if (line < 0 || (isSingleLine() && line > 0)) { return; @@ -2833,18 +2864,18 @@ int[] alignment = new int[1]; int newCaretOffset = getOffsetAtPoint(x, y, alignment); int newCaretAlignemnt = alignment[0]; - + if (doubleClickEnabled && clickCount > 1) { newCaretOffset = doMouseWordSelect(x, newCaretOffset, line); } - + int newCaretLine = content.getLineAtOffset(newCaretOffset); - - // Is the mouse within the left client area border or on - // a different line? If not the autoscroll selection + + // Is the mouse within the left client area border or on + // a different line? If not the autoscroll selection // could be incorrectly reset. Fixes 1GKM3XS boolean vchange = 0 <= y && y < clientAreaHeight || newCaretLine == 0 || newCaretLine == content.getLineCount() - 1; - boolean hchange = 0 <= x && x < clientAreaWidth || wordWrap || newCaretLine != content.getLineAtOffset(caretOffset); + boolean hchange = 0 <= x && x < clientAreaWidth || wordWrap || newCaretLine != content.getLineAtOffset(caretOffset); if (vchange && hchange && (newCaretOffset != caretOffset || newCaretAlignemnt != caretAlignment)) { setCaretOffset(newCaretOffset, newCaretAlignemnt); if (select) doMouseSelection(); @@ -2859,8 +2890,8 @@ * Updates the selection based on the caret position */ void doMouseSelection() { - if (caretOffset <= selection.x || - (caretOffset > selection.x && + if (caretOffset <= selection.x || + (caretOffset > selection.x && caretOffset < selection.y && selectionAnchor == selection.x)) { doSelection(ST.COLUMN_PREVIOUS); } else { @@ -2868,20 +2899,20 @@ } } /** - * Returns the offset of the word at the specified offset. - * If the current selection extends from high index to low index - * (i.e., right to left, or caret is at left border of selection on + * Returns the offset of the word at the specified offset. + * If the current selection extends from high index to low index + * (i.e., right to left, or caret is at left border of selection on * non-bidi platforms) the start offset of the word preceding the - * selection is returned. If the current selection extends from - * low index to high index the end offset of the word following + * selection is returned. If the current selection extends from + * low index to high index the end offset of the word following * the selection is returned. - * + * * @param x mouse x location * @param newCaretOffset caret offset of the mouse cursor location * @param line line index of the mouse cursor location */ int doMouseWordSelect(int x, int newCaretOffset, int line) { - // flip selection anchor based on word selection direction from + // flip selection anchor based on word selection direction from // base double click. Always do this here (and don't rely on doAutoScroll) // because auto scroll only does not cover all possible mouse selections // (e.g., mouse x < 0 && mouse y > caret line y) @@ -2906,7 +2937,7 @@ if (line + 1 < content.getLineCount()) { lineEnd = content.getOffsetAtLine(line + 1); } - newCaretOffset = lineEnd; + newCaretOffset = lineEnd; } } } @@ -2916,9 +2947,9 @@ * Scrolls one page down so that the last line (truncated or whole) * of the current page becomes the fully visible top line. * <p> - * The caret is scrolled the same number of lines so that its location - * relative to the top line remains the same. The exception is the end - * of the text where a full page scroll is not possible. In this case + * The caret is scrolled the same number of lines so that its location + * relative to the top line remains the same. The exception is the end + * of the text where a full page scroll is not possible. In this case * the caret is moved after the last character. * </p> * @@ -2935,7 +2966,7 @@ int lineHeight = renderer.getLineHeight(); int lines = (height == -1 ? clientAreaHeight : height) / lineHeight; int scrollLines = Math.min(lineCount - caretLine - 1, lines); - // ensure that scrollLines never gets negative and at least one + // ensure that scrollLines never gets negative and at least one // line is scrolled. fixes bug 5602. scrollLines = Math.max(1, scrollLines); int[] alignment = new int[1]; @@ -3020,10 +3051,10 @@ height = getAvailableHeightBellow(height); scrollVertical(height, true); if (height == 0) setCaretLocation(); - } + } showCaret(); int hScrollChange = oldHScrollOffset - horizontalScrollOffset; - columnX = oldColumnX + hScrollChange; + columnX = oldColumnX + hScrollChange; } /** * Moves the cursor to the end of the last fully visible line. @@ -3087,7 +3118,7 @@ } else { topOffset = content.getOffsetAtLine(lineIndex) + layout.getLineOffsets()[index]; } - renderer.disposeTextLayout(layout); + renderer.disposeTextLayout(layout); } else { topOffset = content.getOffsetAtLine(topIndex); } @@ -3099,17 +3130,17 @@ /** * Scrolls one page up so that the first line (truncated or whole) * of the current page becomes the fully visible last line. - * The caret is scrolled the same number of lines so that its location - * relative to the top line remains the same. The exception is the beginning + * The caret is scrolled the same number of lines so that its location + * relative to the top line remains the same. The exception is the beginning * of the text where a full page scroll is not possible. In this case the * caret is moved in front of the first character. */ void doPageUp(boolean select, int height) { if (isSingleLine()) return; int oldHScrollOffset = horizontalScrollOffset; - int oldColumnX = columnX; + int oldColumnX = columnX; if (isFixedLineHeight()) { - int caretLine = getCaretLine(); + int caretLine = getCaretLine(); if (caretLine > 0) { int lineHeight = renderer.getLineHeight(); int lines = (height == -1 ? clientAreaHeight : height) / lineHeight; @@ -3197,7 +3228,7 @@ if (select) doSelection(ST.COLUMN_PREVIOUS); height = getAvailableHeightAbove(height); scrollVertical(-height, true); - if (height == 0) setCaretLocation(); + if (height == 0) setCaretLocation(); } showCaret(); int hScrollChange = oldHScrollOffset - horizontalScrollOffset; @@ -3208,15 +3239,15 @@ */ void doSelection(int direction) { int redrawStart = -1; - int redrawEnd = -1; + int redrawEnd = -1; if (selectionAnchor == -1) { selectionAnchor = selection.x; - } + } if (direction == ST.COLUMN_PREVIOUS) { if (caretOffset < selection.x) { // grow selection - redrawEnd = selection.x; - redrawStart = selection.x = caretOffset; + redrawEnd = selection.x; + redrawStart = selection.x = caretOffset; // check if selection has reversed direction if (selection.y != selectionAnchor) { redrawEnd = selection.y; @@ -3224,10 +3255,10 @@ } // test whether selection actually changed. Fixes 1G71EO1 } else if (selectionAnchor == selection.x && caretOffset < selection.y) { - // caret moved towards selection anchor (left side of selection). - // shrink selection + // caret moved towards selection anchor (left side of selection). + // shrink selection redrawEnd = selection.y; - redrawStart = selection.y = caretOffset; + redrawStart = selection.y = caretOffset; } } else { if (caretOffset > selection.y) { @@ -3236,15 +3267,15 @@ redrawEnd = selection.y = caretOffset; // check if selection has reversed direction if (selection.x != selectionAnchor) { - redrawStart = selection.x; + redrawStart = selection.x; selection.x = selectionAnchor; } - // test whether selection actually changed. Fixes 1G71EO1 + // test whether selection actually changed. Fixes 1G71EO1 } else if (selectionAnchor == selection.y && caretOffset > selection.x) { - // caret moved towards selection anchor (right side of selection). - // shrink selection + // caret moved towards selection anchor (right side of selection). + // shrink selection redrawStart = selection.x; - redrawEnd = selection.x = caretOffset; + redrawEnd = selection.x = caretOffset; } } if (redrawStart != -1 && redrawEnd != -1) { @@ -3254,7 +3285,7 @@ sendAccessibleTextCaretMoved(); } /** - * Moves the caret to the next character or to the beginning of the + * Moves the caret to the next character or to the beginning of the * next line if the cursor is at the end of a line. */ void doSelectionCursorNext() { @@ -3272,7 +3303,7 @@ setCaretOffset(offset, alignment); showCaret(); } else if (caretLine < content.getLineCount() - 1 && !isSingleLine()) { - caretLine++; + caretLine++; offset = content.getOffsetAtLine(caretLine); alignment = PREVIOUS_OFFSET_TRAILING; setCaretOffset(offset, alignment); @@ -3280,7 +3311,7 @@ } } /** - * Moves the caret to the previous character or to the end of the previous + * Moves the caret to the previous character or to the end of the previous * line if the cursor is at the beginning of a line. */ void doSelectionCursorPrevious() { @@ -3300,10 +3331,10 @@ } } /** - * Moves the caret one line down and to the same character offset relative - * to the beginning of the line. Moves the caret to the end of the new line + * Moves the caret one line down and to the same character offset relative + * to the beginning of the line. Moves the caret to the end of the new line * if the new line is shorter than the character offset. - * Moves the caret to the end of the text if the caret already is on the + * Moves the caret to the end of the text if the caret already is on the * last line. * Adjusts the selection according to the caret change. This can either add * to or subtract from the old selection, depending on the previous selection @@ -3315,8 +3346,8 @@ columnX = oldColumnX; } /** - * Moves the caret one line up and to the same character offset relative - * to the beginning of the line. Moves the caret to the end of the new line + * Moves the caret one line up and to the same character offset relative + * to the beginning of the line. Moves the caret to the end of the new line * if the new line is shorter than the character offset. * Moves the caret to the beginning of the document if it is already on the * first line. @@ -3325,17 +3356,17 @@ * direction. */ void doSelectionLineUp() { - int oldColumnX = columnX = getPointAtOffset(caretOffset).x; - doLineUp(true); + int oldColumnX = columnX = getPointAtOffset(caretOffset).x; + doLineUp(true); columnX = oldColumnX; } /** * Scrolls one page down so that the last line (truncated or whole) * of the current page becomes the fully visible top line. * <p> - * The caret is scrolled the same number of lines so that its location - * relative to the top line remains the same. The exception is the end - * of the text where a full page scroll is not possible. In this case + * The caret is scrolled the same number of lines so that its location + * relative to the top line remains the same. The exception is the end + * of the text where a full page scroll is not possible. In this case * the caret is moved after the last character. * <p></p> * Adjusts the selection according to the caret change. This can either add @@ -3352,8 +3383,8 @@ * Scrolls one page up so that the first line (truncated or whole) * of the current page becomes the fully visible last line. * <p> - * The caret is scrolled the same number of lines so that its location - * relative to the top line remains the same. The exception is the beginning + * The caret is scrolled the same number of lines so that its location + * relative to the top line remains the same. The exception is the beginning * of the text where a full page scroll is not possible. In this case the * caret is moved in front of the first character. * </p><p> @@ -3372,9 +3403,9 @@ */ void doSelectionWordNext() { int offset = getWordNext(caretOffset, SWT.MOVEMENT_WORD); - // don't change caret position if in single line mode and the cursor + // don't change caret position if in single line mode and the cursor // would be on a different line. fixes 5673 - if (!isSingleLine() || + if (!isSingleLine() || content.getLineAtOffset(caretOffset) == content.getLineAtOffset(offset)) { // Force symmetrical movement for word next and previous. Fixes 14536 setCaretOffset(offset, OFFSET_LEADING); @@ -3391,8 +3422,8 @@ } /** * Moves the caret one character to the left. Do not go to the previous line. - * When in a bidi locale and at a R2L character the caret is moved to the - * beginning of the R2L segment (visually right) and then one character to the + * When in a bidi locale and at a R2L character the caret is moved to the + * beginning of the R2L segment (visually right) and then one character to the * left (visually left because it's now in a L2R segment). */ void doVisualPrevious() { @@ -3402,8 +3433,8 @@ } /** * Moves the caret one character to the right. Do not go to the next line. - * When in a bidi locale and at a R2L character the caret is moved to the - * end of the R2L segment (visually left) and then one character to the + * When in a bidi locale and at a R2L character the caret is moved to the + * end of the R2L segment (visually left) and then one character to the * right (visually right because it's now in a L2R segment). */ void doVisualNext() { @@ -3437,7 +3468,7 @@ doSelectionWordPrevious(); } } -/** +/** * Ends the autoscroll process. */ void endAutoScroll() { @@ -3453,9 +3484,9 @@ } /** * Returns the baseline, in pixels. - * - * Note: this API should not be used if a StyleRange attribute causes lines to - * have different heights (i.e. different fonts, rise, etc). + * + * Note: this API should not be used if a StyleRange attribute causes lines to + * have different heights (i.e. different fonts, rise, etc). * * @return baseline the baseline * @exception SWTException <ul> @@ -3463,7 +3494,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @since 3.0 - * + * * @see #getBaseline(int) */ public int getBaseline() { @@ -3471,20 +3502,20 @@ return renderer.getBaseline(); } /** - * Returns the baseline at the given offset, in pixels. + * Returns the baseline at the given offset, in pixels. * * @param offset the offset - * + * * @return baseline the baseline - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_RANGE when the offset is outside the valid range (< 0 or > getCharCount())</li> + * <li>ERROR_INVALID_RANGE when the offset is outside the valid range (< 0 or > getCharCount())</li> * </ul> - * + * * @since 3.2 */ public int getBaseline(int offset) { @@ -3513,7 +3544,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @deprecated use BidiSegmentListener instead. */ @Deprecated @@ -3525,12 +3556,12 @@ * Returns whether the widget is in block selection mode. * * @return true if widget is in block selection mode, false otherwise - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.5 */ public boolean getBlockSelection() { @@ -3539,7 +3570,7 @@ } Rectangle getBlockSelectionPosition() { int firstLine = getLineIndex(blockYAnchor - getVerticalScrollOffset()); - int lastLine = getLineIndex(blockYLocation - getVerticalScrollOffset()); + int lastLine = getLineIndex(blockYLocation - getVerticalScrollOffset()); if (firstLine > lastLine) { int temp = firstLine; firstLine = lastLine; @@ -3553,17 +3584,17 @@ } return new Rectangle (left - horizontalScrollOffset, firstLine, right - horizontalScrollOffset, lastLine); } -/** - * Returns the block selection bounds. The bounds is +/** + * Returns the block selection bounds. The bounds is * relative to the upper left corner of the document. - * + * * @return the block selection bounds - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.5 */ public Rectangle getBlockSelectionBounds() { @@ -3607,11 +3638,11 @@ } String text = content.getTextRange(start, end - start); buffer.append(text); - if (lineIndex < lastLine) buffer.append(delimiter); + if (lineIndex < lastLine) buffer.append(delimiter); } return buffer.toString(); } -/** +/** * Returns the index of the last fully visible line. * * @return index of the last fully visible line. @@ -3642,7 +3673,7 @@ } return bottomIndex; } -/** +/** * Returns the bottom margin. * * @return the bottom margin. @@ -3650,7 +3681,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.5 */ public int getBottomMargin() { @@ -3663,10 +3694,10 @@ String line = content.getLine(lineIndex); Rectangle bounds; if (line.length() != 0) { - int offsetInLine = offset - lineOffset; TextLayout layout = renderer.getTextLayout(lineIndex); + int offsetInLine = Math.min (layout.getText().length(), Math.max (0, offset - lineOffset)); if (caretAlignment == PREVIOUS_OFFSET_TRAILING && offsetInLine != 0) { - offsetInLine = layout.getPreviousOffset(offsetInLine, SWT.MOVEMENT_CLUSTER); + offsetInLine = layout.getPreviousOffset(offsetInLine, SWT.MOVEMENT_CLUSTER); Point point = layout.getLocation(offsetInLine, true); bounds = new Rectangle (point.x, point.y, 0, renderer.getLineHeight()); } else { @@ -3714,7 +3745,7 @@ return clipboard.getContents(plainTextTransfer, clipboardType); } int getClusterNext(int offset, int lineIndex) { - int lineOffset = content.getOffsetAtLine(lineIndex); + int lineOffset = content.getOffsetAtLine(lineIndex); TextLayout layout = renderer.getTextLayout(lineIndex); offset -= lineOffset; offset = layout.getNextOffset(offset, SWT.MOVEMENT_CLUSTER); @@ -3723,7 +3754,7 @@ return offset; } int getClusterPrevious(int offset, int lineIndex) { - int lineOffset = content.getOffsetAtLine(lineIndex); + int lineOffset = content.getOffsetAtLine(lineIndex); TextLayout layout = renderer.getTextLayout(lineIndex); offset -= lineOffset; offset = layout.getPreviousOffset(offset, SWT.MOVEMENT_CLUSTER); @@ -3733,9 +3764,9 @@ } /** * Returns the content implementation that is used for text storage. - * + * * @return content the user defined content implementation that is used for - * text storage or the default content implementation if no user defined + * text storage or the default content implementation if no user defined * content implementation has been set. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -3751,7 +3782,7 @@ checkWidget (); return dragDetect; } -/** +/** * Returns whether the widget implements double click mouse behavior. * * @return true if double clicking a word selects the word, false if double clicks @@ -3786,15 +3817,15 @@ } return foreground; } -/** +/** * Returns the horizontal scroll increment. * * @return horizontal scroll increment. */ -int getHorizontalIncrement() { +int getHorizontalIncrement() { return renderer.averageCharWidth; } -/** +/** * Returns the horizontal scroll offset relative to the start of the line. * * @return horizontal scroll offset relative to the start of the line, @@ -3808,7 +3839,7 @@ checkWidget(); return horizontalScrollOffset / getHorizontalIncrement(); } -/** +/** * Returns the horizontal scroll offset relative to the start of the line. * * @return the horizontal scroll offset relative to the start of the line, @@ -3824,16 +3855,16 @@ } /** * Returns the line indentation of the widget. - * + * * @return the line indentation - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @see #getLineIndent(int) - * + * * @since 3.2 */ public int getIndent() { @@ -3842,32 +3873,32 @@ } /** * Returns whether the widget justifies lines. - * + * * @return whether lines are justified - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @see #getLineJustify(int) - * + * * @since 3.2 */ public boolean getJustify() { checkWidget(); return justify; } -/** +/** * Returns the action assigned to the key. * Returns SWT.NULL if there is no action associated with the key. * - * @param key a key code defined in SWT.java or a character. + * @param key a key code defined in SWT.java or a character. * Optionally ORd with a state mask. Preferred state masks are one or more of - * SWT.MOD1, SWT.MOD2, SWT.MOD3, since these masks account for modifier platform + * SWT.MOD1, SWT.MOD2, SWT.MOD3, since these masks account for modifier platform * differences. However, there may be cases where using the specific state masks * (i.e., SWT.CTRL, SWT.SHIFT, SWT.ALT, SWT.COMMAND) makes sense. - * @return one of the predefined actions defined in ST.java or SWT.NULL + * @return one of the predefined actions defined in ST.java or SWT.NULL * if there is no action associated with the key. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -3876,7 +3907,7 @@ */ public int getKeyBinding(int key) { checkWidget(); - Integer action = keyActionMap.get(new Integer(key)); + Integer action = keyActionMap.get(key); return action == null ? SWT.NULL : action.intValue(); } /** @@ -3900,31 +3931,31 @@ * * @param lineIndex index of the line to return. * @return the line text without delimiters - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_RANGE when the line index is outside the valid range (< 0 or >= getLineCount())</li> + * <li>ERROR_INVALID_RANGE when the line index is outside the valid range (< 0 or >= getLineCount())</li> * </ul> * @since 3.4 */ public String getLine(int lineIndex) { checkWidget(); - if (lineIndex < 0 || + if (lineIndex < 0 || (lineIndex > 0 && lineIndex >= content.getLineCount())) { - SWT.error(SWT.ERROR_INVALID_RANGE); + SWT.error(SWT.ERROR_INVALID_RANGE); } return content.getLine(lineIndex); } /** * Returns the alignment of the line at the given index. - * + * * @param index the index of the line - * + * * @return the line alignment - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -3932,9 +3963,9 @@ * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_ARGUMENT when the index is invalid</li> * </ul> - * + * * @see #getAlignment() - * + * * @since 3.2 */ public int getLineAlignment(int index) { @@ -3949,7 +3980,7 @@ * where 0 < offset < getCharCount() so that getLineAtOffset(getCharCount()) * returns the line of the insert location. * - * @param offset offset relative to the start of the content. + * @param offset offset relative to the start of the content. * 0 <= offset <= getCharCount() * @return line at the specified offset in the text * @exception SWTException <ul> @@ -3957,26 +3988,26 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_RANGE when the offset is outside the valid range (< 0 or > getCharCount())</li> + * <li>ERROR_INVALID_RANGE when the offset is outside the valid range (< 0 or > getCharCount())</li> * </ul> */ public int getLineAtOffset(int offset) { - checkWidget(); + checkWidget(); if (offset < 0 || offset > getCharCount()) { - SWT.error(SWT.ERROR_INVALID_RANGE); + SWT.error(SWT.ERROR_INVALID_RANGE); } return content.getLineAtOffset(offset); } /** * Returns the background color of the line at the given index. - * Returns null if a LineBackgroundListener has been set or if no background + * Returns null if a LineBackgroundListener has been set or if no background * color has been specified for the line. Should not be called if a * LineBackgroundListener has been set since the listener maintains the * line background colors. - * + * * @param index the index of the line * @return the background color of the line at the given index. - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -3994,11 +4025,11 @@ } /** * Returns the bullet of the line at the given index. - * + * * @param index the index of the line - * + * * @return the line bullet - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -4006,7 +4037,7 @@ * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_ARGUMENT when the index is invalid</li> * </ul> - * + * * @since 3.2 */ public Bullet getLineBullet(int index) { @@ -4017,9 +4048,9 @@ return isListening(ST.LineGetStyle) ? null : renderer.getLineBullet(index, null); } /** - * Returns the line background data for the given line or null if + * Returns the line background data for the given line or null if * there is none. - * + * * @param lineOffset offset of the line start relative to the start * of the content. * @param line line to get line background data for @@ -4028,7 +4059,7 @@ StyledTextEvent getLineBackgroundData(int lineOffset, String line) { return sendLineEvent(ST.LineGetBackground, lineOffset, line); } -/** +/** * Gets the number of text lines. * * @return the number of lines in the widget @@ -4042,10 +4073,10 @@ return content.getLineCount(); } /** - * Returns the number of lines that can be completely displayed in the + * Returns the number of lines that can be completely displayed in the * widget client area. * - * @return number of lines that can be completely displayed in the widget + * @return number of lines that can be completely displayed in the widget * client area. */ int getLineCountWhole() { @@ -4073,7 +4104,7 @@ /** * Returns the line height. * <p> - * Note: this API should not be used if a StyleRange attribute causes lines to + * Note: this API should not be used if a StyleRange attribute causes lines to * have different heights (i.e. different fonts, rise, etc). * </p> * @@ -4092,17 +4123,17 @@ * Returns the line height at the given offset. * * @param offset the offset - * + * * @return line height in pixels - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_RANGE when the offset is outside the valid range (< 0 or > getCharCount())</li> - * </ul> - * + * <li>ERROR_INVALID_RANGE when the offset is outside the valid range (< 0 or > getCharCount())</li> + * </ul> + * * @since 3.2 */ public int getLineHeight(int offset) { @@ -4123,11 +4154,11 @@ } /** * Returns the indentation of the line at the given index. - * + * * @param index the index of the line - * + * * @return the line indentation - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -4135,9 +4166,9 @@ * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_ARGUMENT when the index is invalid</li> * </ul> - * + * * @see #getIndent() - * + * * @since 3.2 */ public int getLineIndent(int index) { @@ -4149,11 +4180,11 @@ } /** * Returns whether the line at the given index is justified. - * + * * @param index the index of the line - * - * @return whether the line is justified - * + * + * @return whether the line is justified + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -4161,9 +4192,9 @@ * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_ARGUMENT when the index is invalid</li> * </ul> - * + * * @see #getJustify() - * + * * @since 3.2 */ public boolean getLineJustify(int index) { @@ -4171,18 +4202,18 @@ if (index < 0 || index > content.getLineCount()) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); } - return isListening(ST.LineGetStyle) ? false : renderer.getLineJustify(index, justify); + return isListening(ST.LineGetStyle) ? false : renderer.getLineJustify(index, justify); } /** * Returns the line spacing of the widget. - * + * * @return the line spacing - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.2 */ public int getLineSpacing() { @@ -4190,18 +4221,18 @@ return lineSpacing; } /** - * Returns the line style data for the given line or null if there is + * Returns the line style data for the given line or null if there is * none. * <p> - * If there is a LineStyleListener but it does not set any styles, - * the StyledTextEvent.styles field will be initialized to an empty + * If there is a LineStyleListener but it does not set any styles, + * the StyledTextEvent.styles field will be initialized to an empty * array. * </p> - * - * @param lineOffset offset of the line start relative to the start of + * + * @param lineOffset offset of the line start relative to the start of * the content. * @param line line to get line styles for - * @return line style data for the given line. Styles may start before + * @return line style data for the given line. Styles may start before * line start and end after line end */ StyledTextEvent getLineStyleData(int lineOffset, String line) { @@ -4210,13 +4241,13 @@ /** * Returns the top pixel, relative to the client area, of a given line. * Clamps out of ranges index. - * + * * @param lineIndex the line index, the max value is lineCount. If * lineIndex == lineCount it returns the bottom pixel of the last line. * It means this function can be used to retrieve the bottom pixel of any line. - * + * * @return the top pixel of a given line index - * + * * @since 3.2 */ public int getLinePixel(int lineIndex) { @@ -4243,9 +4274,9 @@ /** * Returns the line index for a y, relative to the client area. * The line index returned is always in the range 0..lineCount - 1. - * + * * @param y the y-coordinate pixel - * + * * @return the line index for a given y-coordinate pixel * * @since 3.2 @@ -4278,11 +4309,11 @@ } /** * Returns the tab stops of the line at the given <code>index</code>. - * + * * @param index the index of the line - * - * @return the tab stops for the line - * + * + * @return the tab stops for the line + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -4290,9 +4321,9 @@ * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_ARGUMENT when the index is invalid</li> * </ul> - * + * * @see #getTabStops() - * + * * @since 3.6 */ public int[] getLineTabStops(int index) { @@ -4310,11 +4341,11 @@ } /** * Returns the wrap indentation of the line at the given <code>index</code>. - * + * * @param index the index of the line - * + * * @return the wrap indentation - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -4322,9 +4353,9 @@ * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_ARGUMENT when the index is invalid</li> * </ul> - * + * * @see #getWrapIndent() - * + * * @since 3.6 */ public int getLineWrapIndent(int index) { @@ -4334,7 +4365,7 @@ } return isListening(ST.LineGetStyle) ? 0 : renderer.getLineWrapIndent(index, wrapIndent); } -/** +/** * Returns the left margin. * * @return the left margin. @@ -4342,7 +4373,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.5 */ public int getLeftMargin() { @@ -4350,59 +4381,59 @@ return leftMargin - alignmentMargin; } /** - * Returns the x, y location of the upper left corner of the character - * bounding box at the specified offset in the text. The point is + * Returns the x, y location of the upper left corner of the character + * bounding box at the specified offset in the text. The point is * relative to the upper left corner of the widget client area. * - * @param offset offset relative to the start of the content. + * @param offset offset relative to the start of the content. * 0 <= offset <= getCharCount() - * @return x, y location of the upper left corner of the character + * @return x, y location of the upper left corner of the character * bounding box at the specified offset in the text. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_RANGE when the offset is outside the valid range (< 0 or > getCharCount())</li> + * <li>ERROR_INVALID_RANGE when the offset is outside the valid range (< 0 or > getCharCount())</li> * </ul> */ public Point getLocationAtOffset(int offset) { checkWidget(); if (offset < 0 || offset > getCharCount()) { - SWT.error(SWT.ERROR_INVALID_RANGE); + SWT.error(SWT.ERROR_INVALID_RANGE); } return getPointAtOffset(offset); } /** * Returns the character offset of the first character of the given line. * - * @param lineIndex index of the line, 0 based relative to the first + * @param lineIndex index of the line, 0 based relative to the first * line in the content. 0 <= lineIndex < getLineCount(), except * lineIndex may always be 0 * @return offset offset of the first character of the line, relative to * the beginning of the document. The first character of the document is - * at offset 0. - * When there are not any lines, getOffsetAtLine(0) is a valid call that + * at offset 0. + * When there are not any lines, getOffsetAtLine(0) is a valid call that * answers 0. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_RANGE when the line index is outside the valid range (< 0 or >= getLineCount())</li> + * <li>ERROR_INVALID_RANGE when the line index is outside the valid range (< 0 or >= getLineCount())</li> * </ul> * @since 2.0 */ public int getOffsetAtLine(int lineIndex) { checkWidget(); - if (lineIndex < 0 || + if (lineIndex < 0 || (lineIndex > 0 && lineIndex >= content.getLineCount())) { - SWT.error(SWT.ERROR_INVALID_RANGE); + SWT.error(SWT.ERROR_INVALID_RANGE); } return content.getOffsetAtLine(lineIndex); } /** - * Returns the offset of the character at the given location relative + * Returns the offset of the character at the given location relative * to the first character in the document. * <p> * The return value reflects the character offset that the caret will @@ -4411,9 +4442,9 @@ * the returned offset will be behind the character. * </p> * - * @param point the origin of character bounding box relative to + * @param point the origin of character bounding box relative to * the origin of the widget client area. - * @return offset of the character at the given location relative + * @return offset of the character at the given location relative * to the first character in the document. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -4444,7 +4475,7 @@ int getOffsetAtPoint(int x, int y, int lineIndex, int[] alignment) { TextLayout layout = renderer.getTextLayout(lineIndex); x += horizontalScrollOffset - leftMargin; - int[] trailing = new int[1]; + int[] trailing = new int[1]; int offsetInLine = layout.getOffset(x, y, trailing); if (alignment != null) alignment[0] = OFFSET_LEADING; if (trailing[0] != 0) { @@ -4490,7 +4521,7 @@ } int lineIndex = getLineIndex(y); int lineOffset = content.getOffsetAtLine(lineIndex); - TextLayout layout = renderer.getTextLayout(lineIndex); + TextLayout layout = renderer.getTextLayout(lineIndex); x += horizontalScrollOffset - leftMargin; y -= getLinePixel(lineIndex); int offset = layout.getOffset(x, y, trailing); @@ -4505,19 +4536,19 @@ * Returns the orientation of the receiver. * * @return the orientation style - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 2.1.2 */ @Override public int getOrientation () { return super.getOrientation (); } -/** +/** * Returns the index of the last partially visible line. * * @return index of the last partially visible line. @@ -4530,7 +4561,7 @@ } return getLineIndex(clientAreaHeight - bottomMargin); } -/** +/** * Returns the index of the first partially visible line. * * @return index of the first partially visible line. @@ -4543,11 +4574,11 @@ return topIndexY <= 0 ? topIndex : topIndex - 1; } /** - * Returns the content in the specified range using the platform line + * Returns the content in the specified range using the platform line * delimiter to separate lines. * * @param writer the TextWriter to write line text into - * @return the content in the specified range using the platform line + * @return the content in the specified range using the platform line * delimiter to separate lines as written by the specified TextWriter. */ String getPlatformDelimitedText(TextWriter writer) { @@ -4556,7 +4587,7 @@ int endLine = content.getLineAtOffset(end); String endLineText = content.getLine(endLine); int endLineOffset = content.getOffsetAtLine(endLine); - + for (int i = startLine; i <= endLine; i++) { writer.writeLine(content.getLine(i), content.getOffsetAtLine(i)); if (i < endLine) { @@ -4571,8 +4602,8 @@ } /** * Returns all the ranges of text that have an associated StyleRange. - * Returns an empty array if a LineStyleListener has been set. - * Should not be called if a LineStyleListener has been set since the + * Returns an empty array if a LineStyleListener has been set. + * Should not be called if a LineStyleListener has been set since the * listener maintains the styles. * <p> * The ranges array contains start and length pairs. Each pair refers to @@ -4580,16 +4611,16 @@ * that starts at ranges[n] with length ranges[n+1] uses the style * at styles[n/2] returned by <code>getStyleRanges(int, int, boolean)</code>. * </p> - * + * * @return the ranges or an empty array if a LineStyleListener has been set. - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.2 - * + * * @see #getStyleRanges(boolean) */ public int[] getRanges() { @@ -4602,8 +4633,8 @@ } /** * Returns the ranges of text that have an associated StyleRange. - * Returns an empty array if a LineStyleListener has been set. - * Should not be called if a LineStyleListener has been set since the + * Returns an empty array if a LineStyleListener has been set. + * Should not be called if a LineStyleListener has been set since the * listener maintains the styles. * <p> * The ranges array contains start and length pairs. Each pair refers to @@ -4614,19 +4645,19 @@ * * @param start the start offset of the style ranges to return * @param length the number of style ranges to return - * + * * @return the ranges or an empty array if a LineStyleListener has been set. - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_RANGE if start or length are outside the widget content</li> - * </ul> - * + * <li>ERROR_INVALID_RANGE if start or length are outside the widget content</li> + * </ul> + * * @since 3.2 - * + * * @see #getStyleRanges(int, int, boolean) */ public int[] getRanges(int start, int length) { @@ -4642,7 +4673,7 @@ } return new int[0]; } -/** +/** * Returns the right margin. * * @return the right margin. @@ -4650,7 +4681,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.5 */ public int getRightMargin() { @@ -4661,15 +4692,15 @@ * Returns the selection. * <p> * Text selections are specified in terms of caret positions. In a text - * widget that contains N characters, there are N+1 caret positions, + * widget that contains N characters, there are N+1 caret positions, * ranging from 0..N * </p> * - * @return start and end of the selection, x is the offset of the first + * @return start and end of the selection, x is the offset of the first * selected character, y is the offset after the last selected character. - * The selection values returned are visual (i.e., x will always always be - * <= y). To determine if a selection is right-to-left (RtoL) vs. left-to-right - * (LtoR), compare the caretOffset to the start and end of the selection + * The selection values returned are visual (i.e., x will always always be + * <= y). To determine if a selection is right-to-left (RtoL) vs. left-to-right + * (LtoR), compare the caretOffset to the start and end of the selection * (e.g., caretOffset == start of selection implies that the selection is RtoL). * @see #getSelectionRange * @exception SWTException <ul> @@ -4684,12 +4715,12 @@ /** * Returns the selection. * - * @return start and length of the selection, x is the offset of the - * first selected character, relative to the first character of the - * widget content. y is the length of the selection. - * The selection values returned are visual (i.e., length will always always be - * positive). To determine if a selection is right-to-left (RtoL) vs. left-to-right - * (LtoR), compare the caretOffset to the start and end of the selection + * @return start and length of the selection, x is the offset of the + * first selected character, relative to the first character of the + * widget content. y is the length of the selection. + * The selection values returned are visual (i.e., length will always always be + * positive). To determine if a selection is right-to-left (RtoL) vs. left-to-right + * (LtoR), compare the caretOffset to the start and end of the selection * (e.g., caretOffset == start of selection implies that the selection is RtoL). * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -4708,12 +4739,12 @@ * the regular selection. * * @return the ranges array - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.5 */ public int[] getSelectionRanges() { @@ -4898,15 +4929,15 @@ * Returns the style range at the given offset. * <p> * Returns null if a LineStyleListener has been set or if a style is not set - * for the offset. - * Should not be called if a LineStyleListener has been set since the + * for the offset. + * Should not be called if a LineStyleListener has been set since the * listener maintains the styles. * </p> * - * @param offset the offset to return the style for. + * @param offset the offset to return the style for. * 0 <= offset < getCharCount() must be true. * @return a StyleRange with start == offset and length == 1, indicating - * the style at the given offset. null if a LineStyleListener has been set + * the style at the given offset. null if a LineStyleListener has been set * or if a style is not set for the given offset. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -4930,8 +4961,8 @@ /** * Returns the styles. * <p> - * Returns an empty array if a LineStyleListener has been set. - * Should not be called if a LineStyleListener has been set since the + * Returns an empty array if a LineStyleListener has been set. + * Should not be called if a LineStyleListener has been set since the * listener maintains the styles. * <p></p> * Note: Because a StyleRange includes the start and length, the @@ -4947,7 +4978,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @see #getStyleRanges(boolean) */ public StyleRange[] getStyleRanges() { @@ -4957,8 +4988,8 @@ /** * Returns the styles. * <p> - * Returns an empty array if a LineStyleListener has been set. - * Should not be called if a LineStyleListener has been set since the + * Returns an empty array if a LineStyleListener has been set. + * Should not be called if a LineStyleListener has been set since the * listener maintains the styles. * </p><p> * Note: When <code>includeRanges</code> is true, the start and length @@ -4967,18 +4998,18 @@ * false, <code>getRanges(int, int)</code> can be used to get the * associated ranges. * </p> - * + * * @param includeRanges whether the start and length field of the StyleRanges should be set. - * + * * @return the styles or an empty array if a LineStyleListener has been set. - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.2 - * + * * @see #getRanges(int, int) * @see #setStyleRanges(int[], StyleRange[]) */ @@ -4989,8 +5020,8 @@ /** * Returns the styles for the given text range. * <p> - * Returns an empty array if a LineStyleListener has been set. - * Should not be called if a LineStyleListener has been set since the + * Returns an empty array if a LineStyleListener has been set. + * Should not be called if a LineStyleListener has been set since the * listener maintains the styles. * </p><p> * Note: Because the StyleRange includes the start and length, the @@ -5002,10 +5033,10 @@ * @param start the start offset of the style ranges to return * @param length the number of style ranges to return * - * @return the styles or an empty array if a LineStyleListener has - * been set. The returned styles will reflect the given range. The first - * returned <code>StyleRange</code> will have a starting offset >= start - * and the last returned <code>StyleRange</code> will have an ending + * @return the styles or an empty array if a LineStyleListener has + * been set. The returned styles will reflect the given range. The first + * returned <code>StyleRange</code> will have a starting offset >= start + * and the last returned <code>StyleRange</code> will have an ending * offset <= start + length - 1 * * @exception SWTException <ul> @@ -5013,11 +5044,11 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_RANGE when start and/or end are outside the widget content</li> + * <li>ERROR_INVALID_RANGE when start and/or end are outside the widget content</li> * </ul> - * + * * @see #getStyleRanges(int, int, boolean) - * + * * @since 3.0 */ public StyleRange[] getStyleRanges(int start, int length) { @@ -5027,8 +5058,8 @@ /** * Returns the styles for the given text range. * <p> - * Returns an empty array if a LineStyleListener has been set. - * Should not be called if a LineStyleListener has been set since the + * Returns an empty array if a LineStyleListener has been set. + * Should not be called if a LineStyleListener has been set since the * listener maintains the styles. * </p><p> * Note: When <code>includeRanges</code> is true, the start and length @@ -5037,15 +5068,15 @@ * false, <code>getRanges(int, int)</code> can be used to get the * associated ranges. * </p> - * + * * @param start the start offset of the style ranges to return * @param length the number of style ranges to return * @param includeRanges whether the start and length field of the StyleRanges should be set. * - * @return the styles or an empty array if a LineStyleListener has - * been set. The returned styles will reflect the given range. The first - * returned <code>StyleRange</code> will have a starting offset >= start - * and the last returned <code>StyleRange</code> will have an ending + * @return the styles or an empty array if a LineStyleListener has + * been set. The returned styles will reflect the given range. The first + * returned <code>StyleRange</code> will have a starting offset >= start + * and the last returned <code>StyleRange</code> will have an ending * offset <= start + length - 1 * * @exception SWTException <ul> @@ -5053,11 +5084,11 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_RANGE when start and/or end are outside the widget content</li> + * <li>ERROR_INVALID_RANGE when start and/or end are outside the widget content</li> * </ul> - * + * * @since 3.2 - * + * * @see #getRanges(int, int) * @see #setStyleRanges(int[], StyleRange[]) */ @@ -5082,7 +5113,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @see #getTabStops() */ public int getTabs() { @@ -5098,7 +5129,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.6 */ public int[] getTabStops() { @@ -5126,7 +5157,7 @@ * Returns the widget content between the two offsets. * * @param start offset of the first character in the returned String - * @param end offset of the last character in the returned String + * @param end offset of the last character in the returned String * @return widget content starting at start and ending at end * @see #getTextRange(int,int) * @exception SWTException <ul> @@ -5134,7 +5165,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_RANGE when start and/or end are outside the widget content</li> + * <li>ERROR_INVALID_RANGE when start and/or end are outside the widget content</li> * </ul> */ public String getText(int start, int end) { @@ -5149,20 +5180,20 @@ * Returns the smallest bounding rectangle that includes the characters between two offsets. * * @param start offset of the first character included in the bounding box - * @param end offset of the last character included in the bounding box + * @param end offset of the last character included in the bounding box * @return bounding box of the text between start and end * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_RANGE when start and/or end are outside the widget content</li> + * <li>ERROR_INVALID_RANGE when start and/or end are outside the widget content</li> * </ul> * @since 3.1 */ public Rectangle getTextBounds(int start, int end) { - checkWidget(); - int contentLength = getCharCount(); + checkWidget(); + int contentLength = getCharCount(); if (start < 0 || start >= contentLength || end < 0 || end >= contentLength || start > end) { SWT.error(SWT.ERROR_INVALID_RANGE); } @@ -5173,7 +5204,7 @@ int height = 0; int left = 0x7fffffff, right = 0; for (int i = lineStart; i <= lineEnd; i++) { - int lineOffset = content.getOffsetAtLine(i); + int lineOffset = content.getOffsetAtLine(i); TextLayout layout = renderer.getTextLayout(i); int length = layout.getText().length(); if (length > 0) { @@ -5205,14 +5236,14 @@ * Returns the widget content starting at start for length characters. * * @param start offset of the first character in the returned String - * @param length number of characters to return + * @param length number of characters to return * @return widget content starting at start and extending length characters. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_RANGE when start and/or length are outside the widget content</li> + * <li>ERROR_INVALID_RANGE when start and/or length are outside the widget content</li> * </ul> */ public String getTextRange(int start, int length) { @@ -5221,12 +5252,12 @@ int end = start + length; if (start > end || start < 0 || end > contentLength) { SWT.error(SWT.ERROR_INVALID_RANGE); - } + } return content.getTextRange(start, length); } /** * Returns the maximum number of characters that the receiver is capable of holding. - * + * * @return the text limit * * @exception SWTException <ul> @@ -5241,8 +5272,8 @@ /** * Gets the top index. * <p> - * The top index is the index of the fully visible line that is currently - * at the top of the widget or the topmost partially visible line if no line is fully visible. + * The top index is the index of the fully visible line that is currently + * at the top of the widget or the topmost partially visible line if no line is fully visible. * The top index changes when the widget is scrolled. Indexing is zero based. * </p> * @@ -5256,7 +5287,7 @@ checkWidget(); return topIndex; } -/** +/** * Returns the top margin. * * @return the top margin. @@ -5264,7 +5295,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.5 */ public int getTopMargin() { @@ -5274,10 +5305,10 @@ /** * Gets the top pixel. * <p> - * The top pixel is the pixel position of the line that is - * currently at the top of the widget. The text widget can be scrolled by pixels - * by dragging the scroll thumb so that a partial line may be displayed at the top - * the widget. The top pixel changes when the widget is scrolled. The top pixel + * The top pixel is the pixel position of the line that is + * currently at the top of the widget. The text widget can be scrolled by pixels + * by dragging the scroll thumb so that a partial line may be displayed at the top + * the widget. The top pixel changes when the widget is scrolled. The top pixel * does not include the widget trimming. * </p> * @@ -5291,7 +5322,7 @@ checkWidget(); return getVerticalScrollOffset(); } -/** +/** * Returns the vertical scroll increment. * * @return vertical scroll increment. @@ -5382,11 +5413,11 @@ renderer.disposeTextLayout(layout); } } - if (ignoreListener) return newOffset; + if (ignoreListener) return newOffset; return sendWordBoundaryEvent(ST.WordNext, movement, offset, newOffset, lineText, lineOffset); } int getWordPrevious(int offset, int movement) { - return getWordPrevious(offset, movement, false); + return getWordPrevious(offset, movement, false); } int getWordPrevious(int offset, int movement, boolean ignoreListener) { int newOffset, lineOffset; @@ -5402,13 +5433,13 @@ lineText = content.getLine(lineIndex); if (offset == lineOffset) { String nextLineText = content.getLine(lineIndex - 1); - int nextLineOffset = content.getOffsetAtLine(lineIndex - 1); + int nextLineOffset = content.getOffsetAtLine(lineIndex - 1); newOffset = nextLineOffset + nextLineText.length(); } else { int layoutOffset = Math.min(offset - lineOffset, lineText.length()); TextLayout layout = renderer.getTextLayout(lineIndex); newOffset = lineOffset + layout.getPreviousOffset(layoutOffset, movement); - renderer.disposeTextLayout(layout); + renderer.disposeTextLayout(layout); } } if (ignoreListener) return newOffset; @@ -5426,23 +5457,23 @@ } /** * Returns the wrap indentation of the widget. - * + * * @return the wrap indentation - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @see #getLineWrapIndent(int) - * + * * @since 3.6 */ public int getWrapIndent() { checkWidget(); return wrapIndent; } -/** +/** * Returns the location of the given offset. * <p> * <b>NOTE:</b> Does not return correct values for true italic fonts (vs. slanted fonts). @@ -5454,7 +5485,7 @@ int lineIndex = content.getLineAtOffset(offset); String line = content.getLine(lineIndex); int lineOffset = content.getOffsetAtLine(lineIndex); - int offsetInLine = offset - lineOffset; + int offsetInLine = Math.max (0, offset - lineOffset); int lineLength = line.length(); if (lineIndex < content.getLineCount() - 1) { int endLineOffset = content.getOffsetAtLine(lineIndex + 1) - 1; @@ -5466,7 +5497,7 @@ TextLayout layout = renderer.getTextLayout(lineIndex); if (lineLength != 0 && offsetInLine <= lineLength) { if (offsetInLine == lineLength) { - offsetInLine = layout.getPreviousOffset(offsetInLine, SWT.MOVEMENT_CLUSTER); + offsetInLine = layout.getPreviousOffset(offsetInLine, SWT.MOVEMENT_CLUSTER); point = layout.getLocation(offsetInLine, true); } else { switch (caretAlignment) { @@ -5475,10 +5506,26 @@ break; case PREVIOUS_OFFSET_TRAILING: default: - if (offsetInLine == 0) { + boolean lineBegin = offsetInLine == 0; + // If word wrap is enabled, we should also consider offsets + // of wrapped line parts as line begin and do NOT go back. + // This prevents clients to jump one line higher than + // expected, see bug 488172. + // Respect caretAlignment at the caretOffset, unless there's + // a non-empty selection, see bug 488172 comment 6. + if (wordWrap && !lineBegin && (offset != caretOffset || selection.x != selection.y)) { + int[] offsets = layout.getLineOffsets(); + for (int i : offsets) { + if (i == offsetInLine) { + lineBegin = true; + break; + } + } + } + if (lineBegin) { point = layout.getLocation(offsetInLine, false); } else { - offsetInLine = layout.getPreviousOffset(offsetInLine, SWT.MOVEMENT_CLUSTER); + offsetInLine = layout.getPreviousOffset(offsetInLine, SWT.MOVEMENT_CLUSTER); point = layout.getLocation(offsetInLine, true); } break; @@ -5492,8 +5539,8 @@ point.y += getLinePixel(lineIndex); return point; } -/** - * Inserts a string. The old selection is replaced with the new text. +/** + * Inserts a string. The old selection is replaced with the new text. * * @param string the string * @see #replaceTextRange(int,int,String) @@ -5511,7 +5558,7 @@ SWT.error(SWT.ERROR_NULL_ARGUMENT); } if (blockSelection) { - insertBlockSelectionText(string, false); + insertBlockSelectionText(string, false); } else { Point sel = getSelectionRange(); replaceTextRange(sel.x, sel.y, string); @@ -5612,7 +5659,7 @@ } int end = getOffsetAtPoint(right, linePixel, trailing, true); if (end == -1) { - end = right < leftMargin ? lineOffset : lineEndOffset; + end = right < leftMargin ? lineOffset : lineEndOffset; } else { end += trailing[0]; } @@ -5623,10 +5670,10 @@ } if (start == end && !outOfLine) { switch (action) { - case ST.DELETE_PREVIOUS: + case ST.DELETE_PREVIOUS: if (start > lineOffset) start = getClusterPrevious(start, lineIndex); break; - case ST.DELETE_NEXT: + case ST.DELETE_NEXT: if (end < lineEndOffset) end = getClusterNext(end, lineIndex); break; } @@ -5655,12 +5702,15 @@ */ void installDefaultContent() { textChangeListener = new TextChangeListener() { + @Override public void textChanging(TextChangingEvent event) { handleTextChanging(event); } + @Override public void textChanged(TextChangedEvent event) { handleTextChanged(event); } + @Override public void textSet(TextChangedEvent event) { handleTextSet(event); } @@ -5668,14 +5718,15 @@ content = new DefaultContent(); content.addTextChangeListener(textChangeListener); } -/** +/** * Adds event listeners */ void installListeners() { ScrollBar verticalBar = getVerticalBar(); ScrollBar horizontalBar = getHorizontalBar(); - + listener = new Listener() { + @Override public void handleEvent(Event event) { switch (event.type) { case SWT.Dispose: handleDispose(event); break; @@ -5689,7 +5740,7 @@ case SWT.Resize: handleResize(event); break; case SWT.Traverse: handleTraverse(event); break; } - } + } }; addListener(SWT.Dispose, listener); addListener(SWT.KeyDown, listener); @@ -5702,6 +5753,7 @@ addListener(SWT.Resize, listener); addListener(SWT.Traverse, listener); ime.addListener(SWT.ImeComposition, new Listener() { + @Override public void handleEvent(Event event) { switch (event.detail) { case SWT.COMPOSITION_SELECTION: handleCompositionSelection(event); break; @@ -5712,6 +5764,7 @@ }); if (verticalBar != null) { verticalBar.addListener(SWT.Selection, new Listener() { + @Override public void handleEvent(Event event) { handleVerticalScroll(event); } @@ -5719,6 +5772,7 @@ } if (horizontalBar != null) { horizontalBar.addListener(SWT.Selection, new Listener() { + @Override public void handleEvent(Event event) { handleHorizontalScroll(event); } @@ -5752,7 +5806,7 @@ int lineX = leftMargin - horizontalScrollOffset, startLineY = getLinePixel(startLine); int[] offsets = layout.getLineOffsets(); int startIndex = layout.getLineIndex(Math.min(start, layout.getText().length())); - + /* Redraw end of line before start line if wrapped and start offset is first char */ if ((wordWrap || visualWrap) && startIndex > 0 && offsets[startIndex] == start) { Rectangle rect = layout.getLineBounds(startIndex - 1); @@ -5762,7 +5816,7 @@ rect.y += startLineY; super.redraw(rect.x, rect.y, rect.width, rect.height, false); } - + if (startLine == endLine) { int endIndex = layout.getLineIndex(Math.min(end, layout.getText().length())); if (startIndex == endIndex) { @@ -5854,7 +5908,7 @@ start = ime.getCompositionOffset(); int lineIndex = getCaretLine(); int lineOffset = content.getOffsetAtLine(lineIndex); - TextLayout layout = renderer.getTextLayout(lineIndex); + TextLayout layout = renderer.getTextLayout(lineIndex); caretWidth = layout.getBounds(start - lineOffset, start + length - 1 - lineOffset).width; renderer.disposeTextLayout(layout); alignment = OFFSET_LEADING; @@ -5863,7 +5917,7 @@ } showCaret(); } -/** +/** * Frees resources. */ void handleDispose(Event event) { @@ -5907,7 +5961,7 @@ clipboard = null; tabs = null; } -/** +/** * Scrolls the widget horizontally. */ void handleHorizontalScroll(Event event) { @@ -5941,25 +5995,25 @@ } if (action == SWT.NULL) { boolean ignore = false; - + if (IS_MAC) { - // Ignore accelerator key combinations (we do not want to + // Ignore accelerator key combinations (we do not want to // insert a character in the text in this instance). ignore = (event.stateMask & (SWT.COMMAND | SWT.CTRL)) != 0; } else { - // Ignore accelerator key combinations (we do not want to - // insert a character in the text in this instance). Don't - // ignore CTRL+ALT combinations since that is the Alt Gr - // key on some keyboards. See bug 20953. - ignore = (event.stateMask ^ SWT.ALT) == 0 || + // Ignore accelerator key combinations (we do not want to + // insert a character in the text in this instance). Don't + // ignore CTRL+ALT combinations since that is the Alt Gr + // key on some keyboards. See bug 20953. + ignore = (event.stateMask ^ SWT.ALT) == 0 || (event.stateMask ^ SWT.CTRL) == 0 || (event.stateMask ^ (SWT.ALT | SWT.SHIFT)) == 0 || (event.stateMask ^ (SWT.CTRL | SWT.SHIFT)) == 0; } // -ignore anything below SPACE except for line delimiter keys and tab. - // -ignore DEL - if (!ignore && event.character > 31 && event.character != SWT.DEL || - event.character == SWT.CR || event.character == SWT.LF || + // -ignore DEL + if (!ignore && event.character > 31 && event.character != SWT.DEL || + event.character == SWT.CR || event.character == SWT.LF || event.character == TAB) { doContent(event.character); update(); @@ -5980,7 +6034,7 @@ } newOrientation = SWT.NONE; event.stateMask &= SWT.MODIFIER_MASK; - + Event verifyEvent = new Event(); verifyEvent.character = event.character; verifyEvent.keyCode = event.keyCode; @@ -5990,7 +6044,7 @@ notifyListeners(ST.VerifyKey, verifyEvent); if (verifyEvent.doit) { if ((event.stateMask & SWT.MODIFIER_MASK) == SWT.CTRL && event.keyCode == SWT.SHIFT && isBidiCaret()) { - newOrientation = event.keyLocation == SWT.LEFT ? SWT.LEFT_TO_RIGHT : SWT.RIGHT_TO_LEFT; + newOrientation = event.keyLocation == SWT.LEFT ? SWT.LEFT_TO_RIGHT : SWT.RIGHT_TO_LEFT; } handleKey(event); } @@ -6007,7 +6061,7 @@ } } clipboardSelection = null; - + if (newOrientation != SWT.NONE) { if (newOrientation != getOrientation()) { Event e = new Event(); @@ -6032,17 +6086,17 @@ event.y = point.y + getLineHeight(caretOffset); } } -/** - * Updates the caret location and selection if mouse button 1 has been +/** + * Updates the caret location and selection if mouse button 1 has been * pressed. */ void handleMouseDown(Event event) { //force focus (object support) forceFocus(); - + //drag detect if (dragDetect && checkDragDetect(event)) return; - + //paste clipboard selection if (event.button == 2) { String text = (String)getClipboardContent(DND.SELECTION_CLIPBOARD); @@ -6057,10 +6111,10 @@ sendKeyEvent(e); } } - + //set selection if ((event.button != 1) || (IS_MAC && (event.stateMask & SWT.MOD4) != 0)) { - return; + return; } clickCount = event.count; if (clickCount == 1) { @@ -6096,8 +6150,8 @@ } } } -/** - * Updates the caret location and selection if mouse button 1 is pressed +/** + * Updates the caret location and selection if mouse button 1 is pressed * during the mouse move. */ void handleMouseMove(Event event) { @@ -6105,12 +6159,12 @@ update(); doAutoScroll(event); doMouseLocationChange(event.x, event.y, true); - } + } if (renderer.hasLinks) { doMouseLinkCursor(event.x, event.y); } } -/** +/** * Autoscrolling ends when the mouse button is released. */ void handleMouseUp(Event event) { @@ -6157,7 +6211,7 @@ gc.setAdvanced(false); } } - + // fill the margin background gc.setBackground(marginColor != null ? marginColor : background); if (topMargin > 0) { @@ -6174,7 +6228,7 @@ } } /** - * Recalculates the scroll bars. Rewraps all lines when in word + * Recalculates the scroll bars. Rewraps all lines when in word * wrap mode. * * @param event resize event @@ -6186,7 +6240,7 @@ clientAreaHeight = clientArea.height; clientAreaWidth = clientArea.width; if (!alwaysShowScroll && ignoreResize != 0) return; - + redrawMargins(oldHeight, oldWidth); if (wordWrap) { if (oldWidth != clientAreaWidth) { @@ -6225,7 +6279,7 @@ // } } /** - * Updates the caret position and selection and the scroll bars to reflect + * Updates the caret position and selection and the scroll bars to reflect * the content change. */ void handleTextChanged(TextChangedEvent event) { @@ -6237,6 +6291,15 @@ resetCache(firstLine, 0); if (!isFixedLineHeight() && topIndex > firstLine) { topIndex = firstLine; + if (topIndex < 0) { + // TODO: This logging is in place to determine why topIndex is getting set to negative values. + // It should be deleted once we fix the root cause of this issue. See bug 487254 for details. + System.err.println("StyledText: topIndex was " + topIndex + + ", lastTextChangeStart = " + lastTextChangeStart + + ", content.getClass() = " + content.getClass() + ); + topIndex = 0; + } topIndexY = 0; super.redraw(); } else { @@ -6253,10 +6316,10 @@ renderer.redrawLines = null; // update selection/caret location after styles have been changed. // otherwise any text measuring could be incorrect - // - // also, this needs to be done after all scrolling. Otherwise, + // + // also, this needs to be done after all scrolling. Otherwise, // selection redraw would be flushed during scroll which is wrong. - // in some cases new text would be drawn in scroll source area even + // in some cases new text would be drawn in scroll source area even // though the intent is to scroll it. if (!(blockSelection && blockXLocation != -1)) { updateSelection(lastTextChangeStart, lastTextChangeReplaceCharCount, lastTextChangeNewCharCount); @@ -6267,7 +6330,7 @@ if (lastTextChangeReplaceCharCount > 0) { claimRightFreeSpace(); } - + sendAccessibleTextChanged(lastTextChangeStart, lastTextChangeNewCharCount, 0); lastCharCount += lastTextChangeNewCharCount; lastCharCount -= lastTextChangeReplaceCharCount; @@ -6277,7 +6340,7 @@ * Updates the screen to reflect a pending content change. * * @param event .start the start offset of the change - * @param event .newText text that is going to be inserted or empty String + * @param event .newText text that is going to be inserted or empty String * if no text will be inserted * @param event .replaceCharCount length of text that is going to be replaced * @param event .newCharCount length of text that is going to be inserted @@ -6293,7 +6356,7 @@ lastTextChangeNewLineCount = event.newLineCount; lastTextChangeNewCharCount = event.newCharCount; lastTextChangeReplaceLineCount = event.replaceLineCount; - lastTextChangeReplaceCharCount = event.replaceCharCount; + lastTextChangeReplaceCharCount = event.replaceCharCount; int lineIndex = content.getLineAtOffset(event.start); int srcY = getLinePixel(lineIndex + event.replaceLineCount + 1); int destY = getLinePixel(lineIndex + 1) + event.newLineCount * renderer.getLineHeight(); @@ -6308,20 +6371,20 @@ } sendAccessibleTextChanged(lastTextChangeStart, 0, lastTextChangeReplaceCharCount); renderer.textChanging(event); - + // Update the caret offset if it is greater than the length of the content. // This is necessary since style range API may be called between the // handleTextChanging and handleTextChanged events and this API sets the // caretOffset. int newEndOfText = content.getCharCount() - event.replaceCharCount + event.newCharCount; - if (caretOffset > newEndOfText) setCaretOffset(newEndOfText, SWT.DEFAULT); + if (caretOffset > newEndOfText) setCaretOffset(newEndOfText, SWT.DEFAULT); } /** - * Called when the widget content is set programmatically, overwriting - * the old content. Resets the caret position, selection and scroll offsets. + * Called when the widget content is set programmatically, overwriting + * the old content. Resets the caret position, selection and scroll offsets. * Recalculates the content width and scroll bars. Redraws the widget. * - * @param event text change event. + * @param event text change event. */ void handleTextSet(TextChangedEvent event) { reset(); @@ -6332,9 +6395,9 @@ } /** * Called when a traversal key is pressed. - * Allow tab next traversal to occur when the widget is in single - * line mode or in multi line and non-editable mode . - * When in editable multi line mode we want to prevent the tab + * Allow tab next traversal to occur when the widget is in single + * line mode or in multi line and non-editable mode . + * When in editable multi line mode we want to prevent the tab * traversal and receive the tab key event instead. * * @param event the event @@ -6359,7 +6422,7 @@ break; } } -/** +/** * Scrolls the widget vertically. */ void handleVerticalScroll(Event event) { @@ -6461,7 +6524,7 @@ e.count = rect.height - rect.y + 1; } else { Point point = st.getSelection(); - e.count = point.x == point.y ? 0 : 1; + e.count = point.x == point.y ? 0 : 1; } } @Override @@ -6568,7 +6631,7 @@ int[] trailing = new int[1]; int end = st.getOffsetAtPoint(right, linePixel, trailing, true); if (end == -1) { - end = right < st.leftMargin ? lineOffset : lineEndOffset; + end = right < st.leftMargin ? lineOffset : lineEndOffset; } else { end += trailing[0]; } @@ -6640,7 +6703,7 @@ case ACC.TEXT_BOUNDARY_WORD: { int newCount = 0; if (count > 0) { - while (count-- > 0) { + while (count-- > 0) { int newEnd = st.getWordNext(end, SWT.MOVEMENT_WORD_START, true); if (newEnd == end) break; newCount++; @@ -6744,27 +6807,32 @@ acc.addAccessibleTextListener(accTextExtendedAdapter); accEditableTextListener = new AccessibleEditableTextListener() { + @Override public void setTextAttributes(AccessibleTextAttributeEvent e) { // This method must be implemented by the application e.result = ACC.OK; } + @Override public void replaceText(AccessibleEditableTextEvent e) { StyledText st = StyledText.this; st.replaceTextRange(e.start, e.end - e.start, e.string); e.result = ACC.OK; } + @Override public void pasteText(AccessibleEditableTextEvent e) { StyledText st = StyledText.this; st.setSelection(e.start); st.paste(); e.result = ACC.OK; } + @Override public void cutText(AccessibleEditableTextEvent e) { StyledText st = StyledText.this; st.setSelection(e.start, e.end); st.cut(); e.result = ACC.OK; } + @Override public void copyText(AccessibleEditableTextEvent e) { StyledText st = StyledText.this; st.setSelection(e.start, e.end); @@ -6785,7 +6853,7 @@ e.tabStops = st.getTabStops(); e.justify = st.getJustify(); e.alignment = st.getAlignment(); - e.indent = st.getIndent(); + e.indent = st.getIndent(); } @Override public void getTextAttributes(AccessibleTextAttributeEvent e) { @@ -6802,13 +6870,13 @@ int lineOffset = st.getOffsetAtLine(lineIndex); int lineCount = st.getLineCount(); offset = offset - lineOffset; - + TextLayout layout = st.renderer.getTextLayout(lineIndex); int lineLength = layout.getText().length(); if (lineLength > 0) { e.textStyle = layout.getStyle(Math.max(0, Math.min(offset, lineLength - 1))); } - + // If no override info available, use defaults. Don't supply default colors, though. if (e.textStyle == null) { e.textStyle = new TextStyle(st.getFont(), st.foreground, st.background); @@ -6821,7 +6889,7 @@ e.textStyle = textStyle; } } - + //offset at line delimiter case if (offset >= lineLength) { e.start = lineOffset + lineLength; @@ -6832,7 +6900,7 @@ } return; } - + int[] ranges = layout.getRanges(); st.renderer.disposeTextLayout(layout); int index = 0; @@ -6888,10 +6956,11 @@ acc.addAccessibleControlListener(accControlAdapter); addListener(SWT.FocusIn, new Listener() { + @Override public void handleEvent(Event event) { acc.setFocus(ACC.CHILDID_SELF); } - }); + }); } @Override @@ -6910,9 +6979,9 @@ super.dispose(); } -/* - * Return the Label immediately preceding the receiver in the z-order, - * or null if none. +/* + * Return the Label immediately preceding the receiver in the z-order, + * or null if none. */ String getAssociatedLabel () { Control[] siblings = getParent ().getChildren (); @@ -7025,7 +7094,7 @@ doPageEnd(); clearSelection(true); break; - // Selection + // Selection case ST.SELECT_LINE_UP: doSelectionLineUp(); break; @@ -7081,7 +7150,7 @@ doPageEnd(); doSelection(ST.COLUMN_NEXT); break; - // Modification + // Modification case ST.CUT: cut(); break; @@ -7114,7 +7183,7 @@ } /** * Returns true if an action should not be performed when block -* selection in active +* selection in active */ boolean invokeBlockAction(int action) { switch (action) { @@ -7174,7 +7243,7 @@ case ST.SELECT_WINDOW_END: //blocked actions return true; - // Modification + // Modification case ST.CUT: case ST.COPY: case ST.PASTE: @@ -7201,26 +7270,26 @@ } /** * Returns whether the given offset is inside a multi byte line delimiter. - * Example: + * Example: * "Line1\r\n" isLineDelimiter(5) == false but isLineDelimiter(6) == true - * + * * @return true if the given offset is inside a multi byte line delimiter. * false if the given offset is before or after a line delimiter. */ boolean isLineDelimiter(int offset) { int line = content.getLineAtOffset(offset); - int lineOffset = content.getOffsetAtLine(line); + int lineOffset = content.getOffsetAtLine(line); int offsetInLine = offset - lineOffset; - // offsetInLine will be greater than line length if the line + // offsetInLine will be greater than line length if the line // delimiter is longer than one character and the offset is set // in between parts of the line delimiter. return offsetInLine > content.getLine(line).length(); } /** - * Returns whether the widget is mirrored (right oriented/right to left - * writing order). - * - * @return isMirrored true=the widget is right oriented, false=the widget + * Returns whether the widget is mirrored (right oriented/right to left + * writing order). + * + * @return isMirrored true=the widget is right oriented, false=the widget * is left oriented */ boolean isMirrored() { @@ -7229,13 +7298,13 @@ /** * Returns <code>true</code> if any text in the widget is selected, * and <code>false</code> otherwise. - * + * * @return the text selection state * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.103 */ public boolean isTextSelected() { @@ -7249,17 +7318,17 @@ /** * Returns whether the widget can have only one line. * - * @return true if widget can have only one line, false if widget can have + * @return true if widget can have only one line, false if widget can have * multiple lines */ boolean isSingleLine() { return (getStyle() & SWT.SINGLE) != 0; } /** - * Sends the specified verify event, replace/insert text as defined by + * Sends the specified verify event, replace/insert text as defined by * the event and send a modify event. * - * @param event the text change event. + * @param event the text change event. * <ul> * <li>event.start - the replace start offset</li> * <li>event.end - the replace end offset</li> @@ -7330,10 +7399,10 @@ notifyListeners(ST.PaintObject, event); } } -/** - * Replaces the selection with the text on the <code>DND.CLIPBOARD</code> - * clipboard or, if there is no selection, inserts the text at the current - * caret offset. If the widget has the SWT.SINGLE style and the +/** + * Replaces the selection with the text on the <code>DND.CLIPBOARD</code> + * clipboard or, if there is no selection, inserts the text at the current + * caret offset. If the widget has the SWT.SINGLE style and the * clipboard text contains more than one line, only the first line without * line delimiters is inserted in the widget. * @@ -7343,7 +7412,7 @@ * </ul> */ public void paste(){ - checkWidget(); + checkWidget(); String text = (String) getClipboardContent(DND.CLIPBOARD); if (text != null && text.length() > 0) { if (blockSelection) { @@ -7369,7 +7438,7 @@ sendKeyEvent(event); } } -/** +/** * Prints the widget's text to the default printer. * * @exception SWTException <ul> @@ -7384,17 +7453,17 @@ options.printTextForeground = true; options.printTextBackground = true; options.printTextFontStyle = true; - options.printLineBackground = true; + options.printLineBackground = true; new Printing(this, printer, options).run(); printer.dispose(); } -/** +/** * Returns a runnable that will print the widget's text * to the specified printer. * <p> * The runnable may be run in a non-UI thread. * </p> - * + * * @param printer the printer to print to * * @return a <code>Runnable</code> for printing the receiver's text @@ -7408,7 +7477,7 @@ * </ul> */ public Runnable print(Printer printer) { - checkWidget(); + checkWidget(); if (printer == null) { SWT.error(SWT.ERROR_NULL_ARGUMENT); } @@ -7419,13 +7488,13 @@ options.printLineBackground = true; return print(printer, options); } -/** +/** * Returns a runnable that will print the widget's text * to the specified printer. * <p> * The runnable may be run in a non-UI thread. * </p> - * + * * @param printer the printer to print to * @param options print options to use during printing * @@ -7453,8 +7522,8 @@ * is processed, the control will be completely painted. * <p> * Recalculates the content width for all lines in the bounds. - * When a <code>LineStyleListener</code> is used a redraw call - * is the only notification to the widget that styles have changed + * When a <code>LineStyleListener</code> is used a redraw call + * is the only notification to the widget that styles have changed * and that the content width may have changed. * </p> * @@ -7476,18 +7545,18 @@ } /** * Causes the rectangular area of the receiver specified by - * the arguments to be marked as needing to be redrawn. + * the arguments to be marked as needing to be redrawn. * The next time a paint request is processed, that area of * the receiver will be painted. If the <code>all</code> flag * is <code>true</code>, any children of the receiver which * intersect with the specified area will also paint their - * intersecting areas. If the <code>all</code> flag is + * intersecting areas. If the <code>all</code> flag is * <code>false</code>, the children will not be painted. * <p> * Marks the content width of all lines in the specified rectangle * as unknown. Recalculates the content width of all visible lines. - * When a <code>LineStyleListener</code> is used a redraw call - * is the only notification to the widget that styles have changed + * When a <code>LineStyleListener</code> is used a redraw call + * is the only notification to the widget that styles have changed * and that the content width may have changed. * </p> * @@ -7532,7 +7601,7 @@ int redrawTop = getLinePixel(startLine); int redrawBottom = getLinePixel(endLine + 1); if (bottomChanged) redrawBottom = clientAreaHeight - bottomMargin; - int redrawWidth = clientAreaWidth - leftMargin - rightMargin; + int redrawWidth = clientAreaWidth - leftMargin - rightMargin; super.redraw(leftMargin, redrawTop, redrawWidth, redrawBottom - redrawTop, true); } void redrawLinesBullet (int[] redrawLines) { @@ -7559,18 +7628,18 @@ /* Redraw the old or new right/bottom margin if needed */ if (oldWidth != clientAreaWidth) { if (rightMargin > 0) { - int x = (oldWidth < clientAreaWidth ? oldWidth : clientAreaWidth) - rightMargin; + int x = (oldWidth < clientAreaWidth ? oldWidth : clientAreaWidth) - rightMargin; super.redraw(x, 0, rightMargin, oldHeight, false); } } if (oldHeight != clientAreaHeight) { if (bottomMargin > 0) { - int y = (oldHeight < clientAreaHeight ? oldHeight : clientAreaHeight) - bottomMargin; + int y = (oldHeight < clientAreaHeight ? oldHeight : clientAreaHeight) - bottomMargin; super.redraw(0, y, oldWidth, bottomMargin, false); } } } -/** +/** * Redraws the specified text range. * * @param start offset of the first character to redraw @@ -7578,20 +7647,20 @@ * @param clearBackground true if the background should be cleared as * part of the redraw operation. If true, the entire redraw range will * be cleared before anything is redrawn. If the redraw range includes - * the last character of a line (i.e., the entire line is redrawn) the + * the last character of a line (i.e., the entire line is redrawn) the * line is cleared all the way to the right border of the widget. - * The redraw operation will be faster and smoother if clearBackground - * is set to false. Whether or not the flag can be set to false depends - * on the type of change that has taken place. If font styles or - * background colors for the redraw range have changed, clearBackground - * should be set to true. If only foreground colors have changed for - * the redraw range, clearBackground can be set to false. + * The redraw operation will be faster and smoother if clearBackground + * is set to false. Whether or not the flag can be set to false depends + * on the type of change that has taken place. If font styles or + * background colors for the redraw range have changed, clearBackground + * should be set to true. If only foreground colors have changed for + * the redraw range, clearBackground can be set to false. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_RANGE when start and/or end are outside the widget content</li> + * <li>ERROR_INVALID_RANGE when start and/or end are outside the widget content</li> * </ul> */ public void redrawRange(int start, int length, boolean clearBackground) { @@ -7611,7 +7680,7 @@ * Removes the specified bidirectional segment listener. * * @param listener the listener which should no longer be notified - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -7619,13 +7688,13 @@ * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when listener is null</li> * </ul> - * + * * @since 2.0 */ public void removeBidiSegmentListener(BidiSegmentListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - removeListener(ST.LineGetSegments, listener); + removeListener(ST.LineGetSegments, listener); resetCache(0, content.getLineCount()); setCaretLocation(); super.redraw(); @@ -7634,7 +7703,7 @@ * Removes the specified caret listener. * * @param listener the listener which should no longer be notified - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -7642,7 +7711,7 @@ * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when listener is null</li> * </ul> - * + * * @since 3.5 */ public void removeCaretListener(CaretListener listener) { @@ -7666,13 +7735,13 @@ public void removeExtendedModifyListener(ExtendedModifyListener extendedModifyListener) { checkWidget(); if (extendedModifyListener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - removeListener(ST.ExtendedModify, extendedModifyListener); + removeListener(ST.ExtendedModify, extendedModifyListener); } /** * Removes the specified line background listener. * * @param listener the listener which should no longer be notified - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -7690,7 +7759,7 @@ * Removes the specified line style listener. * * @param listener the listener which should no longer be notified - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -7709,7 +7778,7 @@ * Removes the specified modify listener. * * @param modifyListener the listener which should no longer be notified - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -7727,7 +7796,7 @@ * Removes the specified listener. * * @param listener the listener which should no longer be notified - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -7768,7 +7837,7 @@ * Removes the specified verify listener. * * @param verifyListener the listener which should no longer be notified - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -7786,7 +7855,7 @@ * Removes the specified key verify listener. * * @param listener the listener which should no longer be notified - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -7803,7 +7872,7 @@ * Removes the specified word movement listener. * * @param listener the listener which should no longer be notified - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -7811,24 +7880,24 @@ * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when listener is null</li> * </ul> - * + * * @see MovementEvent * @see MovementListener * @see #addWordMovementListener - * + * * @since 3.3 */ public void removeWordMovementListener(MovementListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - removeListener(ST.WordNext, listener); + removeListener(ST.WordNext, listener); removeListener(ST.WordPrevious, listener); } -/** +/** * Replaces the styles in the given range with new styles. This method * effectively deletes the styles in the given range and then adds the - * the new styles. + * the new styles. * <p> * Note: Because a StyleRange includes the start and length, the * same instance cannot occur multiple times in the array of styles. @@ -7836,14 +7905,14 @@ * multiple StyleRanges, <code>setStyleRanges(int, int, int[], StyleRange[])</code> * can be used to share styles and reduce memory usage. * </p><p> - * Should not be called if a LineStyleListener has been set since the + * Should not be called if a LineStyleListener has been set since the * listener maintains the styles. * </p> * * @param start offset of first character where styles will be deleted * @param length length of the range to delete styles in * @param ranges StyleRange objects containing the new style information. - * The ranges should not overlap and should be within the specified start + * The ranges should not overlap and should be within the specified start * and length. The style rendering is undefined if the ranges do overlap * or are ill-defined. Must not be null. * @exception SWTException <ul> @@ -7851,12 +7920,12 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_RANGE when either start or end is outside the valid range (0 <= offset <= getCharCount())</li> + * <li>ERROR_INVALID_RANGE when either start or end is outside the valid range (0 <= offset <= getCharCount())</li> * <li>ERROR_NULL_ARGUMENT when ranges is null</li> * </ul> - * + * * @since 2.0 - * + * * @see #setStyleRanges(int, int, int[], StyleRange[]) */ public void replaceStyleRanges(int start, int length, StyleRange[] ranges) { @@ -7867,17 +7936,17 @@ } /** * Replaces the given text range with new text. - * If the widget has the SWT.SINGLE style and "text" contains more than - * one line, only the first line is rendered but the text is stored - * unchanged. A subsequent call to getText will return the same text - * that was set. Note that only a single line of text should be set when + * If the widget has the SWT.SINGLE style and "text" contains more than + * one line, only the first line is rendered but the text is stored + * unchanged. A subsequent call to getText will return the same text + * that was set. Note that only a single line of text should be set when * the SWT.SINGLE style is used. * <p> * <b>NOTE:</b> During the replace operation the current selection is * changed as follows: - * <ul> + * <ul> * <li>selection before replaced text: selection unchanged - * <li>selection after replaced text: adjust the selection so that same text + * <li>selection after replaced text: adjust the selection so that same text * remains selected * <li>selection intersects replaced text: selection is cleared and caret * is placed after inserted text @@ -7892,9 +7961,9 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_RANGE when either start or end is outside the valid range (0 <= offset <= getCharCount())</li> - * <li>ERROR_INVALID_ARGUMENT when either start or end is inside a multi byte line delimiter. - * Splitting a line delimiter for example by inserting text in between the CR and LF and deleting part of a line delimiter is not supported</li> + * <li>ERROR_INVALID_RANGE when either start or end is outside the valid range (0 <= offset <= getCharCount())</li> + * <li>ERROR_INVALID_ARGUMENT when either start or end is inside a multi byte line delimiter. + * Splitting a line delimiter for example by inserting text in between the CR and LF and deleting part of a line delimiter is not supported</li> * <li>ERROR_NULL_ARGUMENT when string is null</li> * </ul> */ @@ -7932,7 +8001,7 @@ verticalBar.setSelection(0); } if (horizontalBar != null) { - horizontalBar.setSelection(0); + horizontalBar.setSelection(0); } resetCache(0, 0); setCaretLocation(); @@ -7989,11 +8058,11 @@ * * @param pixels number of pixels to scroll, > 0 = scroll left, * < 0 scroll right - * @param adjustScrollBar + * @param adjustScrollBar * true= the scroll thumb will be moved to reflect the new scroll offset. * false = the scroll thumb will not be moved - * @return - * true=the widget was scrolled + * @return + * true=the widget was scrolled * false=the widget was not scrolled, the given offset is not valid. */ boolean scrollHorizontal(int pixels, boolean adjustScrollBar) { @@ -8031,11 +8100,11 @@ * Scrolls the widget vertically. * * @param pixel the new vertical scroll offset - * @param adjustScrollBar + * @param adjustScrollBar * true= the scroll thumb will be moved to reflect the new scroll offset. * false = the scroll thumb will not be moved - * @return - * true=the widget was scrolled + * @return + * true=the widget was scrolled * false=the widget was not scrolled */ boolean scrollVertical(int pixels, boolean adjustScrollBar) { @@ -8118,7 +8187,7 @@ accessible.textChanged(ACC.TEXT_INSERT, start, newCharCount); } } -/** +/** * Selects all the text. * * @exception SWTException <ul> @@ -8144,7 +8213,7 @@ /** * Replaces/inserts text as defined by the event. * - * @param event the text change event. + * @param event the text change event. * <ul> * <li>event.start - the replace start offset</li> * <li>event.end - the replace end offset</li> @@ -8157,19 +8226,19 @@ } } /** - * Returns a StyledTextEvent that can be used to request data such + * Returns a StyledTextEvent that can be used to request data such * as styles and background color for a line. * <p> - * The specified line may be a visual (wrapped) line if in word - * wrap mode. The returned object will always be for a logical + * The specified line may be a visual (wrapped) line if in word + * wrap mode. The returned object will always be for a logical * (unwrapped) line. * </p> * * @param lineOffset offset of the line. This may be the offset of * a visual line if the widget is in word wrap mode. - * @param line line text. This may be the text of a visual line if + * @param line line text. This may be the text of a visual line if * the widget is in word wrap mode. - * @return StyledTextEvent that can be used to request line data + * @return StyledTextEvent that can be used to request line data * for the given line. */ StyledTextEvent sendLineEvent(int eventType, int lineOffset, String line) { @@ -8287,22 +8356,22 @@ } } /** - * Sets the alignment of the widget. The argument should be one of <code>SWT.LEFT</code>, + * Sets the alignment of the widget. The argument should be one of <code>SWT.LEFT</code>, * <code>SWT.CENTER</code> or <code>SWT.RIGHT</code>. The alignment applies for all lines. * </p><p> * Note that if <code>SWT.MULTI</code> is set, then <code>SWT.WRAP</code> must also be set * in order to stabilize the right edge before setting alignment. * </p> - * + * * @param alignment the new alignment - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @see #setLineAlignment(int, int, int) - * + * * @since 3.2 */ public void setAlignment(int alignment) { @@ -8316,19 +8385,19 @@ super.redraw(); } /** - * Set the Always Show Scrollbars flag. True if the scrollbars are - * always shown even if they are not required (default value). False if the scrollbars are only + * Set the Always Show Scrollbars flag. True if the scrollbars are + * always shown even if they are not required (default value). False if the scrollbars are only * visible when some part of the content needs to be scrolled to be seen. - * The H_SCROLL and V_SCROLL style bits are also required to enable scrollbars in the + * The H_SCROLL and V_SCROLL style bits are also required to enable scrollbars in the * horizontal and vertical directions. - * + * * @param show true to show the scrollbars even when not required, false to show scrollbars only when required - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.8 */ public void setAlwaysShowScrollBars(boolean show) { @@ -8353,7 +8422,7 @@ * Sets the block selection mode. * * @param blockSelection true=enable block selection, false=disable block selection - * + * * @since 3.5 */ public void setBlockSelection(boolean blockSelection) { @@ -8364,7 +8433,7 @@ this.blockSelection = blockSelection; if (cursor == null) { Display display = getDisplay(); - int type = blockSelection ? SWT.CURSOR_CROSS : SWT.CURSOR_IBEAM; + int type = blockSelection ? SWT.CURSOR_CROSS : SWT.CURSOR_IBEAM; super.setCursor(display.getSystemCursor(type)); } if (blockSelection) { @@ -8378,11 +8447,11 @@ } } /** - * Sets the block selection bounds. The bounds is + * Sets the block selection bounds. The bounds is * relative to the upper left corner of the document. - * + * * @param rect the new bounds for the block selection - * + * * @see #setBlockSelectionBounds(int, int, int, int) * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -8391,7 +8460,7 @@ * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when point is null</li> * </ul> - * + * * @since 3.5 */ public void setBlockSelectionBounds(Rectangle rect) { @@ -8400,19 +8469,19 @@ setBlockSelectionBounds(rect.x, rect.y, rect.width, rect.height); } /** - * Sets the block selection bounds. The bounds is + * Sets the block selection bounds. The bounds is * relative to the upper left corner of the document. - * + * * @param x the new x coordinate for the block selection * @param y the new y coordinate for the block selection * @param width the new width for the block selection * @param height the new height for the block selection - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.5 */ public void setBlockSelectionBounds(int x, int y, int width, int height) { @@ -8420,7 +8489,7 @@ int verticalScrollOffset = getVerticalScrollOffset(); if (!blockSelection) { x -= horizontalScrollOffset; - y -= verticalScrollOffset; + y -= verticalScrollOffset; int start = getOffsetAtPoint(x, y, null); int end = getOffsetAtPoint(x+width-1, y+height-1, null); setSelection(start, end - start, false, false); @@ -8436,7 +8505,7 @@ int locationX = Math.max(minX, Math.min(maxX, x + width)) - horizontalScrollOffset; int locationY = Math.max(minY, Math.min(maxY, y + height - 1)) - verticalScrollOffset; if (isFixedLineHeight() && renderer.fixedPitch) { - int avg = renderer.averageCharWidth; + int avg = renderer.averageCharWidth; anchorX = ((anchorX - leftMargin + horizontalScrollOffset) / avg * avg) + leftMargin - horizontalScrollOffset; locationX = ((locationX + avg / 2 - leftMargin + horizontalScrollOffset) / avg * avg) + leftMargin - horizontalScrollOffset; } @@ -8486,7 +8555,7 @@ } /** * Sets the receiver's caret. Set the caret's height and location. - * + * * </p> * @param caret the new caret for the receiver * @@ -8514,7 +8583,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @deprecated use BidiSegmentListener instead. */ @Deprecated @@ -8522,15 +8591,15 @@ checkWidget(); bidiColoring = mode; } -/** +/** * Sets the bottom margin. - * + * * @param bottomMargin the bottom margin. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.5 */ public void setBottomMargin (int bottomMargin) { @@ -8602,7 +8671,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT when the offset is inside a multi byte line + * <li>ERROR_INVALID_ARGUMENT when the offset is inside a multi byte line * delimiter (and thus neither clearly in front of or after the line delimiter) * </ul> */ @@ -8616,7 +8685,7 @@ offset = length; } else { if (isLineDelimiter(offset)) { - // offset is inside a multi byte line delimiter. This is an + // offset is inside a multi byte line delimiter. This is an // illegal operation and an exception is thrown. Fixes 1GDKK3R SWT.error(SWT.ERROR_INVALID_ARGUMENT); } @@ -8651,7 +8720,7 @@ * * @param start start index of the text * @param length length of text to place in clipboard - * + * * @exception SWTError, see Clipboard.setContents * @see org.eclipse.swt.dnd.Clipboard#setContents */ @@ -8687,7 +8756,7 @@ * </ul> */ public void setContent(StyledTextContent newContent) { - checkWidget(); + checkWidget(); if (newContent == null) { SWT.error(SWT.ERROR_NULL_ARGUMENT); } @@ -8700,7 +8769,7 @@ } /** * Sets the receiver's cursor to the cursor specified by the - * argument. Overridden to handle the null case since the + * argument. Overridden to handle the null case since the * StyledText widget uses an ibeam as its default cursor. * * @see Control#setCursor(Cursor) @@ -8712,13 +8781,13 @@ this.cursor = cursor; if (cursor == null) { Display display = getDisplay(); - int type = blockSelection ? SWT.CURSOR_CROSS : SWT.CURSOR_IBEAM; + int type = blockSelection ? SWT.CURSOR_CROSS : SWT.CURSOR_IBEAM; super.setCursor(display.getSystemCursor(type)); } else { super.setCursor(cursor); } } -/** +/** * Sets whether the widget implements double click mouse behavior. * </p> * @@ -8742,7 +8811,7 @@ * Sets whether the widget content can be edited. * </p> * - * @param editable if true content can be edited, if false content can not be + * @param editable if true content can be edited, if false content can not be * edited * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -8770,7 +8839,7 @@ public void setFont(Font font) { checkWidget(); int oldLineHeight = renderer.getLineHeight(); - super.setFont(font); + super.setFont(font); renderer.setFont(getFont(), tabLength); // keep the same top line visible. fixes 5815 if (isFixedLineHeight()) { @@ -8781,7 +8850,7 @@ } } resetCache(0, content.getLineCount()); - claimBottomFreeSpace(); + claimBottomFreeSpace(); calculateScrollBars(); if (isBidiCaret()) createCaretBitmaps(); caretDirection = SWT.NULL; @@ -8797,16 +8866,16 @@ setCaretLocation(); super.redraw(); } -/** +/** * Sets the horizontal scroll offset relative to the start of the line. * Do nothing if there is no text set. * <p> - * <b>NOTE:</b> The horizontal index is reset to 0 when new text is set in the + * <b>NOTE:</b> The horizontal index is reset to 0 when new text is set in the * widget. * </p> * - * @param offset horizontal scroll offset relative to the start - * of the line, measured in character increments starting at 0, if + * @param offset horizontal scroll offset relative to the start + * of the line, measured in character increments starting at 0, if * equal to 0 the content is not scrolled, if > 0 = the content is scrolled. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -8817,14 +8886,14 @@ checkWidget(); if (getCharCount() == 0) { return; - } + } if (offset < 0) { offset = 0; } offset *= getHorizontalIncrement(); - // allow any value if client area width is unknown or 0. + // allow any value if client area width is unknown or 0. // offset will be checked in resize handler. - // don't use isVisible since width is known even if widget + // don't use isVisible since width is known even if widget // is temporarily invisible if (clientAreaWidth > 0) { int width = renderer.getWidth(); @@ -8837,15 +8906,15 @@ } scrollHorizontal(offset - horizontalScrollOffset, true); } -/** +/** * Sets the horizontal pixel offset relative to the start of the line. * Do nothing if there is no text set. * <p> - * <b>NOTE:</b> The horizontal pixel offset is reset to 0 when new text + * <b>NOTE:</b> The horizontal pixel offset is reset to 0 when new text * is set in the widget. * </p> * - * @param pixel horizontal pixel offset relative to the start + * @param pixel horizontal pixel offset relative to the start * of the line. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -8857,13 +8926,13 @@ checkWidget(); if (getCharCount() == 0) { return; - } + } if (pixel < 0) { pixel = 0; } - // allow any value if client area width is unknown or 0. + // allow any value if client area width is unknown or 0. // offset will be checked in resize handler. - // don't use isVisible since width is known even if widget + // don't use isVisible since width is known even if widget // is temporarily invisible if (clientAreaWidth > 0) { int width = renderer.getWidth(); @@ -8879,19 +8948,19 @@ /** * Sets the line indentation of the widget. * <p> - * It is the amount of blank space, in pixels, at the beginning of each line. - * When a line wraps in several lines only the first one is indented. + * It is the amount of blank space, in pixels, at the beginning of each line. + * When a line wraps in several lines only the first one is indented. * </p> - * + * * @param indent the new indent - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @see #setLineIndent(int, int, int) - * + * * @since 3.2 */ public void setIndent(int indent) { @@ -8900,20 +8969,20 @@ this.indent = indent; resetCache(0, content.getLineCount()); setCaretLocation(); - super.redraw(); + super.redraw(); } /** - * Sets whether the widget should justify lines. - * + * Sets whether the widget should justify lines. + * * @param justify whether lines should be justified - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @see #setLineJustify(int, int, boolean) - * + * * @since 3.2 */ public void setJustify(boolean justify) { @@ -8922,21 +8991,21 @@ this.justify = justify; resetCache(0, content.getLineCount()); setCaretLocation(); - super.redraw(); + super.redraw(); } -/** +/** * Maps a key to an action. * <p> - * One action can be associated with N keys. However, each key can only + * One action can be associated with N keys. However, each key can only * have one action (key:action is N:1 relation). * </p> * - * @param key a key code defined in SWT.java or a character. + * @param key a key code defined in SWT.java or a character. * Optionally ORd with a state mask. Preferred state masks are one or more of - * SWT.MOD1, SWT.MOD2, SWT.MOD3, since these masks account for modifier platform + * SWT.MOD1, SWT.MOD2, SWT.MOD3, since these masks account for modifier platform * differences. However, there may be cases where using the specific state masks * (i.e., SWT.CTRL, SWT.SHIFT, SWT.ALT, SWT.COMMAND) makes sense. - * @param action one of the predefined actions defined in ST.java. + * @param action one of the predefined actions defined in ST.java. * Use SWT.NULL to remove a key binding. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -8953,40 +9022,40 @@ * character range and filter out incorrect int to char typecasting. For * Example: SWT.KEYPAD_CR int gets wrongly type-cast to char letter 'p' */ - if (Character.isDefined(keyInt) && Compatibility.isLetter(keyChar)) { + if (Character.isDefined(keyInt) && Character.isLetter(keyChar)) { // make the keybinding case insensitive by adding it // in its upper and lower case form char ch = Character.toUpperCase(keyChar); int newKey = ch | modifierValue; if (action == SWT.NULL) { - keyActionMap.remove(new Integer(newKey)); + keyActionMap.remove(newKey); } else { - keyActionMap.put(new Integer(newKey), new Integer(action)); + keyActionMap.put(newKey, action); } ch = Character.toLowerCase(keyChar); newKey = ch | modifierValue; if (action == SWT.NULL) { - keyActionMap.remove(new Integer(newKey)); + keyActionMap.remove(newKey); } else { - keyActionMap.put(new Integer(newKey), new Integer(action)); + keyActionMap.put(newKey, action); } } else { if (action == SWT.NULL) { - keyActionMap.remove(new Integer(key)); + keyActionMap.remove(key); } else { - keyActionMap.put(new Integer(key), new Integer(action)); + keyActionMap.put(key, action); } - } + } } -/** +/** * Sets the left margin. - * + * * @param leftMargin the left margin. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.5 */ public void setLeftMargin (int leftMargin) { @@ -8994,31 +9063,31 @@ setMargins(leftMargin, topMargin, rightMargin, bottomMargin); } /** - * Sets the alignment of the specified lines. The argument should be one of <code>SWT.LEFT</code>, + * Sets the alignment of the specified lines. The argument should be one of <code>SWT.LEFT</code>, * <code>SWT.CENTER</code> or <code>SWT.RIGHT</code>. * <p><p> * Note that if <code>SWT.MULTI</code> is set, then <code>SWT.WRAP</code> must also be set * in order to stabilize the right edge before setting alignment. * </p> - * Should not be called if a LineStyleListener has been set since the listener + * Should not be called if a LineStyleListener has been set since the listener * maintains the line attributes. * </p><p> - * All line attributes are maintained relative to the line text, not the + * All line attributes are maintained relative to the line text, not the * line index that is specified in this method call. - * During text changes, when entire lines are inserted or removed, the line - * attributes that are associated with the lines after the change - * will "move" with their respective text. An entire line is defined as - * extending from the first character on a line to the last and including the - * line delimiter. + * During text changes, when entire lines are inserted or removed, the line + * attributes that are associated with the lines after the change + * will "move" with their respective text. An entire line is defined as + * extending from the first character on a line to the last and including the + * line delimiter. * </p><p> - * When two lines are joined by deleting a line delimiter, the top line - * attributes take precedence and the attributes of the bottom line are deleted. - * For all other text changes line attributes will remain unchanged. - * + * When two lines are joined by deleting a line delimiter, the top line + * attributes take precedence and the attributes of the bottom line are deleted. + * For all other text changes line attributes will remain unchanged. + * * @param startLine first line the alignment is applied to, 0 based * @param lineCount number of lines the alignment applies to. * @param alignment line alignment - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -9045,30 +9114,30 @@ } setAlignment(); } -/** +/** * Sets the background color of the specified lines. * <p> * The background color is drawn for the width of the widget. All * line background colors are discarded when setText is called. - * The text background color if defined in a StyleRange overlays the - * line background color. + * The text background color if defined in a StyleRange overlays the + * line background color. * </p><p> - * Should not be called if a LineBackgroundListener has been set since the + * Should not be called if a LineBackgroundListener has been set since the * listener maintains the line backgrounds. * </p><p> - * All line attributes are maintained relative to the line text, not the + * All line attributes are maintained relative to the line text, not the * line index that is specified in this method call. - * During text changes, when entire lines are inserted or removed, the line - * attributes that are associated with the lines after the change - * will "move" with their respective text. An entire line is defined as - * extending from the first character on a line to the last and including the - * line delimiter. + * During text changes, when entire lines are inserted or removed, the line + * attributes that are associated with the lines after the change + * will "move" with their respective text. An entire line is defined as + * extending from the first character on a line to the last and including the + * line delimiter. * </p><p> - * When two lines are joined by deleting a line delimiter, the top line - * attributes take precedence and the attributes of the bottom line are deleted. - * For all other text changes line attributes will remain unchanged. + * When two lines are joined by deleting a line delimiter, the top line + * attributes take precedence and the attributes of the bottom line are deleted. + * For all other text changes line attributes will remain unchanged. * </p> - * + * * @param startLine first line the color is applied to, 0 based * @param lineCount number of lines the color applies to. * @param background line background color @@ -9081,7 +9150,7 @@ * </ul> */ public void setLineBackground(int startLine, int lineCount, Color background) { - checkWidget(); + checkWidget(); if (isListening(ST.LineGetBackground)) return; if (startLine < 0 || startLine + lineCount > content.getLineCount()) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); @@ -9096,26 +9165,26 @@ /** * Sets the bullet of the specified lines. * <p> - * Should not be called if a LineStyleListener has been set since the listener + * Should not be called if a LineStyleListener has been set since the listener * maintains the line attributes. * </p><p> - * All line attributes are maintained relative to the line text, not the + * All line attributes are maintained relative to the line text, not the * line index that is specified in this method call. - * During text changes, when entire lines are inserted or removed, the line - * attributes that are associated with the lines after the change - * will "move" with their respective text. An entire line is defined as - * extending from the first character on a line to the last and including the - * line delimiter. + * During text changes, when entire lines are inserted or removed, the line + * attributes that are associated with the lines after the change + * will "move" with their respective text. An entire line is defined as + * extending from the first character on a line to the last and including the + * line delimiter. * </p><p> - * When two lines are joined by deleting a line delimiter, the top line - * attributes take precedence and the attributes of the bottom line are deleted. + * When two lines are joined by deleting a line delimiter, the top line + * attributes take precedence and the attributes of the bottom line are deleted. * For all other text changes line attributes will remain unchanged. * </p> * * @param startLine first line the bullet is applied to, 0 based * @param lineCount number of lines the bullet applies to. * @param bullet line bullet - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -9127,7 +9196,7 @@ */ public void setLineBullet(int startLine, int lineCount, Bullet bullet) { checkWidget(); - if (isListening(ST.LineGetStyle)) return; + if (isListening(ST.LineGetStyle)) return; if (startLine < 0 || startLine + lineCount > content.getLineCount()) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); } @@ -9149,26 +9218,26 @@ /** * Sets the indent of the specified lines. * <p> - * Should not be called if a LineStyleListener has been set since the listener + * Should not be called if a LineStyleListener has been set since the listener * maintains the line attributes. * </p><p> - * All line attributes are maintained relative to the line text, not the + * All line attributes are maintained relative to the line text, not the * line index that is specified in this method call. - * During text changes, when entire lines are inserted or removed, the line - * attributes that are associated with the lines after the change - * will "move" with their respective text. An entire line is defined as - * extending from the first character on a line to the last and including the - * line delimiter. + * During text changes, when entire lines are inserted or removed, the line + * attributes that are associated with the lines after the change + * will "move" with their respective text. An entire line is defined as + * extending from the first character on a line to the last and including the + * line delimiter. * </p><p> - * When two lines are joined by deleting a line delimiter, the top line - * attributes take precedence and the attributes of the bottom line are deleted. + * When two lines are joined by deleting a line delimiter, the top line + * attributes take precedence and the attributes of the bottom line are deleted. * For all other text changes line attributes will remain unchanged. * </p> * * @param startLine first line the indent is applied to, 0 based * @param lineCount number of lines the indent applies to. * @param indent line indent - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -9198,26 +9267,26 @@ /** * Sets the justify of the specified lines. * <p> - * Should not be called if a LineStyleListener has been set since the listener + * Should not be called if a LineStyleListener has been set since the listener * maintains the line attributes. * </p><p> - * All line attributes are maintained relative to the line text, not the + * All line attributes are maintained relative to the line text, not the * line index that is specified in this method call. - * During text changes, when entire lines are inserted or removed, the line - * attributes that are associated with the lines after the change - * will "move" with their respective text. An entire line is defined as - * extending from the first character on a line to the last and including the - * line delimiter. + * During text changes, when entire lines are inserted or removed, the line + * attributes that are associated with the lines after the change + * will "move" with their respective text. An entire line is defined as + * extending from the first character on a line to the last and including the + * line delimiter. * </p><p> - * When two lines are joined by deleting a line delimiter, the top line - * attributes take precedence and the attributes of the bottom line are deleted. + * When two lines are joined by deleting a line delimiter, the top line + * attributes take precedence and the attributes of the bottom line are deleted. * For all other text changes line attributes will remain unchanged. * </p> - * + * * @param startLine first line the justify is applied to, 0 based * @param lineCount number of lines the justify applies to. * @param justify true if lines should be justified - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -9245,7 +9314,7 @@ } /** * Sets the line spacing of the widget. The line spacing applies for all lines. - * + * * @param lineSpacing the line spacing * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -9256,7 +9325,7 @@ public void setLineSpacing(int lineSpacing) { checkWidget(); if (this.lineSpacing == lineSpacing || lineSpacing < 0) return; - this.lineSpacing = lineSpacing; + this.lineSpacing = lineSpacing; setVariableLineHeight(); resetCache(0, content.getLineCount()); setCaretLocation(); @@ -9265,26 +9334,26 @@ /** * Sets the tab stops of the specified lines. * <p> - * Should not be called if a <code>LineStyleListener</code> has been set since the listener + * Should not be called if a <code>LineStyleListener</code> has been set since the listener * maintains the line attributes. * </p><p> - * All line attributes are maintained relative to the line text, not the + * All line attributes are maintained relative to the line text, not the * line index that is specified in this method call. - * During text changes, when entire lines are inserted or removed, the line - * attributes that are associated with the lines after the change - * will "move" with their respective text. An entire line is defined as - * extending from the first character on a line to the last and including the - * line delimiter. + * During text changes, when entire lines are inserted or removed, the line + * attributes that are associated with the lines after the change + * will "move" with their respective text. An entire line is defined as + * extending from the first character on a line to the last and including the + * line delimiter. * </p><p> - * When two lines are joined by deleting a line delimiter, the top line - * attributes take precedence and the attributes of the bottom line are deleted. + * When two lines are joined by deleting a line delimiter, the top line + * attributes take precedence and the attributes of the bottom line are deleted. * For all other text changes line attributes will remain unchanged. * </p> - * + * * @param startLine first line the justify is applied to, 0 based * @param lineCount number of lines the justify applies to. * @param tabStops tab stops - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -9322,26 +9391,26 @@ /** * Sets the wrap indent of the specified lines. * <p> - * Should not be called if a <code>LineStyleListener</code> has been set since the listener + * Should not be called if a <code>LineStyleListener</code> has been set since the listener * maintains the line attributes. * </p><p> - * All line attributes are maintained relative to the line text, not the + * All line attributes are maintained relative to the line text, not the * line index that is specified in this method call. - * During text changes, when entire lines are inserted or removed, the line - * attributes that are associated with the lines after the change - * will "move" with their respective text. An entire line is defined as - * extending from the first character on a line to the last and including the - * line delimiter. + * During text changes, when entire lines are inserted or removed, the line + * attributes that are associated with the lines after the change + * will "move" with their respective text. An entire line is defined as + * extending from the first character on a line to the last and including the + * line delimiter. * </p><p> - * When two lines are joined by deleting a line delimiter, the top line - * attributes take precedence and the attributes of the bottom line are deleted. + * When two lines are joined by deleting a line delimiter, the top line + * attributes take precedence and the attributes of the bottom line are deleted. * For all other text changes line attributes will remain unchanged. * </p> * * @param startLine first line the wrap indent is applied to, 0 based * @param lineCount number of lines the wrap indent applies to. * @param wrapIndent line wrap indent - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -9369,18 +9438,18 @@ } } -/** +/** * Sets the color of the margins. - * + * * @param color the new color (or null) * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> + * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.5 */ public void setMarginColor(Color color) { @@ -9389,9 +9458,9 @@ marginColor = color; super.redraw(); } -/** +/** * Sets the margins. - * + * * @param leftMargin the left margin. * @param topMargin the top margin. * @param rightMargin the right margin. @@ -9400,7 +9469,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.5 */ public void setMargins (int leftMargin, int topMargin, int rightMargin, int bottomMargin) { @@ -9432,12 +9501,12 @@ * of the constants <code>SWT.LEFT_TO_RIGHT</code> or <code>SWT.RIGHT_TO_LEFT</code>. * * @param orientation new orientation style - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 2.1.2 */ @Override @@ -9449,15 +9518,15 @@ resetBidiData(); } } -/** +/** * Sets the right margin. - * + * * @param rightMargin the right margin. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.5 */ public void setRightMargin (int rightMargin) { @@ -9476,10 +9545,10 @@ } } /** - * Adjusts the maximum and the page size of the scroll bars to + * Adjusts the maximum and the page size of the scroll bars to * reflect content width/length changes. - * - * @param vertical indicates if the vertical scrollbar also needs to be set + * + * @param vertical indicates if the vertical scrollbar also needs to be set */ void setScrollBars(boolean vertical) { ignoreResize++; @@ -9509,7 +9578,7 @@ } ignoreResize--; } -/** +/** * Sets the selection to the given position and scrolls it into view. Equivalent to setSelection(start,start). * * @param start new caret position @@ -9519,19 +9588,19 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT when either the start or the end of the selection range is inside a + * <li>ERROR_INVALID_ARGUMENT when either the start or the end of the selection range is inside a * multi byte line delimiter (and thus neither clearly in front of or after the line delimiter) - * </ul> + * </ul> */ public void setSelection(int start) { - // checkWidget test done in setSelectionRange + // checkWidget test done in setSelectionRange setSelection(start, start); } -/** +/** * Sets the selection and scrolls it into view. * <p> * Indexing is zero based. Text selections are specified in terms of - * caret positions. In a text widget that contains N characters, there are + * caret positions. In a text widget that contains N characters, there are * N+1 caret positions, ranging from 0..N * </p> * @@ -9544,13 +9613,13 @@ * </ul> * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when point is null</li> - * <li>ERROR_INVALID_ARGUMENT when either the start or the end of the selection range is inside a + * <li>ERROR_INVALID_ARGUMENT when either the start or the end of the selection range is inside a * multi byte line delimiter (and thus neither clearly in front of or after the line delimiter) - * </ul> + * </ul> */ public void setSelection(Point point) { checkWidget(); - if (point == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + if (point == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); setSelection(point.x, point.y); } /** @@ -9561,7 +9630,7 @@ * @param color the new color (or null) * * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> + * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -9582,7 +9651,7 @@ /** * Sets the receiver's selection foreground color to the color specified * by the argument, or to the default system color for the control - * if the argument is null. + * if the argument is null. * <p> * Note that this is a <em>HINT</em>. Some platforms do not allow the application * to change the selection foreground color. @@ -9590,7 +9659,7 @@ * @param color the new color (or null) * * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> + * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -9608,15 +9677,15 @@ setCaretLocation(); super.redraw(); } -/** +/** * Sets the selection and scrolls it into view. * <p> * Indexing is zero based. Text selections are specified in terms of - * caret positions. In a text widget that contains N characters, there are + * caret positions. In a text widget that contains N characters, there are * N+1 caret positions, ranging from 0..N * </p> * - * @param start selection start offset. The caret will be placed at the + * @param start selection start offset. The caret will be placed at the * selection start when start > end. * @param end selection end offset * @see #setSelectionRange(int,int) @@ -9625,7 +9694,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT when either the start or the end of the selection range is inside a + * <li>ERROR_INVALID_ARGUMENT when either the start or the end of the selection range is inside a * multi byte line delimiter (and thus neither clearly in front of or after the line delimiter) * </ul> */ @@ -9633,18 +9702,18 @@ setSelectionRange(start, end - start); showSelection(); } -/** +/** * Sets the selection. * <p> - * The new selection may not be visible. Call showSelection to scroll + * The new selection may not be visible. Call showSelection to scroll * the selection into view. * </p> * * @param start offset of the first selected character, start >= 0 must be true. - * @param length number of characters to select, 0 <= start + length - * <= getCharCount() must be true. + * @param length number of characters to select, 0 <= start + length + * <= getCharCount() must be true. * A negative length places the caret at the selection start. - * @param sendEvent a Selection event is sent when set to true and when + * @param sendEvent a Selection event is sent when set to true and when * the selection is reset. */ void setSelection(int start, int length, boolean sendEvent, boolean doBlock) { @@ -9654,10 +9723,10 @@ end = start; start = temp; } - // is the selection range different or is the selection direction + // is the selection range different or is the selection direction // different? - if (selection.x != start || selection.y != end || - (length > 0 && selectionAnchor != selection.x) || + if (selection.x != start || selection.y != end || + (length > 0 && selectionAnchor != selection.x) || (length < 0 && selectionAnchor != selection.y)) { if (blockSelection && doBlock) { if (length < 0) { @@ -9666,6 +9735,8 @@ setBlockSelectionOffset(start, end, sendEvent); } } else { + int oldStart = selection.x; + int oldLength = selection.y - selection.x; int charCount = content.getCharCount(); // called internally to remove selection after text is removed // therefore make sure redraw range is valid. @@ -9685,14 +9756,14 @@ if (redrawY - redrawX > 0) { internalRedrawRange(redrawX, redrawY - redrawX); } - if (sendEvent) { + if (sendEvent && (oldLength != end - start || (oldLength != 0 && oldStart != start))) { sendSelectionEvent(); } sendAccessibleTextCaretMoved(); } } } -/** +/** * Sets the selection. * <p> * The new selection may not be visible. Call showSelection to scroll the selection @@ -9701,13 +9772,13 @@ * * @param start offset of the first selected character * @param length number of characters to select - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT when either the start or the end of the selection range is inside a + * <li>ERROR_INVALID_ARGUMENT when either the start or the end of the selection range is inside a * multi byte line delimiter (and thus neither clearly in front of or after the line delimiter) * </ul> */ @@ -9722,23 +9793,23 @@ if (end > contentLength) length = contentLength - start; } if (isLineDelimiter(start) || isLineDelimiter(start + length)) { - // the start offset or end offset of the selection range is inside a - // multi byte line delimiter. This is an illegal operation and an exception + // the start offset or end offset of the selection range is inside a + // multi byte line delimiter. This is an illegal operation and an exception // is thrown. Fixes 1GDKK3R SWT.error(SWT.ERROR_INVALID_ARGUMENT); } setSelection(start, length, false, true); setCaretLocation(); } -/** +/** * Adds the specified style. * <p> * The new style overwrites existing styles for the specified range. - * Existing style ranges are adjusted if they partially overlap with - * the new style. To clear an individual style, call setStyleRange - * with a StyleRange that has null attributes. + * Existing style ranges are adjusted if they partially overlap with + * the new style. To clear an individual style, call setStyleRange + * with a StyleRange that has null attributes. * </p><p> - * Should not be called if a LineStyleListener has been set since the + * Should not be called if a LineStyleListener has been set since the * listener maintains the styles. * </p> * @@ -9750,7 +9821,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_RANGE when the style range is outside the valid range (> getCharCount())</li> + * <li>ERROR_INVALID_RANGE when the style range is outside the valid range (> getCharCount())</li> * </ul> */ public void setStyleRange(StyleRange range) { @@ -9766,8 +9837,8 @@ setStyleRanges(0, 0, null, null, true); } } -/** - * Clears the styles in the range specified by <code>start</code> and +/** + * Clears the styles in the range specified by <code>start</code> and * <code>length</code> and adds the new styles. * <p> * The ranges array contains start and length pairs. Each pair refers to @@ -9779,7 +9850,7 @@ * Note: It is expected that the same instance of a StyleRange will occur * multiple times within the styles array, reducing memory usage. * </p><p> - * Should not be called if a LineStyleListener has been set since the + * Should not be called if a LineStyleListener has been set since the * listener maintains the styles. * </p> * @@ -9787,19 +9858,19 @@ * @param length length of the range to delete styles in * @param ranges the array of ranges. The ranges must not overlap and must be in order. * @param styles the array of StyleRanges. The range fields within the StyleRange are unused. - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when an element in the styles array is null</li> - * <li>ERROR_INVALID_RANGE when the number of ranges and style do not match (ranges.length * 2 == styles.length)</li> - * <li>ERROR_INVALID_RANGE when a range is outside the valid range (> getCharCount() or less than zero)</li> - * <li>ERROR_INVALID_RANGE when a range overlaps</li> + * <li>ERROR_INVALID_RANGE when the number of ranges and style do not match (ranges.length * 2 == styles.length)</li> + * <li>ERROR_INVALID_RANGE when a range is outside the valid range (> getCharCount() or less than zero)</li> + * <li>ERROR_INVALID_RANGE when a range overlaps</li> * </ul> - * - * @since 3.2 + * + * @since 3.2 */ public void setStyleRanges(int start, int length, int[] ranges, StyleRange[] styles) { checkWidget(); @@ -9810,7 +9881,7 @@ setStyleRanges(start, length, ranges, styles, false); } } -/** +/** * Sets styles to be used for rendering the widget content. * <p> * All styles in the widget will be replaced with the given set of ranges and styles. @@ -9823,25 +9894,25 @@ * Note: It is expected that the same instance of a StyleRange will occur * multiple times within the styles array, reducing memory usage. * </p><p> - * Should not be called if a LineStyleListener has been set since the + * Should not be called if a LineStyleListener has been set since the * listener maintains the styles. * </p> * * @param ranges the array of ranges. The ranges must not overlap and must be in order. * @param styles the array of StyleRanges. The range fields within the StyleRange are unused. - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when an element in the styles array is null</li> - * <li>ERROR_INVALID_RANGE when the number of ranges and style do not match (ranges.length * 2 == styles.length)</li> - * <li>ERROR_INVALID_RANGE when a range is outside the valid range (> getCharCount() or less than zero)</li> - * <li>ERROR_INVALID_RANGE when a range overlaps</li> + * <li>ERROR_INVALID_RANGE when the number of ranges and style do not match (ranges.length * 2 == styles.length)</li> + * <li>ERROR_INVALID_RANGE when a range is outside the valid range (> getCharCount() or less than zero)</li> + * <li>ERROR_INVALID_RANGE when a range overlaps</li> * </ul> - * - * @since 3.2 + * + * @since 3.2 */ public void setStyleRanges(int[] ranges, StyleRange[] styles) { checkWidget(); @@ -9866,7 +9937,7 @@ if (ranges.length != styles.length << 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT); } int lastOffset = 0; - boolean variableHeight = false; + boolean variableHeight = false; for (int i = 0; i < styles.length; i ++) { if (styles[i] == null) SWT.error(SWT.ERROR_INVALID_ARGUMENT); int rangeStart, rangeLength; @@ -9877,7 +9948,7 @@ rangeStart = styles[i].start; rangeLength = styles[i].length; } - if (rangeLength < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + if (rangeLength < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT); if (!(0 <= rangeStart && rangeStart + rangeLength <= charCount)) SWT.error(SWT.ERROR_INVALID_ARGUMENT); if (lastOffset > rangeStart) SWT.error(SWT.ERROR_INVALID_ARGUMENT); variableHeight |= styles[i].isVariableHeight(); @@ -9933,7 +10004,7 @@ if (!isFixedLineHeight() && bottom != expectedBottom) { bottom = clientAreaHeight; } - super.redraw(0, top, clientAreaWidth, bottom - top, false); + super.redraw(0, top, clientAreaWidth, bottom - top, false); } } int oldColumnX = columnX; @@ -9941,8 +10012,8 @@ columnX = oldColumnX; doMouseLinkCursor(); } -/** - * Sets styles to be used for rendering the widget content. All styles +/** + * Sets styles to be used for rendering the widget content. All styles * in the widget will be replaced with the given set of styles. * <p> * Note: Because a StyleRange includes the start and length, the @@ -9951,12 +10022,12 @@ * multiple StyleRanges, <code>setStyleRanges(int[], StyleRange[])</code> * can be used to share styles and reduce memory usage. * </p><p> - * Should not be called if a LineStyleListener has been set since the + * Should not be called if a LineStyleListener has been set since the * listener maintains the styles. * </p> * * @param ranges StyleRange objects containing the style information. - * The ranges should not overlap. The style rendering is undefined if + * The ranges should not overlap. The style rendering is undefined if * the ranges do overlap. Must not be null. The styles need to be in order. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -9964,9 +10035,9 @@ * </ul> * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when the list of ranges is null</li> - * <li>ERROR_INVALID_RANGE when the last of the style ranges is outside the valid range (> getCharCount())</li> + * <li>ERROR_INVALID_RANGE when the last of the style ranges is outside the valid range (> getCharCount())</li> * </ul> - * + * * @see #setStyleRanges(int[], StyleRange[]) */ public void setStyleRanges(StyleRange[] ranges) { @@ -9975,19 +10046,19 @@ if (ranges == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); setStyleRanges(0, 0, null, ranges, true); } -/** - * Sets the tab width. +/** + * Sets the tab width. * * @param tabs tab width measured in characters. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @see #setTabStops(int[]) */ public void setTabs(int tabs) { - checkWidget(); + checkWidget(); tabLength = tabs; renderer.setFont(null, tabs); resetCache(0, content.getLineCount()); @@ -9999,9 +10070,9 @@ * Sets the receiver's tab list. Each value in the tab list specifies * the space in pixels from the origin of the document to the respective * tab stop. The last tab stop width is repeated continuously. - * + * * @param tabs the new tab list (or null) - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -10009,9 +10080,9 @@ * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_ARGUMENT - if a tab stop is negavite or less than the previous stop in the list</li> * </ul> - * + * * @see StyledText#getTabStops() - * + * * @since 3.6 */ public void setTabStops(int [] tabs) { @@ -10032,18 +10103,18 @@ super.redraw(); } -/** - * Sets the widget content. - * If the widget has the SWT.SINGLE style and "text" contains more than - * one line, only the first line is rendered but the text is stored - * unchanged. A subsequent call to getText will return the same text +/** + * Sets the widget content. + * If the widget has the SWT.SINGLE style and "text" contains more than + * one line, only the first line is rendered but the text is stored + * unchanged. A subsequent call to getText will return the same text * that was set. * <p> - * <b>Note:</b> Only a single line of text should be set when the SWT.SINGLE + * <b>Note:</b> Only a single line of text should be set when the SWT.SINGLE * style is used. * </p> * - * @param text new widget content. Replaces existing content. Line styles + * @param text new widget content. Replaces existing content. Line styles * that were set using StyledText API are discarded. The * current selection is also discarded. * @exception SWTException <ul> @@ -10063,7 +10134,7 @@ event.start = 0; event.end = getCharCount(); event.text = text; - event.doit = true; + event.doit = true; notifyListeners(SWT.Verify, event); if (event.doit) { StyledTextEvent styledTextEvent = null; @@ -10074,7 +10145,7 @@ styledTextEvent.text = content.getTextRange(event.start, event.end - event.start); } content.setText(event.text); - notifyListeners(SWT.Modify, event); + notifyListeners(SWT.Modify, event); if (styledTextEvent != null) { notifyListeners(ST.ExtendedModify, styledTextEvent); } @@ -10095,12 +10166,12 @@ * </p> * * @param textDirection the base text direction style - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @see SWT#FLIP_TEXT_DIRECTION */ @Override @@ -10108,7 +10179,7 @@ checkWidget(); int oldStyle = getStyle(); super.setTextDirection(textDirection); - if (oldStyle != getStyle()) { + if (isAutoDirection () || oldStyle != getStyle()) { resetBidiData(); } } @@ -10139,15 +10210,15 @@ /** * Sets the top index. Do nothing if there is no text set. * <p> - * The top index is the index of the line that is currently at the top + * The top index is the index of the line that is currently at the top * of the widget. The top index changes when the widget is scrolled. * Indexing starts from zero. * Note: The top index is reset to 0 when new text is set in the widget. * </p> * - * @param topIndex new top index. Must be between 0 and - * getLineCount() - fully visible lines per page. If no lines are fully - * visible the maximum value is getLineCount() - 1. An out of range + * @param topIndex new top index. Must be between 0 and + * getLineCount() - fully visible lines per page. If no lines are fully + * visible the maximum value is getLineCount() - 1. An out of range * index will be adjusted accordingly. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -10176,18 +10247,18 @@ } else { pixel = getAvailableHeightAbove(pixel); } - } + } scrollVertical(pixel, true); } -/** +/** * Sets the top margin. - * + * * @param topMargin the top margin. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.5 */ public void setTopMargin (int topMargin) { @@ -10203,7 +10274,7 @@ * Note: The top pixel is reset to 0 when new text is set in the widget. * </p> * - * @param pixel new top pixel offset. Must be between 0 and + * @param pixel new top pixel offset. Must be between 0 and * (getLineCount() - visible lines per page) / getLineHeight()). An out * of range offset will be adjusted accordingly. * @exception SWTException <ul> @@ -10216,7 +10287,7 @@ checkWidget(); if (getCharCount() == 0) { return; - } + } if (pixel < 0) pixel = 0; int lineCount = content.getLineCount(); int height = clientAreaHeight - topMargin - bottomMargin; @@ -10224,7 +10295,7 @@ if (isFixedLineHeight()) { int maxTopPixel = Math.max(0, lineCount * getVerticalIncrement() - height); if (pixel > maxTopPixel) pixel = maxTopPixel; - pixel -= verticalOffset; + pixel -= verticalOffset; } else { pixel -= verticalOffset; if (pixel > 0) { @@ -10264,18 +10335,18 @@ * <p> * It is the amount of blank space, in pixels, at the beginning of each wrapped line. * When a line wraps in several lines all the lines but the first one is indented - * by this amount. + * by this amount. * </p> - * + * * @param wrapIndent the new wrap indent - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @see #setLineWrapIndent(int, int, int) - * + * * @since 3.6 */ public void setWrapIndent(int wrapIndent) { @@ -10284,7 +10355,7 @@ this.wrapIndent = wrapIndent; resetCache(0, content.getLineCount()); setCaretLocation(); - super.redraw(); + super.redraw(); } boolean showLocation(Rectangle rect, boolean scrollPage) { boolean scrolled = false; @@ -10297,7 +10368,7 @@ scrolled = scrollVertical(rect.y + rect.height - (clientAreaHeight - bottomMargin), true); } } - int width = clientAreaWidth - rightMargin - leftMargin; + int width = clientAreaWidth - rightMargin - leftMargin; if (width > 0) { int minScroll = scrollPage ? width / 4 : 0; if (rect.x < leftMargin) { @@ -10346,10 +10417,10 @@ startOffset = selection.x; endOffset = selection.y; } - + Rectangle startBounds = getBoundsAtOffset(startOffset); Rectangle endBounds = getBoundsAtOffset(endOffset); - + // can the selection be fully displayed within the widget's visible width? int w = clientAreaWidth - leftMargin - rightMargin; boolean selectionFits = rightToLeft ? startBounds.x - endBounds.x <= w : endBounds.x - startBounds.x <= w; @@ -10364,7 +10435,7 @@ endBounds.width = endOffset == caretOffset ? getCaretWidth() : 0; showLocation(endBounds, false); } else { - // just show the end of the selection since the selection start + // just show the end of the selection since the selection start // will not be visible showLocation(endBounds, true); } @@ -10377,7 +10448,7 @@ } else { Point location = caret.getLocation(); Point size = caret.getSize(); - boolean visible = + boolean visible = topMargin <= location.y + size.y && location.y <= clientAreaHeight - bottomMargin && leftMargin <= location.x + size.x && location.x <= clientAreaWidth - rightMargin; caret.setVisible(visible); @@ -10387,10 +10458,10 @@ /** * Updates the selection and caret position depending on the text change. * <p> - * If the selection intersects with the replaced text, the selection is + * If the selection intersects with the replaced text, the selection is * reset and the caret moved to the end of the new text. * If the selection is behind the replaced text it is moved so that the - * same text remains selected. If the selection is before the replaced text + * same text remains selected. If the selection is before the replaced text * it is left unchanged. * </p> * @@ -10410,7 +10481,7 @@ } if (selection.y > startOffset + replacedLength && selection.x < startOffset + replacedLength) { // clear selection fragment after text change. - // do this only when the selection is actually affected by the + // do this only when the selection is actually affected by the // change. Selection is only affected if it intersects the change (1GDY217). int netNewLength = newLength - replacedLength; int redrawStart = startOffset + newLength; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/StyledTextListener.java swt4-gtk-4.6.0/org/eclipse/swt/custom/StyledTextListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/StyledTextListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/StyledTextListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -27,23 +27,23 @@ */ @Override public void handleEvent(Event e) { - + switch (e.type) { case ST.ExtendedModify: ExtendedModifyEvent extendedModifyEvent = new ExtendedModifyEvent((StyledTextEvent) e); ((ExtendedModifyListener) eventListener).modifyText(extendedModifyEvent); - break; + break; case ST.LineGetBackground: LineBackgroundEvent lineBgEvent = new LineBackgroundEvent((StyledTextEvent) e); ((LineBackgroundListener) eventListener).lineGetBackground(lineBgEvent); ((StyledTextEvent) e).lineBackground = lineBgEvent.lineBackground; - break; + break; case ST.LineGetSegments: BidiSegmentEvent segmentEvent = new BidiSegmentEvent((StyledTextEvent) e); ((BidiSegmentListener) eventListener).lineGetSegments(segmentEvent); ((StyledTextEvent) e).segments = segmentEvent.segments; ((StyledTextEvent) e).segmentsChars = segmentEvent.segmentsChars; - break; + break; case ST.LineGetStyle: LineStyleEvent lineStyleEvent = new LineStyleEvent((StyledTextEvent) e); ((LineStyleListener) eventListener).lineGetStyle(lineStyleEvent); @@ -60,7 +60,7 @@ case ST.PaintObject: PaintObjectEvent paintObjectEvent = new PaintObjectEvent((StyledTextEvent) e); ((PaintObjectListener) eventListener).paintObject(paintObjectEvent); - break; + break; case ST.VerifyKey: VerifyEvent verifyEvent = new VerifyEvent(e); ((VerifyKeyListener) eventListener).verifyKey(verifyEvent); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/StyledTextPrintOptions.java swt4-gtk-4.6.0/org/eclipse/swt/custom/StyledTextPrintOptions.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/StyledTextPrintOptions.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/StyledTextPrintOptions.java 2016-07-06 19:11:33.000000000 +0000 @@ -20,11 +20,11 @@ * </p> * <pre> * StyledTextPrintOptions options = new StyledTextPrintOptions(); - * options.footer = "\t\t<page>"; + * options.footer = "\t\t<page>"; * options.jobName = "Example"; * options.printLineBackground = true; - * - * Runnable runnable = styledText.print(new Printer(), options); + * + * Runnable runnable = styledText.print(new Printer(), options); * runnable.run(); * </pre> * @@ -49,7 +49,7 @@ * <p>left, center, right = <page> | #CDATA</p> * <p>Header and footer are defined as three separate regions for arbitrary * text or the page number placeholder <page> - * (<code>StyledTextPrintOptions.PAGE_TAG</code>). The three regions are + * (<code>StyledTextPrintOptions.PAGE_TAG</code>). The three regions are * left aligned, centered and right aligned. They are separated by a tab * character (<code>StyledTextPrintOptions.SEPARATOR</code>). */ @@ -60,7 +60,7 @@ * <p>left, center, right = <page> | #CDATA</p> * <p>Header and footer are defined as three separate regions for arbitrary * text or the page number placeholder <page> - * (<code>StyledTextPrintOptions.PAGE_TAG</code>). The three regions are + * (<code>StyledTextPrintOptions.PAGE_TAG</code>). The three regions are * left aligned, centered and right aligned. They are separated by a tab * character (<code>StyledTextPrintOptions.SEPARATOR</code>). */ @@ -69,7 +69,7 @@ * Name of the print job. */ public String jobName = null; - + /** * Print the text foreground color. Default value is <code>false</code>. */ @@ -86,19 +86,19 @@ * Print the line background color. Default value is <code>false</code>. */ public boolean printLineBackground = false; - + /** * Print line numbers. Default value is <code>false</code>. - * + * * @since 3.3 */ public boolean printLineNumbers = false; - + /** * Labels used for printing line numbers. - * + * * @since 3.4 */ public String[] lineLabels = null; - + } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/StyledTextRenderer.java swt4-gtk-4.6.0/org/eclipse/swt/custom/StyledTextRenderer.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/StyledTextRenderer.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/StyledTextRenderer.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -29,7 +29,7 @@ int tabWidth; int ascent, descent; int averageCharWidth; - + /* Line data */ int topIndex = -1; TextLayout[] layouts; @@ -40,28 +40,28 @@ int maxWidth; int maxWidthLineIndex; boolean idleRunning; - + /* Bullet */ Bullet[] bullets; int[] bulletsIndices; int[] redrawLines; - + /* Style data */ int[] ranges; - int styleCount; + int styleCount; StyleRange[] styles; StyleRange[] stylesSet; int stylesSetCount = 0; boolean hasLinks, fixedPitch; final static int BULLET_MARGIN = 8; - + final static boolean COMPACT_STYLES = true; final static boolean MERGE_STYLES = true; - + final static int GROW = 32; final static int IDLE_TIME = 50; final static int CACHE_SIZE = 128; - + final static int BACKGROUND = 1 << 0; final static int ALIGNMENT = 1 << 1; final static int INDENT = 1 << 2; @@ -70,7 +70,7 @@ final static int TABSTOPS = 1 << 6; final static int WRAP_INDENT = 1 << 7; final static int SEGMENT_CHARS = 1 << 8; - + static class LineInfo { int flags; Color background; @@ -98,7 +98,7 @@ } } } - + StyledTextRenderer(Device device, StyledText styledText) { this.device = device; this.styledText = styledText; @@ -131,7 +131,7 @@ } } if (MERGE_STYLES) { - int j = modifyStart; + int j = modifyStart; for (int i = 0; i < mergeCount; i += 2) { if (j > 0 && ranges[j - 2] + ranges[j - 1] == mergeRanges[i] && mergeStyles[i >> 1].similarTo(styles[(j - 2) >> 1])) { ranges[j - 1] += mergeRanges[i + 1]; @@ -221,11 +221,16 @@ } } void calculateClientArea () { - int index = styledText.getTopIndex(); + int index = Math.max (0, styledText.getTopIndex()); int lineCount = content.getLineCount(); int height = styledText.getClientArea().height; int y = 0; - while (height > y && lineCount > index) { + /* + * There exists a possibility of ArrayIndexOutOfBounds Exception in + * below code, exact scenario not known. To avoid this exception added + * check for 'index' value, refer Bug 471192. + */ + while (height > y && lineCount > index && lineHeight.length > index) { calculate(index, 1); y += lineHeight[index++]; } @@ -233,6 +238,7 @@ void calculateIdle () { if (idleRunning) return; Runnable runnable = new Runnable() { + @Override public void run() { if (styledText == null) return; int i; @@ -244,7 +250,7 @@ } } if (i < lineCount) { - Display display = styledText.getDisplay(); + Display display = styledText.getDisplay(); display.asyncExec(this); } else { idleRunning = false; @@ -252,10 +258,10 @@ ScrollBar bar = styledText.getVerticalBar(); if (bar != null) { bar.setSelection(styledText.getVerticalScrollOffset()); - } + } } } - }; + }; Display display = styledText.getDisplay(); display.asyncExec(runnable); idleRunning = true; @@ -296,7 +302,7 @@ if (lines != null) { LineInfo[] newLines = renderer.lines = new LineInfo[lineCount]; for (int i = 0; i < newLines.length; i++) { - newLines[i] = new LineInfo(lines[i]); + newLines[i] = new LineInfo(lines[i]); } renderer.lineCount = lineCount; } @@ -343,7 +349,7 @@ style = (StyleRange)style.clone(); style.metrics = null; if (style.font == null) style.font = getFont(style.fontStyle); - layout.setStyle(style, 0, string.length()); + layout.setStyle(style, 0, string.length()); int x = paintX + Math.max(0, metrics.width - layout.getBounds().width - BULLET_MARGIN); layout.draw(gc, x, paintY); layout.dispose(); @@ -359,7 +365,7 @@ if (styledText.getBlockSelection()) { selectionStart = selectionEnd = 0; } - Rectangle client = styledText.getClientArea(); + Rectangle client = styledText.getClientArea(); Color lineBackground = getLineBackground(lineIndex, null); StyledTextEvent event = styledText.getLineBackgroundData(lineOffset, line); if (event != null && event.lineBackground != null) lineBackground = event.lineBackground; @@ -390,7 +396,7 @@ } layout.draw(gc, paintX, paintY, start, end - 1, selectionFg, selectionBg, flags); } - + // draw objects Bullet bullet = null; int bulletIndex = -1; @@ -493,7 +499,7 @@ if (event != null) { StyleRange[] styles = event.styles; if (styles != null) { - int[] ranges = event.ranges; + int[] ranges = event.ranges; if (ranges != null) { for (int i = 0; i < ranges.length; i+=2) { if (ranges[i] <= offset && offset < ranges[i] + ranges[i+1] && styles[i >> 1].underline && styles[i >> 1].underlineStyle == SWT.UNDERLINE_LINK) { @@ -502,7 +508,7 @@ } } else { for (int i = 0; i < styles.length; i++) { - StyleRange style = styles[i]; + StyleRange style = styles[i]; if (style.start <= offset && offset < style.start + style.length && style.underline && style.underlineStyle == SWT.UNDERLINE_LINK) { return true; } @@ -514,7 +520,7 @@ int rangeCount = styleCount << 1; int index = getRangeIndex(offset, -1, rangeCount); if (index >= rangeCount) return false; - int rangeStart = ranges[index]; + int rangeStart = ranges[index]; int rangeLength = ranges[index + 1]; StyleRange rangeStyle = styles[index >> 1]; if (rangeStart <= offset && offset < rangeStart + rangeLength && rangeStyle.underline && rangeStyle.underlineStyle == SWT.UNDERLINE_LINK) { @@ -710,7 +716,7 @@ TextLayout getTextLayout(int lineIndex, int orientation, int width, int lineSpacing) { TextLayout layout = null; if (styledText != null) { - int topIndex = styledText.topIndex > 0 ? styledText.topIndex - 1 : 0; + int topIndex = styledText.topIndex > 0 ? styledText.topIndex - 1 : 0; if (layouts == null || topIndex != this.topIndex) { TextLayout[] newLayouts = new TextLayout[CACHE_SIZE]; if (layouts != null) { @@ -784,7 +790,9 @@ indent = styledText.indent; wrapIndent = styledText.wrapIndent; alignment = styledText.alignment; - if ((styledText.getStyle() & SWT.FLIP_TEXT_DIRECTION) != 0) { + if (styledText.isAutoDirection()) { + textDirection = SWT.AUTO_TEXT_DIRECTION; + } else if ((styledText.getStyle() & SWT.FLIP_TEXT_DIRECTION) != 0) { textDirection = orientation == SWT.RIGHT_TO_LEFT ? SWT.LEFT_TO_RIGHT : SWT.RIGHT_TO_LEFT; } justify = styledText.justify; @@ -875,7 +883,7 @@ layout.setAlignment(alignment); layout.setJustify(justify); layout.setTextDirection(textDirection); - + int lastOffset = 0; int length = line.length(); if (styles != null) { @@ -969,7 +977,7 @@ } } } - + if (styledText != null && styledText.isFixedLineHeight()) { int index = -1; int lineCount = layout.getLineCount(); @@ -1225,7 +1233,7 @@ return; } if (newRanges == null && COMPACT_STYLES) { - newRanges = new int[newStyles.length << 1]; + newRanges = new int[newStyles.length << 1]; StyleRange[] tmpStyles = new StyleRange[newStyles.length]; if (stylesSet == null) stylesSet = new StyleRange[4]; for (int i = 0, j = 0; i < newStyles.length; i++) { @@ -1249,7 +1257,7 @@ } newStyles = tmpStyles; } - + if (styleCount == 0) { if (newRanges != null) { ranges = new int[newRanges.length]; @@ -1304,7 +1312,7 @@ if (ranges[modifyStart] < newStart && newStart < ranges[modifyStart] + ranges[modifyStart + 1]) { mergeStyles[mergeCount >> 1] = styles[modifyStart >> 1]; mergeRanges[mergeCount] = ranges[modifyStart]; - mergeRanges[mergeCount + 1] = newStart - ranges[modifyStart]; + mergeRanges[mergeCount + 1] = newStart - ranges[modifyStart]; mergeCount += 2; } mergeStyles[mergeCount >> 1] = newStyles[i >> 1]; @@ -1338,7 +1346,7 @@ modifyEnd = modifyStart; StyleRange[] mergeStyles = new StyleRange[3]; for (int i = 0; i < newStyles.length; i++) { - StyleRange newStyle = newStyles[i], style; + StyleRange newStyle = newStyles[i], style; int newStart = newStyle.start; int newEnd = newStart + newStyle.length; if (newStart == newEnd) continue; @@ -1372,9 +1380,9 @@ int start = event.start; int newCharCount = event.newCharCount, replaceCharCount = event.replaceCharCount; int newLineCount = event.newLineCount, replaceLineCount = event.replaceLineCount; - - updateRanges(start, replaceCharCount, newCharCount); - + + updateRanges(start, replaceCharCount, newCharCount); + int startLine = content.getLineAtOffset(start); if (replaceCharCount == content.getCharCount()) lines = null; if (replaceLineCount == lineCount) { @@ -1387,7 +1395,7 @@ if (lineCount + delta > lineWidth.length) { int[] newWidths = new int[lineCount + delta + GROW]; System.arraycopy(lineWidth, 0, newWidths, 0, lineCount); - lineWidth = newWidths; + lineWidth = newWidths; int[] newHeights = new int[lineCount + delta + GROW]; System.arraycopy(lineHeight, 0, newHeights, 0, lineCount); lineHeight = newHeights; @@ -1549,7 +1557,7 @@ ranges[modifyStart + 3] = ranges[modifyStart] + ranges[modifyStart + 1] - end; ranges[modifyStart + 2] = start + newCharCount; ranges[modifyStart + 1] = start - ranges[modifyStart]; - styles[(modifyStart >> 1) + 1] = styles[modifyStart >> 1]; + styles[(modifyStart >> 1) + 1] = styles[modifyStart >> 1]; rangeCount += 2; styleCount++; modifyEnd += 4; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/StyleRange.java swt4-gtk-4.6.0/org/eclipse/swt/custom/StyleRange.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/StyleRange.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/StyleRange.java 2016-07-06 19:11:33.000000000 +0000 @@ -12,7 +12,6 @@ import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; -import org.eclipse.swt.internal.CloneableCompatibility; /** * <code>StyleRange</code> defines a set of styles for a specified @@ -26,13 +25,13 @@ * * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ -public class StyleRange extends TextStyle implements CloneableCompatibility { - +public class StyleRange extends TextStyle implements Cloneable { + /** * the start offset of the range, zero-based from the document start */ public int start; - + /** * the length of the range */ @@ -41,21 +40,21 @@ /** * the font style of the range. It may be a combination of * SWT.NORMAL, SWT.ITALIC or SWT.BOLD - * + * * Note: the font style is not used if the <code>font</code> attribute * is set */ public int fontStyle = SWT.NORMAL; - + /** * Create a new style range with no styles - * + * * @since 3.2 */ public StyleRange() { } -/** +/** * Create a new style range from an existing text style. * * @param style the text style to copy @@ -66,12 +65,12 @@ super(style); } -/** +/** * Create a new style range. * * @param start start offset of the style - * @param length length of the style - * @param foreground foreground color of the style, null if none + * @param length length of the style + * @param foreground foreground color of the style, null if none * @param background background color of the style, null if none */ public StyleRange(int start, int length, Color foreground, Color background) { @@ -80,12 +79,12 @@ this.length = length; } -/** +/** * Create a new style range. * * @param start start offset of the style - * @param length length of the style - * @param foreground foreground color of the style, null if none + * @param length length of the style + * @param foreground foreground color of the style, null if none * @param background background color of the style, null if none * @param fontStyle font style of the style, may be SWT.NORMAL, SWT.ITALIC or SWT.BOLD */ @@ -117,8 +116,8 @@ } /** - * Returns an integer hash code for the receiver. Any two - * objects that return <code>true</code> when passed to + * Returns an integer hash code for the receiver. Any two + * objects that return <code>true</code> when passed to * <code>equals</code> must return the same value for this * method. * @@ -134,7 +133,7 @@ return font != null || metrics != null || rise != 0; } /** - * Returns whether or not the receiver is unstyled (i.e., does not have any + * Returns whether or not the receiver is unstyled (i.e., does not have any * style attributes specified). * * @return true if the receiver is unstyled, false otherwise. @@ -153,7 +152,7 @@ } /** - * Compares the specified object to this StyleRange and answer if the two + * Compares the specified object to this StyleRange and answer if the two * are similar. The object must be an instance of StyleRange and have the * same field values for except for start and length. * @@ -170,7 +169,7 @@ * Returns a new StyleRange with the same values as this StyleRange. * * @return a shallow copy of this StyleRange - */ + */ @Override public Object clone() { try { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/TableCursor.java swt4-gtk-4.6.0/org/eclipse/swt/custom/TableCursor.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/TableCursor.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/TableCursor.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -11,10 +11,10 @@ package org.eclipse.swt.custom; import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; import org.eclipse.swt.accessibility.*; import org.eclipse.swt.events.*; +import org.eclipse.swt.graphics.*; +import org.eclipse.swt.widgets.*; /** * A TableCursor provides a way for the user to navigate around a Table @@ -23,18 +23,18 @@ * <p> * For a detailed example of using a TableCursor to navigate to a cell and then edit it see * http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet96.java . - * + * * <dl> * <dt><b>Styles:</b></dt> * <dd>BORDER</dd> * <dt><b>Events:</b></dt> * <dd>Selection, DefaultSelection</dd> * </dl> - * + * * @since 2.0 * * @see <a href="http://www.eclipse.org/swt/snippets/#tablecursor">TableCursor snippets</a> - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> + * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public class TableCursor extends Canvas { Table table; @@ -55,7 +55,7 @@ * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -82,8 +82,9 @@ table = parent; setBackground(null); setForeground(null); - + listener = new Listener() { + @Override public void handleEvent(Event event) { switch (event.type) { case SWT.Dispose : @@ -119,6 +120,7 @@ } tableListener = new Listener() { + @Override public void handleEvent(Event event) { switch (event.type) { case SWT.MouseDown : @@ -134,6 +136,7 @@ table.addListener(SWT.MouseDown, tableListener); disposeItemListener = new Listener() { + @Override public void handleEvent(Event event) { unhookRowColumnListeners(); row = null; @@ -142,6 +145,7 @@ } }; disposeColumnListener = new Listener() { + @Override public void handleEvent(Event event) { unhookRowColumnListeners(); row = null; @@ -150,6 +154,7 @@ } }; resizeListener = new Listener() { + @Override public void handleEvent(Event event) { _resize(); } @@ -204,7 +209,7 @@ * @see SelectionListener * @see SelectionEvent * @see #removeSelectionListener(SelectionListener) - * + * */ public void addSelectionListener(SelectionListener listener) { checkWidget(); @@ -251,7 +256,7 @@ break; case SWT.ARROW_LEFT : case SWT.ARROW_RIGHT : - { + { int columnCount = table.getColumnCount(); if (columnCount == 0) break; int[] order = table.getColumnOrder(); @@ -337,7 +342,7 @@ String platform = SWT.getPlatform(); if ("win32".equals(platform)) { //$NON-NLS-1$ if (table.getColumnCount() == 0 || columnIndex == 0) { - x += 2; + x += 2; } else { int alignmnent = column.getAlignment(); switch (alignmnent) { @@ -354,7 +359,7 @@ } } else { if (table.getColumnCount() == 0) { - x += 5; + x += 5; } else { int alignmnent = column.getAlignment(); switch (alignmnent) { @@ -504,7 +509,7 @@ * * @see SelectionListener * @see #addSelectionListener(SelectionListener) - * + * * @since 3.0 */ public void removeSelectionListener(SelectionListener listener) { @@ -513,7 +518,7 @@ SWT.error(SWT.ERROR_NULL_ARGUMENT); } removeListener(SWT.Selection, listener); - removeListener(SWT.DefaultSelection, listener); + removeListener(SWT.DefaultSelection, listener); } void _resize() { @@ -589,7 +594,7 @@ * @param color the new color (or null) * * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> + * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -612,7 +617,7 @@ * @param color the new color (or null) * * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> + * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -626,7 +631,7 @@ redraw(); } /** - * Positions the TableCursor over the cell at the given row and column in the parent table. + * Positions the TableCursor over the cell at the given row and column in the parent table. * * @param row the index of the row for the cell to select * @param column the index of column for the cell to select @@ -649,7 +654,7 @@ setRowColumn(row, column, false); } /** - * Positions the TableCursor over the cell at the given row and column in the parent table. + * Positions the TableCursor over the cell at the given row and column in the parent table. * * @param row the TableItem of the row for the cell to select * @param column the index of column for the cell to select diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/TableEditor.java swt4-gtk-4.6.0/org/eclipse/swt/custom/TableEditor.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/TableEditor.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/TableEditor.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -34,7 +34,7 @@ * } * column1.pack(); * column2.pack(); -* +* * final TableEditor editor = new TableEditor(table); * //The editor must have the same size as the cell and must * //not be any smaller than 50 pixels. @@ -43,17 +43,17 @@ * editor.minimumWidth = 50; * // editing the second column * final int EDITABLECOLUMN = 1; -* +* * table.addSelectionListener(new SelectionAdapter() { * public void widgetSelected(SelectionEvent e) { * // Clean up any previous editor control * Control oldEditor = editor.getEditor(); * if (oldEditor != null) oldEditor.dispose(); -* +* * // Identify the selected row * TableItem item = (TableItem)e.item; * if (item == null) return; -* +* * // The control that will be the editor must be a child of the Table * Text newEditor = new Text(table, SWT.NONE); * newEditor.setText(item.getText(EDITABLECOLUMN)); @@ -89,21 +89,24 @@ public TableEditor (Table table) { super(table); this.table = table; - + columnListener = new ControlListener() { + @Override public void controlMoved(ControlEvent e){ layout (); } + @Override public void controlResized(ControlEvent e){ layout (); } }; timer = new Runnable () { + @Override public void run() { layout (); } }; - + // To be consistent with older versions of SWT, grabVertical defaults to true grabVertical = true; } @@ -128,11 +131,11 @@ if (grabHorizontal) { editorRect.width = Math.max(cell.width, minimumWidth); } - + if (grabVertical) { editorRect.height = Math.max(cell.height, minimumHeight); } - + if (horizontalAlignment == SWT.RIGHT) { editorRect.x += cell.width - editorRect.width; } else if (horizontalAlignment == SWT.LEFT) { @@ -140,7 +143,7 @@ } else { // default is CENTER editorRect.x += (cell.width - editorRect.width)/2; } - + if (verticalAlignment == SWT.BOTTOM) { editorRect.y += cell.height - editorRect.height; } else if (verticalAlignment == SWT.TOP) { @@ -201,8 +204,8 @@ } /** * Sets the zero based index of the column of the cell being tracked by this editor. -* -* @param column the zero based index of the column of the cell being tracked by this editor +* +* @param column the zero based index of the column of the cell being tracked by this editor */ public void setColumn(int column) { int columnCount = table.getColumnCount(); @@ -219,8 +222,8 @@ this.column = -1; } - if (column < 0 || column >= table.getColumnCount()) return; - + if (column < 0 || column >= table.getColumnCount()) return; + this.column = column; TableColumn tableColumn = table.getColumn(this.column); tableColumn.addControlListener(columnListener); @@ -231,7 +234,7 @@ * * @param item the item to be edited */ -public void setItem (TableItem item) { +public void setItem (TableItem item) { this.item = item; resize(); } @@ -245,7 +248,7 @@ * * <p>Note: The Control provided as the editor <b>must</b> be created with its parent being the Table control * specified in the TableEditor constructor. -* +* * @param editor the Control that is displayed above the cell being edited * @param item the TableItem for the row of the cell being tracked by this editor * @param column the zero based index of the column of the cell being tracked by this editor diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/TableTreeEditor.java swt4-gtk-4.6.0/org/eclipse/swt/custom/TableTreeEditor.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/TableTreeEditor.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/TableTreeEditor.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -12,15 +12,15 @@ import org.eclipse.swt.*; +import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*; -import org.eclipse.swt.events.*; /** * * A TableTreeEditor is a manager for a Control that appears above a cell in a TableTree * and tracks with the moving and resizing of that cell. It can be used to display a -* text widget above a cell in a TableTree so that the user can edit the contents of -* that cell. It can also be used to display a button that can launch a dialog for +* text widget above a cell in a TableTree so that the user can edit the contents of +* that cell. It can also be used to display a button that can launch a dialog for * modifying the contents of the associated cell. * * <p> Here is an example of using a TableTreeEditor: @@ -41,7 +41,7 @@ * } * column1.setWidth(100); * column2.pack(); -* +* * final TableTreeEditor editor = new TableTreeEditor(tableTree); * //The editor must have the same size as the cell and must * //not be any smaller than 50 pixels. @@ -50,17 +50,17 @@ * editor.minimumWidth = 50; * // editing the second column * final int EDITABLECOLUMN = 1; -* +* * tableTree.addSelectionListener(new SelectionAdapter() { * public void widgetSelected(SelectionEvent e) { * // Clean up any previous editor control * Control oldEditor = editor.getEditor(); * if (oldEditor != null) oldEditor.dispose(); -* +* * // Identify the selected row * TableTreeItem item = (TableTreeItem)e.item; * if (item == null) return; -* +* * // The control that will be the editor must be a child of the Table * Text newEditor = new Text(table, SWT.NONE); * newEditor.setText(item.getText(EDITABLECOLUMN)); @@ -76,8 +76,10 @@ * } * }); * </pre></code> -* +* * @deprecated As of 3.1 use TreeEditor with Tree, TreeItem and TreeColumn +* @noreference This API will be deleted in a future release. See bug 475833 for details. +* @noextend This API will be deleted in a future release. See bug 475833 for details. */ @Deprecated public class TableTreeEditor extends ControlEditor { @@ -99,6 +101,7 @@ treeListener = new TreeListener () { final Runnable runnable = new Runnable() { + @Override public void run() { if (editor == null || editor.isDisposed()) return; if (TableTreeEditor.this.tableTree.isDisposed()) return; @@ -106,11 +109,13 @@ editor.setVisible(true); } }; + @Override public void treeCollapsed(TreeEvent e) { if (editor == null || editor.isDisposed ()) return; editor.setVisible(false); e.display.asyncExec(runnable); } + @Override public void treeExpanded(TreeEvent e) { if (editor == null || editor.isDisposed ()) return; editor.setVisible(false); @@ -118,16 +123,18 @@ } }; tableTree.addTreeListener(treeListener); - + columnListener = new ControlListener() { + @Override public void controlMoved(ControlEvent e){ layout (); } + @Override public void controlResized(ControlEvent e){ layout (); } }; - + // To be consistent with older versions of SWT, grabVertical defaults to true grabVertical = true; } @@ -146,11 +153,11 @@ if (grabHorizontal) { editorRect.width = Math.max(cell.width, minimumWidth); } - + if (grabVertical) { editorRect.height = Math.max(cell.height, minimumHeight); } - + if (horizontalAlignment == SWT.RIGHT) { editorRect.x += cell.width - editorRect.width; } else if (horizontalAlignment == SWT.LEFT) { @@ -158,7 +165,7 @@ } else { // default is CENTER editorRect.x += (cell.width - editorRect.width)/2; } - + if (verticalAlignment == SWT.BOTTOM) { editorRect.y += cell.height - editorRect.height; } else if (verticalAlignment == SWT.TOP) { @@ -223,14 +230,14 @@ this.column = -1; } - if (column < 0 || column >= table.getColumnCount()) return; - + if (column < 0 || column >= table.getColumnCount()) return; + this.column = column; TableColumn tableColumn = table.getColumn(this.column); tableColumn.addControlListener(columnListener); layout(); } -public void setItem (TableTreeItem item) { +public void setItem (TableTreeItem item) { this.item = item; layout(); } @@ -240,7 +247,7 @@ * * <p>Note: The Control provided as the editor <b>must</b> be created with its parent being the Table control * specified in the TableEditor constructor. -* +* * @param editor the Control that is displayed above the cell being edited * @param item the TableItem for the row of the cell being tracked by this editor * @param column the zero based index of the column of the cell being tracked by this editor diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/TableTreeItem.java swt4-gtk-4.6.0/org/eclipse/swt/custom/TableTreeItem.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/TableTreeItem.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/TableTreeItem.java 2016-07-06 19:11:33.000000000 +0000 @@ -19,8 +19,10 @@ * A TableTreeItem is a selectable user interface object * that represents an item in a hierarchy of items in a * TableTree. - * + * * @deprecated As of 3.1 use Tree, TreeItem and TreeColumn + * @noreference This API will be deleted in a future release. See bug 475833 for details. + * @noextend This API will be deleted in a future release. See bug 475833 for details. */ @Deprecated public class TableTreeItem extends Item { @@ -45,7 +47,7 @@ * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -77,7 +79,7 @@ * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -110,7 +112,7 @@ * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -142,7 +144,7 @@ * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -172,7 +174,7 @@ this.parent = parent; this.parentItem = parentItem; if (parentItem == null) { - + /* Root items are visible immediately */ int tableIndex = parent.addItem(this, index); tableItem = new TableItem(parent.getTable(), style, tableIndex); @@ -207,7 +209,7 @@ void addItem(TableTreeItem item, int index) { if (item == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (index < 0 || index > items.length) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - + /* Now that item has a sub-node it must indicate that it can be expanded */ if (items.length == 0 && index == 0) { if (tableItem != null) { @@ -215,7 +217,7 @@ tableItem.setImage(0, image); } } - + /* Put the item in the items list */ TableTreeItem[] newItems = new TableTreeItem[items.length + 1]; System.arraycopy(items, 0, newItems, 0, index); @@ -229,14 +231,14 @@ * Returns the receiver's background color. * * @return the background color - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 2.0 - * + * */ public Color getBackground () { checkWidget (); @@ -291,7 +293,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 2.1 */ public boolean getGrayed () { @@ -337,9 +339,9 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 2.0 - * + * */ public Color getForeground () { checkWidget (); @@ -352,7 +354,7 @@ * images of the tree, therefore getImage(0) will return null. * * @return the image at index 0 - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -400,7 +402,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.1 */ public TableTreeItem getItem (int index) { @@ -427,7 +429,7 @@ * <p> * Note: This is not the actual structure used by the receiver * to maintain its list of items, so modifying the array will - * not affect the receiver. + * not affect the receiver. * </p> * * @return the receiver's items @@ -500,7 +502,7 @@ /** * Gets the index of the specified item. - * + * * <p>The widget is searched starting at 0 until an * item is found that is equal to the search item. * If no item is found, -1 is returned. Indexing @@ -511,7 +513,7 @@ * */ public int indexOf (TableTreeItem item) { - //checkWidget(); + //checkWidget(); for (int i = 0; i < items.length; i++) { if (items[i] == item) return i; } @@ -532,7 +534,7 @@ items[i].expandAll(notify); } } -int expandedIndexOf (TableTreeItem item) { +int expandedIndexOf (TableTreeItem item) { int index = 0; for (int i = 0; i < items.length; i++) { if (items[i] == item) return index; @@ -597,17 +599,17 @@ * if the argument is null. * * @param color the new color (or null) - * + * * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> + * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 2.0 - * + * */ public void setBackground (Color color) { checkWidget (); @@ -621,7 +623,7 @@ } /** - * Sets the checked state of the checkbox for this item. This state change + * Sets the checked state of the checkbox for this item. This state change * only applies if the Table was created with the SWT.CHECK style. * * @param checked the new checked state of the checkbox @@ -642,16 +644,16 @@ } /** - * Sets the grayed state of the checkbox for this item. This state change + * Sets the grayed state of the checkbox for this item. This state change * only applies if the Table was created with the SWT.CHECK style. * - * @param grayed the new grayed state of the checkbox; + * @param grayed the new grayed state of the checkbox; * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 2.1 */ public void setGrayed (boolean grayed) { @@ -697,13 +699,13 @@ * @param font the new font (or null) * * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> + * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.0 */ public void setFont (Font font){ @@ -724,17 +726,17 @@ * @param color the new color (or null) * * @since 2.0 - * + * * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> + * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 2.0 - * + * */ public void setForeground (Color color) { checkWidget (); @@ -782,7 +784,7 @@ * images of the tree, therefore do nothing. * * @param image the new image or null - * + * * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> @@ -868,7 +870,7 @@ tableItem.setImage(0, parent.getPlusImage()); } } - + } else { for (int i = 0, length = items.length; i < length; i++) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/TableTree.java swt4-gtk-4.6.0/org/eclipse/swt/custom/TableTree.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/TableTree.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/TableTree.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -16,7 +16,7 @@ import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*; -/** +/** * A TableTree is a selectable user interface object * that displays a hierarchy of items, and issues * notification when an item is selected. @@ -36,8 +36,10 @@ * <p> * Note: Only one of the styles SINGLE, and MULTI may be specified. * </p> - * + * * @deprecated As of 3.1 use Tree, TreeItem and TreeColumn + * @noreference This API will be deleted in a future release. See bug 475833 for details. + * @noextend This API will be deleted in a future release. See bug 475833 for details. */ @Deprecated public class TableTree extends Composite { @@ -48,20 +50,20 @@ /* * TableTreeItems are not treated as children but rather as items. - * When the TableTree is disposed, all children are disposed because + * When the TableTree is disposed, all children are disposed because * TableTree inherits this behaviour from Composite. The items * must be disposed separately. Because TableTree is not part of - * the org.eclipse.swt.widgets package, the method releaseWidget can + * the org.eclipse.swt.widgets package, the method releaseWidget can * not be overridden (this is how items are disposed of in Table and Tree). * Instead, the items are disposed of in response to the dispose event on the * TableTree. The "inDispose" flag is used to distinguish between disposing - * one TableTreeItem (e.g. when removing an entry from the TableTree) and + * one TableTreeItem (e.g. when removing an entry from the TableTree) and * disposing the entire TableTree. */ boolean inDispose = false; - - static final TableTreeItem[] EMPTY_ITEMS = new TableTreeItem [0]; - static final String[] EMPTY_TEXTS = new String [0]; + + static final TableTreeItem[] EMPTY_ITEMS = new TableTreeItem [0]; + static final String[] EMPTY_TEXTS = new String [0]; static final Image[] EMPTY_IMAGES = new Image [0]; static final String ITEMID = "TableTreeItemID"; //$NON-NLS-1$ @@ -71,7 +73,7 @@ * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -98,6 +100,7 @@ super(parent, checkStyle (style)); table = new Table(this, style); Listener tableListener = new Listener() { + @Override public void handleEvent(Event e) { switch (e.type) { case SWT.MouseDown: onMouseDown(e); break; @@ -107,15 +110,16 @@ } } }; - int[] tableEvents = new int[]{SWT.MouseDown, - SWT.Selection, - SWT.DefaultSelection, + int[] tableEvents = new int[]{SWT.MouseDown, + SWT.Selection, + SWT.DefaultSelection, SWT.KeyDown}; for (int i = 0; i < tableEvents.length; i++) { table.addListener(tableEvents[i], tableListener); } - + listener = new Listener() { + @Override public void handleEvent(Event e) { switch (e.type) { case SWT.Dispose: onDispose(e); break; @@ -124,12 +128,12 @@ } } }; - int[] events = new int[]{SWT.Dispose, - SWT.Resize, + int[] events = new int[]{SWT.Dispose, + SWT.Resize, SWT.FocusIn}; for (int i = 0; i < events.length; i++) { addListener(events[i], listener); - } + } } int addItem(TableTreeItem item, int index) { @@ -137,13 +141,13 @@ TableTreeItem[] newItems = new TableTreeItem[items.length + 1]; System.arraycopy(items, 0, newItems, 0, index); newItems[index] = item; - System.arraycopy(items, index, newItems, index + 1, items.length - index); + System.arraycopy(items, index, newItems, index + 1, items.length - index); items = newItems; /* Return the index in the table where this table should be inserted */ - if (index == items.length - 1 ) + if (index == items.length - 1 ) return table.getItemCount(); - else + else return table.indexOf(items[index+1].tableItem); } @@ -209,10 +213,10 @@ addListener (SWT.Collapse, typedListener); } private static int checkStyle (int style) { - int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT; + int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT; style = style & mask; return style; -} +} @Override public Point computeSize (int wHint, int hHint, boolean changed) { checkWidget(); @@ -258,7 +262,7 @@ // item has no sub items, a grey (Widget background colour) square will appear in // the first column of the first item. // It is not possible in the constructor to set the background of the TableTree - // to be the same as the background of the Table because this interferes with + // to be the same as the background of the Table because this interferes with // the TableTree adapting to changes in the System color settings. return table.getBackground(); } @@ -372,21 +376,21 @@ } void createImages () { - + int itemHeight = sizeImage.getBounds().height; - // Calculate border around image. + // Calculate border around image. // At least 9 pixels are needed to draw the image // Leave at least a 6 pixel border. int indent = Math.min(6, (itemHeight - 9) / 2); indent = Math.max(0, indent); - int size = Math.max (10, itemHeight - 2 * indent); + int size = Math.max (10, itemHeight - 2 * indent); size = ((size + 1) / 2) * 2; // size must be an even number int midpoint = indent + size / 2; - + Color foreground = getForeground(); Color plusMinus = getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW); Color background = getBackground(); - + /* Plus image */ PaletteData palette = new PaletteData(new RGB[]{foreground.getRGB(), background.getRGB(), plusMinus.getRGB()}); ImageData imageData = new ImageData(itemHeight, itemHeight, 4, palette); @@ -401,7 +405,7 @@ gc.drawLine(midpoint, indent + 2, midpoint, indent + size - 2); gc.drawLine(indent + 2, midpoint, indent + size - 2, midpoint); gc.dispose(); - + /* Minus image */ palette = new PaletteData(new RGB[]{foreground.getRGB(), background.getRGB(), plusMinus.getRGB()}); imageData = new ImageData(itemHeight, itemHeight, 4, palette); @@ -429,7 +433,7 @@ /** * Gets the index of an item. - * + * * <p>The widget is searched starting at 0 until an * item is found that is equal to the search item. * If no item is found, -1 is returned. Indexing @@ -498,7 +502,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.1 */ public TableTreeItem getItem (int index) { @@ -529,7 +533,7 @@ TableItem item = table.getItem(point); if (item == null) return null; return getItem(item); - + } TableTreeItem getItem(TableItem tableItem) { if (tableItem == null) return null; @@ -590,7 +594,7 @@ item.setExpanded(true); type = SWT.Expand; } - } + } if (type == 0) return; Event event = new Event(); event.item = item; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/TextChangedEvent.java swt4-gtk-4.6.0/org/eclipse/swt/custom/TextChangedEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/TextChangedEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/TextChangedEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -13,7 +13,7 @@ import org.eclipse.swt.events.*; /** - * This event is sent by the StyledTextContent implementor when a change to + * This event is sent by the StyledTextContent implementor when a change to * the text occurs. * * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> @@ -26,8 +26,8 @@ * Create the TextChangedEvent to be used by the StyledTextContent implementor. * <p> * - * @param source the object that will be sending the TextChangedEvent, - * cannot be null + * @param source the object that will be sending the TextChangedEvent, + * cannot be null */ public TextChangedEvent(StyledTextContent source) { super(source); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/TextChangeListener.java swt4-gtk-4.6.0/org/eclipse/swt/custom/TextChangeListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/TextChangeListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/TextChangeListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,24 +16,24 @@ /** * The StyledText widget implements this listener to receive * notifications when changes to the model occur. - * It is not intended to be implemented by clients or by - * implementors of StyledTextContent. - * Clients should listen to the ModifyEvent or ExtendedModifyEvent - * that is sent by the StyledText widget to receive text change + * It is not intended to be implemented by clients or by + * implementors of StyledTextContent. + * Clients should listen to the ModifyEvent or ExtendedModifyEvent + * that is sent by the StyledText widget to receive text change * notifications. * Implementors of StyledTextContent should call the textChanging - * and textChanged methods when text changes occur as described - * below. If the entire text is replaced the textSet method + * and textChanged methods when text changes occur as described + * below. If the entire text is replaced the textSet method * should be called instead. */ public interface TextChangeListener extends SWTEventListener { /** * This method is called when the content is about to be changed. - * Callers also need to call the textChanged method after the - * content change has been applied. The widget only updates the - * screen properly when it receives both events. - * + * Callers also need to call the textChanged method after the + * content change has been applied. The widget only updates the + * screen properly when it receives both events. + * * @param event the text changing event. All event fields need * to be set by the sender. * @see TextChangingEvent @@ -41,18 +41,18 @@ public void textChanging(TextChangingEvent event); /** * This method is called when the content has changed. - * Callers need to have called the textChanging method prior to - * applying the content change and calling this method. The widget + * Callers need to have called the textChanging method prior to + * applying the content change and calling this method. The widget * only updates the screen properly when it receives both events. - * + * * @param event the text changed event */ public void textChanged(TextChangedEvent event); /** - * This method is called instead of the textChanging/textChanged - * combination when the entire old content has been replaced + * This method is called instead of the textChanging/textChanged + * combination when the entire old content has been replaced * (e.g., by a call to StyledTextContent.setText()). - * + * * @param event the text changed event */ public void textSet(TextChangedEvent event); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/TextChangingEvent.java swt4-gtk-4.6.0/org/eclipse/swt/custom/TextChangingEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/TextChangingEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/TextChangingEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -47,13 +47,13 @@ public int newLineCount; static final long serialVersionUID = 3257290210114352439L; - + /** * Create the TextChangedEvent to be used by the StyledTextContent implementor. * <p> * - * @param source the object that will be sending the new TextChangingEvent, - * cannot be null + * @param source the object that will be sending the new TextChangingEvent, + * cannot be null */ public TextChangingEvent(StyledTextContent source) { super(source); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/TreeCursor.java swt4-gtk-4.6.0/org/eclipse/swt/custom/TreeCursor.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/TreeCursor.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/TreeCursor.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2012 IBM Corporation and others. + * Copyright (c) 2011, 2016 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 @@ -23,14 +23,14 @@ * <p> * For a detailed example of using a TreeCursor to navigate to a cell and then edit it see * http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet360.java . - * + * * <dl> * <dt><b>Styles:</b></dt> * <dd>BORDER</dd> * <dt><b>Events:</b></dt> * <dd>Selection, DefaultSelection</dd> * </dl> - * + * * @since 3.8 */ public class TreeCursor extends Canvas { @@ -41,7 +41,7 @@ Color background = null; Color foreground = null; - + /* By default, invert the list selection colors */ static final int BACKGROUND = SWT.COLOR_LIST_SELECTION_TEXT; static final int FOREGROUND = SWT.COLOR_LIST_SELECTION; @@ -56,10 +56,10 @@ * <code>SWT</code> style constants. The class description lists the style constants that are * applicable to the class. Style bits are also inherited from superclasses. * </p> - * + * * @param parent a Tree control which will be the parent of the new instance (cannot be null) * @param style the style of control to construct - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> * </ul> @@ -67,7 +67,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li> * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li> * </ul> - * + * * @see SWT#BORDER * @see Widget#checkSubclass() * @see Widget#getStyle() @@ -79,6 +79,7 @@ setForeground(null); listener = new Listener() { + @Override public void handleEvent(Event event) { if (row != null) { /* @@ -135,6 +136,7 @@ } treeListener = new Listener() { + @Override public void handleEvent(Event event) { switch (event.type) { case SWT.Collapse: @@ -156,8 +158,9 @@ tree.addListener(SWT.Expand, treeListener); tree.addListener(SWT.FocusIn, treeListener); tree.addListener(SWT.MouseDown, treeListener); - + disposeItemListener = new Listener() { + @Override public void handleEvent(Event event) { TreeItem currentItem = row; while (currentItem != null) { @@ -197,6 +200,7 @@ } }; disposeColumnListener = new Listener() { + @Override public void handleEvent(Event event) { if (column != null) { if (tree.getColumnCount() == 1) { @@ -222,6 +226,7 @@ } }; resizeListener = new Listener() { + @Override public void handleEvent(Event event) { _resize(); } @@ -234,7 +239,7 @@ if (vBar != null) { vBar.addListener(SWT.Selection, resizeListener); } - + getAccessible().addAccessibleControlListener(new AccessibleControlAdapter() { @Override public void getRole(AccessibleControlEvent e) { @@ -261,9 +266,9 @@ * object detail field contains the value <code>SWT.CHECK</code>. * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked. * </p> - * + * * @param listener the listener which should be notified - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> @@ -271,7 +276,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @see SelectionListener * @see SelectionEvent * @see #removeSelectionListener(SelectionListener) @@ -352,9 +357,9 @@ } else { bounds = items[end].getBounds(); } - return bounds.contains(pt) ? items[end] : null; + return bounds.contains(pt) ? items[end] : null; } - + Rectangle startBounds = items[start].getBounds(); if (startBounds.y + startBounds.height < pt.y) { return findItem(items[start].getItems(), pt); @@ -388,9 +393,9 @@ /** * Returns the index of the column over which the TreeCursor is positioned. - * + * * @return the column index for the current position - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -443,7 +448,7 @@ int index = tree.indexOf(item); if (index == -1) return null; if (index == tree.getItemCount() - 1) return null; - return tree.getItem(index + 1); + return tree.getItem(index + 1); } TreeItem getPreviousItem(TreeItem item) { @@ -470,9 +475,9 @@ /** * Returns the row over which the TreeCursor is positioned. - * + * * @return the item for the current position, or <code>null</code> if none - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -629,7 +634,7 @@ String platform = SWT.getPlatform(); if (image != null) { if ("win32".equals(platform)) { //$NON-NLS-1$ - if (orderedIndex > 0) { + if (orderedIndex > 0) { x += 2; } } else { @@ -697,9 +702,9 @@ /** * Removes the listener from the collection of listeners who will be notified when the * receiver's selection changes. - * + * * @param listener the listener which should no longer be notified - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> @@ -707,7 +712,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @see SelectionListener * @see #addSelectionListener(SelectionListener) */ @@ -738,7 +743,7 @@ * @param color the new color (or null) * * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> + * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -761,7 +766,7 @@ * @param color the new color (or null) * * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> + * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -822,10 +827,10 @@ /** * Positions the TreeCursor over the root-level cell at the given row and column in the parent tree. - * + * * @param row the index of the root-level row for the cell to select * @param column the index of column for the cell to select - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -843,10 +848,10 @@ /** * Positions the TreeCursor over the cell at the given row and column in the parent tree. - * + * * @param row the TreeItem of the row for the cell to select * @param column the index of column for the cell to select - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -883,8 +888,9 @@ } parentItem = parentItem.getParentItem(); } - + getDisplay().asyncExec(new Runnable() { + @Override public void run() { if (isDisposed()) return; setRowColumn(row, column, true); @@ -894,6 +900,7 @@ void treeExpand(Event event) { getDisplay().asyncExec(new Runnable() { + @Override public void run() { if (isDisposed()) return; setRowColumn(row, column, true); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/TreeEditor.java swt4-gtk-4.6.0/org/eclipse/swt/custom/TreeEditor.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/TreeEditor.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/TreeEditor.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -34,24 +34,24 @@ * subItem.setText("item " + i + " " + j); * } * } -* +* * final TreeEditor editor = new TreeEditor(tree); * //The editor must have the same size as the cell and must * //not be any smaller than 50 pixels. * editor.horizontalAlignment = SWT.LEFT; * editor.grabHorizontal = true; * editor.minimumWidth = 50; -* +* * tree.addSelectionListener(new SelectionAdapter() { * public void widgetSelected(SelectionEvent e) { * // Clean up any previous editor control * Control oldEditor = editor.getEditor(); * if (oldEditor != null) oldEditor.dispose(); -* +* * // Identify the selected row * TreeItem item = (TreeItem)e.item; * if (item == null) return; -* +* * // The control that will be the editor must be a child of the Tree * Text newEditor = new Text(tree, SWT.NONE); * newEditor.setText(item.getText()); @@ -71,7 +71,7 @@ * @see <a href="http://www.eclipse.org/swt/snippets/#treeeditor">TreeEditor snippets</a> * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ -public class TreeEditor extends ControlEditor { +public class TreeEditor extends ControlEditor { Tree tree; TreeItem item; int column = 0; @@ -79,7 +79,7 @@ TreeListener treeListener; Runnable timer; static final int TIMEOUT = 1500; - + /** * Creates a TreeEditor for the specified Tree. * @@ -91,20 +91,24 @@ this.tree = tree; columnListener = new ControlListener() { + @Override public void controlMoved(ControlEvent e){ layout(); } + @Override public void controlResized(ControlEvent e){ layout(); } }; timer = new Runnable () { + @Override public void run() { layout (); } }; treeListener = new TreeListener () { final Runnable runnable = new Runnable() { + @Override public void run() { if (editor == null || editor.isDisposed()) return; if (TreeEditor.this.tree.isDisposed()) return; @@ -112,11 +116,13 @@ editor.setVisible(true); } }; + @Override public void treeCollapsed(TreeEvent e) { if (editor == null || editor.isDisposed ()) return; editor.setVisible(false); e.display.asyncExec(runnable); } + @Override public void treeExpanded(TreeEvent e) { if (editor == null || editor.isDisposed ()) return; editor.setVisible(false); @@ -124,7 +130,7 @@ } }; tree.addTreeListener(treeListener); - + // To be consistent with older versions of SWT, grabVertical defaults to true grabVertical = true; } @@ -146,17 +152,17 @@ if (grabHorizontal) { if (tree.getColumnCount() == 0) { - // Bounds of tree item only include the text area - stretch out to include + // Bounds of tree item only include the text area - stretch out to include // entire client area cell.width = area.x + area.width - cell.x; } editorRect.width = Math.max(cell.width, minimumWidth); } - + if (grabVertical) { editorRect.height = Math.max(cell.height, minimumHeight); } - + if (horizontalAlignment == SWT.RIGHT) { editorRect.x += cell.width - editorRect.width; } else if (horizontalAlignment == SWT.LEFT) { @@ -166,7 +172,7 @@ } // don't let the editor overlap with the +/- of the tree editorRect.x = Math.max(cell.x, editorRect.x); - + if (verticalAlignment == SWT.BOTTOM) { editorRect.y += cell.height - editorRect.height; } else if (verticalAlignment == SWT.TOP) { @@ -236,7 +242,7 @@ /** * Sets the zero based index of the column of the cell being tracked by this editor. -* +* * @param column the zero based index of the column of the cell being tracked by this editor * * @since 3.1 @@ -256,8 +262,8 @@ this.column = -1; } - if (column < 0 || column >= tree.getColumnCount()) return; - + if (column < 0 || column >= tree.getColumnCount()) return; + this.column = column; TreeColumn treeColumn = tree.getColumn(this.column); treeColumn.addControlListener(columnListener); @@ -279,7 +285,7 @@ * * <p>Note: The Control provided as the editor <b>must</b> be created with its parent being the Tree control * specified in the TreeEditor constructor. -* +* * @param editor the Control that is displayed above the cell being edited * @param item the TreeItem for the row of the cell being tracked by this editor * @param column the zero based index of the column of the cell being tracked by this editor @@ -302,7 +308,7 @@ * * <p>Note: The Control provided as the editor <b>must</b> be created with its parent being the Tree control * specified in the TreeEditor constructor. -* +* * @param editor the Control that is displayed above the cell being edited * @param item the TreeItem for the row of the cell being tracked by this editor */ @@ -314,7 +320,7 @@ @Override public void layout () { if (tree == null || tree.isDisposed()) return; - if (item == null || item.isDisposed()) return; + if (item == null || item.isDisposed()) return; int columnCount = tree.getColumnCount(); if (columnCount == 0 && column != 0) return; if (columnCount > 0 && (column < 0 || column >= columnCount)) return; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/ViewForm.java swt4-gtk-4.6.0/org/eclipse/swt/custom/ViewForm.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/ViewForm.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/ViewForm.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -17,7 +17,7 @@ /** * Instances of this class implement a Composite that positions and sizes - * children and allows programmatic control of layout and border parameters. + * children and allows programmatic control of layout and border parameters. * ViewForm is used in the workbench to lay out a view's label/menu/toolbar * local bar. * <p> @@ -69,48 +69,48 @@ * The default value is 1. */ public int verticalSpacing = 1; - + /** * Color of innermost line of drop shadow border. - * + * * NOTE This field is badly named and can not be fixed for backwards compatibility. * It should be capitalized. - * + * * @deprecated */ @Deprecated public static RGB borderInsideRGB = new RGB (132, 130, 132); /** * Color of middle line of drop shadow border. - * + * * NOTE This field is badly named and can not be fixed for backwards compatibility. * It should be capitalized. - * + * * @deprecated */ @Deprecated public static RGB borderMiddleRGB = new RGB (143, 141, 138); /** * Color of outermost line of drop shadow border. - * + * * NOTE This field is badly named and can not be fixed for backwards compatibility. * It should be capitalized. - * + * * @deprecated */ @Deprecated public static RGB borderOutsideRGB = new RGB (171, 168, 165); - + // SWT widgets Control topLeft; Control topCenter; Control topRight; Control content; - + // Configuration and state info boolean separateTopCenter = false; boolean showBorder = false; - + int separator = -1; int borderTop = 0; int borderBottom = 0; @@ -118,10 +118,10 @@ int borderRight = 0; int highlight = 0; Point oldSize; - + Color selectionBackground; Listener listener; - + static final int OFFSCREEN = -200; static final int BORDER1_COLOR = SWT.COLOR_WIDGET_NORMAL_SHADOW; static final int SELECTION_BACKGROUND = SWT.COLOR_LIST_BACKGROUND; @@ -131,7 +131,7 @@ * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -151,14 +151,15 @@ * @see SWT#BORDER * @see SWT#FLAT * @see #getStyle() - */ + */ public ViewForm(Composite parent, int style) { super(parent, checkStyle(style)); super.setLayout(new ViewFormLayout()); - + setBorderVisible((style & SWT.BORDER) != 0); - + listener = new Listener() { + @Override public void handleEvent(Event e) { switch (e.type) { case SWT.Dispose: onDispose(e); break; @@ -167,9 +168,9 @@ } } }; - + int[] events = new int[] {SWT.Dispose, SWT.Paint, SWT.Resize}; - + for (int i = 0; i < events.length; i++) { addListener(events[i], listener); } @@ -209,7 +210,7 @@ } /** * Returns the content area. -* +* * @return the control in the content area of the pane or null */ public Control getContent() { @@ -219,7 +220,7 @@ /** * Returns Control that appears in the top center of the pane. * Typically this is a toolbar. -* +* * @return the control in the top center of the pane or null */ public Control getTopCenter() { @@ -229,7 +230,7 @@ /** * Returns the Control that appears in the top left corner of the pane. * Typically this is a label such as CLabel. -* +* * @return the control in the top left corner of the pane or null */ public Control getTopLeft() { @@ -239,7 +240,7 @@ /** * Returns the control in the top right corner of the pane. * Typically this is a Close button or a composite with a Menu and Close button. -* +* * @return the control in the top right corner of the pane or null */ public Control getTopRight() { @@ -271,7 +272,7 @@ int x2 = size.x - 1; int y2 = size.y - 1; int[] shape = new int[] {x1,y1, x2,y1, x2,y2, x1,y2, x1,y1+highlight, - x1+highlight,y1+highlight, x1+highlight,y2-highlight, + x1+highlight,y1+highlight, x1+highlight,y2-highlight, x2-highlight,y2-highlight, x2-highlight,y1+highlight, x1,y1+highlight}; Color highlightColor = getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION); gc.setBackground(highlightColor); @@ -293,16 +294,16 @@ if (oldSize.x < size.x) { width = size.x - oldSize.x + borderRight + highlight; } else if (oldSize.x > size.x) { - width = borderRight + highlight; + width = borderRight + highlight; } redraw(size.x - width, 0, width, size.y, false); - + int height = 0; if (oldSize.y < size.y) { - height = size.y - oldSize.y + borderBottom + highlight; + height = size.y - oldSize.y + borderBottom + highlight; } if (oldSize.y > size.y) { - height = borderBottom + highlight; + height = borderBottom + highlight; } redraw(0, size.y - height, size.x, height, false); } @@ -310,11 +311,11 @@ } /** * Sets the content. -* Setting the content to null will remove it from +* Setting the content to null will remove it from * the pane - however, the creator of the content must dispose of the content. -* +* * @param content the control to be displayed in the content area or null -* +* * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -362,11 +363,11 @@ /** * Set the control that appears in the top center of the pane. * Typically this is a toolbar. -* The topCenter is optional. Setting the topCenter to null will remove it from +* The topCenter is optional. Setting the topCenter to null will remove it from * the pane - however, the creator of the topCenter must dispose of the topCenter. -* +* * @param topCenter the control to be displayed in the top center or null -* +* * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -388,11 +389,11 @@ /** * Set the control that appears in the top left corner of the pane. * Typically this is a label such as CLabel. -* The topLeft is optional. Setting the top left control to null will remove it from +* The topLeft is optional. Setting the top left control to null will remove it from * the pane - however, the creator of the control must dispose of the control. -* +* * @param c the control to be displayed in the top left corner or null -* +* * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -414,11 +415,11 @@ /** * Set the control that appears in the top right corner of the pane. * Typically this is a Close button or a composite with a Menu and Close button. -* The topRight is optional. Setting the top right control to null will remove it from +* The topRight is optional. Setting the top right control to null will remove it from * the pane - however, the creator of the control must dispose of the control. -* +* * @param c the control to be displayed in the top right corner or null -* +* * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -439,9 +440,9 @@ } /** * Specify whether the border should be displayed or not. -* +* * @param show true if the border should be displayed -* +* * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -450,7 +451,7 @@ public void setBorderVisible(boolean show) { checkWidget(); if (showBorder == show) return; - + showBorder = show; if (showBorder) { borderLeft = borderTop = borderRight = borderBottom = 1; @@ -463,12 +464,12 @@ redraw(); } /** -* If true, the topCenter will always appear on a separate line by itself, otherwise the +* If true, the topCenter will always appear on a separate line by itself, otherwise the * topCenter will appear in the top row if there is room and will be moved to the second row if * required. -* +* * @param show true if the topCenter will always appear on a separate line by itself -* +* * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/custom/ViewFormLayout.java swt4-gtk-4.6.0/org/eclipse/swt/custom/ViewFormLayout.java --- swt4-gtk-4.5.0/org/eclipse/swt/custom/ViewFormLayout.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/custom/ViewFormLayout.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,7 +16,7 @@ /** * This class provides the layout for ViewForm - * + * * @see ViewForm */ class ViewFormLayout extends Layout { @@ -28,7 +28,7 @@ Control center = form.topCenter; Control right = form.topRight; Control content = form.content; - + Point leftSize = new Point(0, 0); if (left != null) { leftSize = computeChildSize(left, SWT.DEFAULT, SWT.DEFAULT, flushCache); @@ -52,7 +52,7 @@ if (center != null){ size.y += centerSize.y; if (left != null ||right != null)size.y += form.verticalSpacing; - } + } } else { size.x = leftSize.x + centerSize.x + rightSize.x; int count = -1; @@ -62,22 +62,22 @@ if (count > 0) size.x += count * form.horizontalSpacing; size.y = Math.max(leftSize.y, Math.max(centerSize.y, rightSize.y)); } - + if (content != null) { if (left != null || right != null || center != null) size.y += 1; // allow space for a vertical separator Point contentSize = new Point(0, 0); - contentSize = computeChildSize(content, SWT.DEFAULT, SWT.DEFAULT, flushCache); + contentSize = computeChildSize(content, SWT.DEFAULT, SWT.DEFAULT, flushCache); size.x = Math.max (size.x, contentSize.x); size.y += contentSize.y; if (size.y > contentSize.y) size.y += form.verticalSpacing; } - + size.x += 2*form.marginWidth; size.y += 2*form.marginHeight; - + if (wHint != SWT.DEFAULT) size.x = wHint; if (hHint != SWT.DEFAULT) size.y = hHint; - + return size; } @@ -112,9 +112,9 @@ Control center = form.topCenter; Control right = form.topRight; Control content = form.content; - + Rectangle rect = composite.getClientArea(); - + Point leftSize = new Point(0, 0); if (left != null && !left.isDisposed()) { leftSize = computeChildSize(left, SWT.DEFAULT, SWT.DEFAULT, flushCache); @@ -127,17 +127,17 @@ if (right != null && !right.isDisposed()) { rightSize = computeChildSize(right, SWT.DEFAULT, SWT.DEFAULT, flushCache); } - + int minTopWidth = leftSize.x + centerSize.x + rightSize.x + 2*form.marginWidth + 2*form.highlight; int count = -1; if (leftSize.x > 0) count++; if (centerSize.x > 0) count++; if (rightSize.x > 0) count++; if (count > 0) minTopWidth += count * form.horizontalSpacing; - + int x = rect.x + rect.width - form.marginWidth - form.highlight; int y = rect.y + form.marginHeight + form.highlight; - + boolean top = false; if (form.separateTopCenter || minTopWidth > rect.width) { int topHeight = Math.max(rightSize.y, leftSize.y); @@ -165,7 +165,7 @@ } center.setBounds(rect.x + rect.width - form.marginWidth - form.highlight - centerSize.x, y, centerSize.x, centerSize.y); y += centerSize.y + form.verticalSpacing; - } + } } else { int topHeight = Math.max(rightSize.y, Math.max(centerSize.y, leftSize.y)); if (right != null && !right.isDisposed()) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/dnd/Clipboard.java swt4-gtk-4.6.0/org/eclipse/swt/dnd/Clipboard.java --- swt4-gtk-4.5.0/org/eclipse/swt/dnd/Clipboard.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/dnd/Clipboard.java 2016-07-06 19:11:33.000000000 +0000 @@ -624,7 +624,7 @@ OS.gdk_threads_leave(); if (selection_data != 0) { try { - int length = OS.gtk_selection_data_get_length(selection_data); + int length = OS.gtk_selection_data_get_length(selection_data); int format = OS.gtk_selection_data_get_format(selection_data); int /*long*/ data = OS.gtk_selection_data_get_data(selection_data); if (length != 0) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/dnd/ClipboardProxy.java swt4-gtk-4.6.0/org/eclipse/swt/dnd/ClipboardProxy.java --- swt4-gtk-4.5.0/org/eclipse/swt/dnd/ClipboardProxy.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/dnd/ClipboardProxy.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -40,6 +40,7 @@ proxy = new ClipboardProxy(display); display.setData(ID, proxy); display.addListener(SWT.Dispose, new Listener() { + @Override public void handleEvent(Event event) { ClipboardProxy clipbordProxy = (ClipboardProxy)display.getData(ID); if (clipbordProxy == null) return; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/dnd/DND.java swt4-gtk-4.6.0/org/eclipse/swt/dnd/DND.java --- swt4-gtk-4.5.0/org/eclipse/swt/dnd/DND.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/dnd/DND.java 2016-07-06 19:11:33.000000000 +0000 @@ -10,31 +10,31 @@ *******************************************************************************/ package org.eclipse.swt.dnd; - + import org.eclipse.swt.*; /** - * Class DND contains all the constants used in defining a + * Class DND contains all the constants used in defining a * DragSource or a DropTarget. * * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public class DND { - + /** * The transfer mechanism for data that is being cut * and then pasted or copied and then pasted (value is 1). - * + * * @see Clipboard - * + * * @since 3.1 */ public final static int CLIPBOARD = 1 << 0; - + /** - * The transfer mechanism for clients that use the selection + * The transfer mechanism for clients that use the selection * mechanism (value is 2). - * + * * @see Clipboard * * @since 3.1 @@ -46,15 +46,15 @@ * (value is 0). */ public final static int DROP_NONE = 0; - + /** - * Drag and Drop Operation: a copy of the data in the drag source is + * Drag and Drop Operation: a copy of the data in the drag source is * added to the drop target (value is 1 << 0). */ public final static int DROP_COPY = 1 << 0; - + /** - * Drag and Drop Operation: a copy of the data is added to the drop target and + * Drag and Drop Operation: a copy of the data is added to the drop target and * the drag source removes the original data and any references to the data, * and updates its display (value is 1 << 1). * <p> @@ -69,80 +69,80 @@ * </p> */ public final static int DROP_MOVE = 1 << 1; - + /** - * Drag and Drop Operation: the drop target makes a link to the data in + * Drag and Drop Operation: the drop target makes a link to the data in * the drag source (value is 1 << 2). */ public final static int DROP_LINK = 1 << 2; - + /** - * Drag and Drop Operation: the drop target moves the data and the drag source removes + * Drag and Drop Operation: the drop target moves the data and the drag source removes * any references to the data and updates its display. This is not available on all platforms - * and is only used when a non-SWT application is the drop target. In this case, the SWT + * and is only used when a non-SWT application is the drop target. In this case, the SWT * drag source is informed in the dragFinished event that the drop target has moved the data. * (value is 1 << 3). - * + * * @see DragSourceListener#dragFinished */ public final static int DROP_TARGET_MOVE = 1 << 3; - + /** * Drag and Drop Operation: During a dragEnter event or a dragOperationChanged, if no modifier keys - * are pressed, the operation is set to DROP_DEFAULT. The application can choose what the default + * are pressed, the operation is set to DROP_DEFAULT. The application can choose what the default * operation should be by setting a new value in the operation field. If no value is choosen, the * default operation for the platform will be selected (value is 1 << 4). - * + * * @see DropTargetListener#dragEnter * @see DropTargetListener#dragOperationChanged - * @since 2.0 + * @since 2.0 */ public final static int DROP_DEFAULT = 1 << 4; - + /** - * DragSource Event: the drop has successfully completed or has been terminated (such as hitting + * DragSource Event: the drop has successfully completed or has been terminated (such as hitting * the ESC key); perform cleanup such as removing data on a move operation (value is 2000). */ public static final int DragEnd = 2000; - + /** * DragSource Event: the data to be dropped is required from the drag source (value is 2001). */ public static final int DragSetData = 2001; - + /** * DropTarget Event: the cursor has entered the drop target boundaries (value is 2002). */ public static final int DragEnter = 2002; - + /** * DropTarget Event: the cursor has left the drop target boundaries OR the drop - * operation has been cancelled (such as by hitting ECS) OR the drop is about to + * operation has been cancelled (such as by hitting ECS) OR the drop is about to * happen (user has released the mouse button over this target) (value is 2003). */ public static final int DragLeave = 2003; - + /** * DropTarget Event: the cursor is over the drop target (value is 2004). */ public static final int DragOver = 2004; - + /** - * DropTarget Event: the operation being performed has changed usually due to the user + * DropTarget Event: the operation being performed has changed usually due to the user * changing the selected modifier keys while dragging (value is 2005). */ public static final int DragOperationChanged = 2005; - + /** * DropTarget Event: the data has been dropped (value is 2006). */ public static final int Drop = 2006; - + /** * DropTarget Event: the drop target is given a last chance to modify the drop (value is 2007). */ public static final int DropAccept = 2007; - + /** * DragSource Event: a drag is about to begin (value is 2008). */ @@ -152,74 +152,74 @@ * DropTarget drag under effect: No effect is shown (value is 0). */ public static final int FEEDBACK_NONE = 0; - + /** * DropTarget drag under effect: The item under the cursor is selected; applies to tables * and trees (value is 1). */ public static final int FEEDBACK_SELECT = 1; - + /** - * DropTarget drag under effect: An insertion mark is shown before the item under the cursor; applies to + * DropTarget drag under effect: An insertion mark is shown before the item under the cursor; applies to * tables and trees (value is 2). */ public static final int FEEDBACK_INSERT_BEFORE = 2; - + /** * DropTarget drag under effect: An insertion mark is shown after the item under the cursor; applies to * tables and trees (value is 4). - */ + */ public static final int FEEDBACK_INSERT_AFTER = 4; - + /** - * DropTarget drag under effect: The widget is scrolled up or down to allow the user to drop on items that + * DropTarget drag under effect: The widget is scrolled up or down to allow the user to drop on items that * are not currently visible; applies to tables and trees (value is 8). - */ + */ public static final int FEEDBACK_SCROLL = 8; - + /** - * DropTarget drag under effect: The item currently under the cursor is expanded to allow the user to + * DropTarget drag under effect: The item currently under the cursor is expanded to allow the user to * select a drop target from a sub item; applies to trees (value is 16). - */ + */ public static final int FEEDBACK_EXPAND = 16; /** * Error code: drag source can not be initialized (value is 2000). */ public static final int ERROR_CANNOT_INIT_DRAG = 2000; - + /** * Error code: drop target cannot be initialized (value is 2001). */ public static final int ERROR_CANNOT_INIT_DROP = 2001; - + /** * Error code: Data can not be set on system clipboard (value is 2002). */ public static final int ERROR_CANNOT_SET_CLIPBOARD = 2002; - + /** * Error code: Data does not have correct format for type (value is 2003). * @since 3.1 */ public static final int ERROR_INVALID_DATA = 2003; - + /** - * DropTarget Key: The string constant for looking up the drop target - * for a control using <code>getData(String)</code>. When a drop target - * is created for a control, it is stored as a property in the control + * DropTarget Key: The string constant for looking up the drop target + * for a control using <code>getData(String)</code>. When a drop target + * is created for a control, it is stored as a property in the control * using <code>setData(String, Object)</code>. - * + * * @since 3.4 */ public static final String DROP_TARGET_KEY = "DropTarget"; //$NON-NLS-1$ - + /** - * DragSource Key: The string constant for looking up the drag source - * for a control using <code>getData(String)</code>. When a drag source - * is created for a control, it is stored as a property in the control + * DragSource Key: The string constant for looking up the drag source + * for a control using <code>getData(String)</code>. When a drag source + * is created for a control, it is stored as a property in the control * using <code>setData(String, Object)</code>. - * + * * @since 3.4 */ public static final String DRAG_SOURCE_KEY = "DragSource"; //$NON-NLS-1$ @@ -263,8 +263,8 @@ * @see SWTException * @see IllegalArgumentException */ -public static void error (int code, int hresult) { - switch (code) { +public static void error (int code, int hresult) { + switch (code) { /* OS Failure/Limit (fatal, may occur only on some platforms) */ case DND.ERROR_CANNOT_INIT_DRAG:{ String msg = DND.INIT_DRAG_MESSAGE; @@ -287,7 +287,7 @@ throw new SWTException (code, msg); } } - + /* Unknown/Undefined Error */ SWT.error(code); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/dnd/DNDListener.java swt4-gtk-4.6.0/org/eclipse/swt/dnd/DNDListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/dnd/DNDListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/dnd/DNDListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -116,7 +116,7 @@ event.updateEvent((DNDEvent)e); break; } - + } } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/dnd/DragSourceAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/dnd/DragSourceAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/dnd/DragSourceAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/dnd/DragSourceAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -14,7 +14,7 @@ /** * This adapter class provides default implementations for the * methods described by the <code>DragSourceListener</code> interface. - * + * * <p>Classes that wish to deal with <code>DragSourceEvent</code>s can * extend this class and override only the methods which they are * interested in.</p> @@ -28,25 +28,28 @@ /** * This implementation of <code>dragStart</code> permits the drag operation to start. * For additional information see <code>DragSourceListener.dragStart</code>. - * + * * @param event the information associated with the drag start event */ +@Override public void dragStart(DragSourceEvent event){} /** * This implementation of <code>dragFinished</code> does nothing. * For additional information see <code>DragSourceListener.dragFinished</code>. - * + * * @param event the information associated with the drag finished event */ +@Override public void dragFinished(DragSourceEvent event){} /** * This implementation of <code>dragSetData</code> does nothing. * For additional information see <code>DragSourceListener.dragSetData</code>. - * + * * @param event the information associated with the drag set data event */ +@Override public void dragSetData(DragSourceEvent event){} } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/dnd/DragSourceEffect.java swt4-gtk-4.6.0/org/eclipse/swt/dnd/DragSourceEffect.java --- swt4-gtk-4.5.0/org/eclipse/swt/dnd/DragSourceEffect.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/dnd/DragSourceEffect.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,24 +16,24 @@ /** * This class provides default implementations to display a drag source * effect during a drag and drop operation. The current implementation - * does not provide any visual feedback. - * - * <p>The drag source effect has the same API as the - * <code>DragSourceAdapter</code> so that it can provide custom visual - * feedback when a <code>DragSourceEvent</code> occurs. + * does not provide any visual feedback. + * + * <p>The drag source effect has the same API as the + * <code>DragSourceAdapter</code> so that it can provide custom visual + * feedback when a <code>DragSourceEvent</code> occurs. * </p> - * + * * <p>Classes that wish to provide their own drag source effect such as - * displaying a default source image during a drag can extend the <code>DragSourceEffect</code> - * class, override the <code>DragSourceAdapter.dragStart</code> method and set + * displaying a default source image during a drag can extend the <code>DragSourceEffect</code> + * class, override the <code>DragSourceAdapter.dragStart</code> method and set * the field <code>DragSourceEvent.image</code> with their own image. * The image should be disposed when <code>DragSourceAdapter.dragFinished</code> is called. - * </p> + * </p> * * @see DragSourceAdapter * @see DragSourceEvent * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.3 */ public class DragSourceEffect extends DragSourceAdapter { @@ -43,7 +43,7 @@ * Creates a new <code>DragSourceEffect</code> to handle drag effect from the specified <code>Control</code>. * * @param control the <code>Control</code> that the user clicks on to initiate the drag - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the control is null</li> * </ul> @@ -54,7 +54,7 @@ } /** - * Returns the Control which is registered for this DragSourceEffect. This is the control that the + * Returns the Control which is registered for this DragSourceEffect. This is the control that the * user clicks in to initiate dragging. * * @return the Control which is registered for this DragSourceEffect diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/dnd/DragSourceEvent.java swt4-gtk-4.6.0/org/eclipse/swt/dnd/DragSourceEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/dnd/DragSourceEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/dnd/DragSourceEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -15,7 +15,7 @@ /** * The DragSourceEvent contains the event information passed in the methods of the DragSourceListener. - * + * * @see DragSourceListener * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ @@ -29,70 +29,70 @@ * @see DND#DROP_TARGET_MOVE */ public int detail; - + /** - * In dragStart, the doit field determines if the drag and drop operation - * should proceed; in dragFinished, the doit field indicates whether + * In dragStart, the doit field determines if the drag and drop operation + * should proceed; in dragFinished, the doit field indicates whether * the operation was performed successfully. * <p></p> * In dragStart: * <p>Flag to determine if the drag and drop operation should proceed. - * The application can set this value to false to prevent the drag from starting. + * The application can set this value to false to prevent the drag from starting. * Set to true by default.</p> * <p>In dragSetData:</p> - * <p>This will be set to true when the call to dragSetData is made. Set it to + * <p>This will be set to true when the call to dragSetData is made. Set it to * false to cancel the drag.</p> * <p>In dragFinished:</p> - * <p>Flag to indicate if the operation was performed successfully. + * <p>Flag to indicate if the operation was performed successfully. * True if the operation was performed successfully.</p> */ public boolean doit; /** - * In dragStart, the x coordinate (relative to the control) of the + * In dragStart, the x coordinate (relative to the control) of the * position the mouse went down to start the drag. - * + * * @since 3.2 */ public int x; /** - * In dragStart, the y coordinate (relative to the control) of the + * In dragStart, the y coordinate (relative to the control) of the * position the mouse went down to start the drag. - * + * * @since 3.2 */ public int y; - + /** * The type of data requested. * Data provided in the data field must be of the same type. */ public TransferData dataType; - + /** * The drag source image to be displayed during the drag. * <p>A value of null indicates that no drag image will be displayed.</p> * <p>The default value is null.</p> - * + * * @since 3.3 */ public Image image; /** * In dragStart, the x offset (relative to the image) where the drag source image will be displayed. - * + * * @since 3.5 */ public int offsetX; /** * In dragStart, the y offset (relative to the image) where the drag source image will be displayed. - * + * * @since 3.5 */ public int offsetY; static final long serialVersionUID = 3257002142513770808L; - + /** * Constructs a new instance of this class based on the * information in the given untyped event. diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/dnd/DragSource.java swt4-gtk-4.6.0/org/eclipse/swt/dnd/DragSource.java --- swt4-gtk-4.5.0/org/eclipse/swt/dnd/DragSource.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/dnd/DragSource.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -170,6 +170,7 @@ OS.g_signal_connect(control.handle, OS.drag_data_delete, DragDataDelete.getAddress(), 0); controlListener = new Listener () { + @Override public void handleEvent (Event event) { if (event.type == SWT.Dispose) { if (!DragSource.this.isDisposed()) { @@ -196,6 +197,7 @@ } this.addListener(SWT.Dispose, new Listener() { + @Override public void handleEvent(Event e) { onDispose(); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/dnd/DragSourceListener.java swt4-gtk-4.6.0/org/eclipse/swt/dnd/DragSourceListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/dnd/DragSourceListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/dnd/DragSourceListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -19,15 +19,15 @@ * must provide the dropped data by implementing <code>dragSetData</code>. In the dragSetData, the application * must support all the data types that were specified in the DragSource#setTransfer method.</p> * - * <p>After the drop has completed successfully or has been aborted, the application which defines the - * <code>DragSource</code> is required to take the appropriate cleanup action. In the case of a successful + * <p>After the drop has completed successfully or has been aborted, the application which defines the + * <code>DragSource</code> is required to take the appropriate cleanup action. In the case of a successful * <b>move</b> operation, the application must remove the data that was transferred.</p> * */ public interface DragSourceListener extends SWTEventListener { /** - * The user has begun the actions required to drag the widget. This event gives the application + * The user has begun the actions required to drag the widget. This event gives the application * the chance to decide if a drag should be started. * * <p>The following fields in the DragSourceEvent apply: @@ -38,7 +38,7 @@ * </ul></p> * * @param event the information associated with the drag start event - * + * * @see DragSourceEvent */ public void dragStart(DragSourceEvent event); @@ -56,13 +56,13 @@ * </ul></p> * * @param event the information associated with the drag set data event - * + * * @see DragSourceEvent */ public void dragSetData(DragSourceEvent event); /** - * The drop has successfully completed(mouse up over a valid target) or has been terminated (such as hitting + * The drop has successfully completed(mouse up over a valid target) or has been terminated (such as hitting * the ESC key). Perform cleanup such as removing data from the source side on a successful move operation. * * <p>The following fields in the DragSourceEvent apply: @@ -74,7 +74,7 @@ * </ul></p> * * @param event the information associated with the drag finished event - * + * * @see DragSourceEvent */ public void dragFinished(DragSourceEvent event); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/dnd/DropTargetAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/dnd/DropTargetAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/dnd/DropTargetAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/dnd/DropTargetAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -45,6 +45,7 @@ * * @param event the information associated with the drag enter event */ +@Override public void dragEnter(DropTargetEvent event){} /** @@ -53,6 +54,7 @@ * * @param event the information associated with the drag leave event */ +@Override public void dragLeave(DropTargetEvent event){} /** @@ -63,6 +65,7 @@ * * @param event the information associated with the drag operation changed event */ +@Override public void dragOperationChanged(DropTargetEvent event){} /** @@ -73,6 +76,7 @@ * * @param event the information associated with the drag over event */ +@Override public void dragOver(DropTargetEvent event){} /** @@ -81,6 +85,7 @@ * * @param event the information associated with the drop event */ +@Override public void drop(DropTargetEvent event){} /** @@ -91,6 +96,7 @@ * * @param event the information associated with the drop accept event */ +@Override public void dropAccept(DropTargetEvent event){} } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/dnd/DropTargetEffect.java swt4-gtk-4.6.0/org/eclipse/swt/dnd/DropTargetEffect.java --- swt4-gtk-4.5.0/org/eclipse/swt/dnd/DropTargetEffect.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/dnd/DropTargetEffect.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,47 +16,47 @@ /** - * This class provides a default drag under effect during a drag and drop. + * This class provides a default drag under effect during a drag and drop. * The current implementation does not provide any visual feedback. - * - * <p>The drop target effect has the same API as the - * <code>DropTargetAdapter</code> so that it can provide custom visual - * feedback when a <code>DropTargetEvent</code> occurs. + * + * <p>The drop target effect has the same API as the + * <code>DropTargetAdapter</code> so that it can provide custom visual + * feedback when a <code>DropTargetEvent</code> occurs. * </p> - * + * * <p>Classes that wish to provide their own drag under effect - * can extend the <code>DropTargetEffect</code> and override any applicable methods + * can extend the <code>DropTargetEffect</code> and override any applicable methods * in <code>DropTargetAdapter</code> to display their own drag under effect.</p> * - * <p>The feedback value is either one of the FEEDBACK constants defined in - * class <code>DND</code> which is applicable to instances of this class, - * or it must be built by <em>bitwise OR</em>'ing together + * <p>The feedback value is either one of the FEEDBACK constants defined in + * class <code>DND</code> which is applicable to instances of this class, + * or it must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more - * of those <code>DND</code> effect constants. + * of those <code>DND</code> effect constants. * </p> * <p> * <dl> * <dt><b>Feedback:</b></dt> - * <dd>FEEDBACK_EXPAND, FEEDBACK_INSERT_AFTER, FEEDBACK_INSERT_BEFORE, + * <dd>FEEDBACK_EXPAND, FEEDBACK_INSERT_AFTER, FEEDBACK_INSERT_BEFORE, * FEEDBACK_NONE, FEEDBACK_SELECT, FEEDBACK_SCROLL</dd> * </dl> * </p> - * + * * @see DropTargetAdapter * @see DropTargetEvent * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.3 */ public class DropTargetEffect extends DropTargetAdapter { Control control; /** - * Creates a new <code>DropTargetEffect</code> to handle the drag under effect on the specified + * Creates a new <code>DropTargetEffect</code> to handle the drag under effect on the specified * <code>Control</code>. - * + * * @param control the <code>Control</code> over which the user positions the cursor to drop the data - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the control is null</li> * </ul> @@ -67,7 +67,7 @@ } /** - * Returns the Control which is registered for this DropTargetEffect. This is the control over which the + * Returns the Control which is registered for this DropTargetEffect. This is the control over which the * user positions the cursor to drop the data. * * @return the Control which is registered for this DropTargetEffect @@ -75,7 +75,7 @@ public Control getControl() { return control; } - + /** * Returns the item at the given x-y coordinate in the receiver * or null if no such item exists. The x-y coordinate is in the @@ -91,10 +91,10 @@ } if (control instanceof Tree) { return getItem((Tree) control, x, y); - } + } return null; } - + Widget getItem(Table table, int x, int y) { Point coordinates = new Point(x, y); coordinates = table.toControl(coordinates); @@ -113,7 +113,7 @@ } return null; } - + Widget getItem(Tree tree, int x, int y) { Point point = new Point(x, y); point = tree.toControl(point); @@ -135,7 +135,7 @@ } return item; } - + TreeItem nextItem(Tree tree, TreeItem item) { if (item == null) return null; if (item.getExpanded() && item.getItemCount() > 0) return item.getItem(0); @@ -152,7 +152,7 @@ count = parentItem == null ? tree.getItemCount() : parentItem.getItemCount(); } } - + TreeItem previousItem(Tree tree, TreeItem item) { if (item == null) return null; TreeItem childItem = item; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/dnd/DropTargetEvent.java swt4-gtk-4.6.0/org/eclipse/swt/dnd/DropTargetEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/dnd/DropTargetEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/dnd/DropTargetEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -23,12 +23,12 @@ * The x-cordinate of the cursor relative to the <code>Display</code> */ public int x; - + /** * The y-cordinate of the cursor relative to the <code>Display</code> */ public int y; - + /** * The operation being performed. * @see DND#DROP_NONE @@ -38,9 +38,9 @@ * @see DND#DROP_DEFAULT */ public int detail; - + /** - * A bitwise OR'ing of the operations that the DragSource can support + * A bitwise OR'ing of the operations that the DragSource can support * (e.g. DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK). * The detail value must be a member of this list or DND.DROP_NONE. * @see DND#DROP_NONE @@ -50,7 +50,7 @@ * @see DND#DROP_DEFAULT */ public int operations; - + /** * A bitwise OR'ing of the drag under effect feedback to be displayed to the user * (e.g. DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL | DND.FEEDBACK_EXPAND). @@ -65,18 +65,18 @@ * @see DND#FEEDBACK_EXPAND */ public int feedback; - + /** - * If the associated control is a table or tree, this field contains the item located + * If the associated control is a table or tree, this field contains the item located * at the cursor coordinates. */ public Widget item; - + /** * The type of data that will be dropped. */ public TransferData currentDataType; - + /** * A list of the types of data that the DragSource is capable of providing. * The currentDataType must be a member of this list. @@ -84,7 +84,7 @@ public TransferData[] dataTypes; static final long serialVersionUID = 3256727264573338678L; - + /** * Constructs a new instance of this class based on the * information in the given untyped event. diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/dnd/DropTarget.java swt4-gtk-4.6.0/org/eclipse/swt/dnd/DropTarget.java --- swt4-gtk-4.5.0/org/eclipse/swt/dnd/DropTarget.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/dnd/DropTarget.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -166,6 +166,7 @@ // Dispose listeners controlListener = new Listener(){ + @Override public void handleEvent(Event event){ if (!DropTarget.this.isDisposed()){ DropTarget.this.dispose(); @@ -175,6 +176,7 @@ control.addListener(SWT.Dispose, controlListener); this.addListener(SWT.Dispose, new Listener(){ + @Override public void handleEvent(Event event){ onDispose(); } @@ -190,6 +192,7 @@ } dragOverHeartbeat = new Runnable() { + @Override public void run() { Control control = DropTarget.this.control; if (control == null || control.isDisposed() || dragOverStart == 0) return; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/dnd/DropTargetListener.java swt4-gtk-4.6.0/org/eclipse/swt/dnd/DropTargetListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/dnd/DropTargetListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/dnd/DropTargetListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -13,28 +13,28 @@ import org.eclipse.swt.internal.SWTEventListener; /** - * The <code>DropTargetListener</code> class provides event notification to the application + * The <code>DropTargetListener</code> class provides event notification to the application * for DropTarget events. * - * <p>As the user moves the cursor into, over and out of a Control that has been designated - * as a DropTarget, events indicate what operation can be performed and what data can be + * <p>As the user moves the cursor into, over and out of a Control that has been designated + * as a DropTarget, events indicate what operation can be performed and what data can be * transferred if a drop where to occur at that point. - * The application can respond to these events and change the type of data that will - * be dropped by modifying event.currentDataType, or change the operation that will be performed + * The application can respond to these events and change the type of data that will + * be dropped by modifying event.currentDataType, or change the operation that will be performed * by modifying the event.detail field or stop any drop from happening on the current target * by setting the event.detail field to DND_DROP_NONE.</p> * - * <p>When the user causes a drop to happen by releasing the mouse over a valid drop target, - * the application has one last chance to change the data type of the drop through the - * DropAccept event. If the drop is still allowed, the DropAccept event is immediately + * <p>When the user causes a drop to happen by releasing the mouse over a valid drop target, + * the application has one last chance to change the data type of the drop through the + * DropAccept event. If the drop is still allowed, the DropAccept event is immediately * followed by the Drop event. In the Drop event, the application can still change the * operation that is performed but the data type is fixed.</p> - * + * * @see DropTargetEvent * */ public interface DropTargetListener extends SWTEventListener { - + /** * The cursor has entered the drop target boundaries. * @@ -51,34 +51,34 @@ * <li>(in,out)feedback * </ul></p> * - * <p>The <code>operations</code> value is determined by the modifier keys pressed by the user. - * If no keys are pressed the <code>event.detail</code> field is set to DND.DROP_DEFAULT. - * If the application does not set the <code>event.detail</code> to something other - * than <code>DND.DROP_DEFAULT</code> the operation will be set to the platform defined standard + * <p>The <code>operations</code> value is determined by the modifier keys pressed by the user. + * If no keys are pressed the <code>event.detail</code> field is set to DND.DROP_DEFAULT. + * If the application does not set the <code>event.detail</code> to something other + * than <code>DND.DROP_DEFAULT</code> the operation will be set to the platform defined standard * default.</p> - * - * <p>The <code>currentDataType</code> is determined by the first transfer agent specified in + * + * <p>The <code>currentDataType</code> is determined by the first transfer agent specified in * setTransfer() that matches a data type provided by the drag source.</p> - * + * * <p>It is possible to get a DragEnter event when the drag source does not provide any matching data. * In this case, the default operation is DND.DROP_NONE and the currentDataType is null.</p> - * - * <p>The application can change the operation that will be performed by modifying the - * <code>detail</code> field but the choice must be one of the values in the <code>operations</code> + * + * <p>The application can change the operation that will be performed by modifying the + * <code>detail</code> field but the choice must be one of the values in the <code>operations</code> * field or DND.DROP_NONE.</p> - * - * <p>The application can also change the type of data being requested by - * modifying the <code>currentDataTypes</code> field but the value must be one of the values + * + * <p>The application can also change the type of data being requested by + * modifying the <code>currentDataTypes</code> field but the value must be one of the values * in the <code>dataTypes</code> list.</p> * * @param event the information associated with the drag enter event - * + * * @see DropTargetEvent */ public void dragEnter(DropTargetEvent event); /** - * The cursor has left the drop target boundaries OR the drop has been cancelled OR the data + * The cursor has left the drop target boundaries OR the drop has been cancelled OR the data * is about to be dropped. * * <p>The following fields in the DropTargetEvent apply: @@ -116,24 +116,24 @@ * <li>(in,out)feedback * </ul></p> * - * <p>The <code>operations</code> value is determined by the modifier keys pressed by the user. - * If no keys are pressed the <code>event.detail</code> field is set to DND.DROP_DEFAULT. - * If the application does not set the <code>event.detail</code> to something other than + * <p>The <code>operations</code> value is determined by the modifier keys pressed by the user. + * If no keys are pressed the <code>event.detail</code> field is set to DND.DROP_DEFAULT. + * If the application does not set the <code>event.detail</code> to something other than * <code>DND.DROP_DEFAULT</code> the operation will be set to the platform defined standard default.</p> - * - * <p>The <code>currentDataType</code> value is determined by the value assigned to + * + * <p>The <code>currentDataType</code> value is determined by the value assigned to * <code>currentDataType</code> in previous dragEnter and dragOver calls.</p> - * - * <p>The application can change the operation that will be performed by modifying the - * <code>detail</code> field but the choice must be one of the values in the <code>operations</code> + * + * <p>The application can change the operation that will be performed by modifying the + * <code>detail</code> field but the choice must be one of the values in the <code>operations</code> * field.</p> - * - * <p>The application can also change the type of data being requested by modifying - * the <code>currentDataTypes</code> field but the value must be one of the values in the + * + * <p>The application can also change the type of data being requested by modifying + * the <code>currentDataTypes</code> field but the value must be one of the values in the * <code>dataTypes</code> list.</p> * * @param event the information associated with the drag operation changed event - * + * * @see DropTargetEvent */ public void dragOperationChanged(DropTargetEvent event); @@ -154,25 +154,25 @@ * <li>(in,out)feedback * </ul></p> * - * <p>The <code>operations</code> value is determined by the value assigned to + * <p>The <code>operations</code> value is determined by the value assigned to * <code>currentDataType</code> in previous dragEnter and dragOver calls.</p> - * - * <p>The <code>currentDataType</code> value is determined by the value assigned to + * + * <p>The <code>currentDataType</code> value is determined by the value assigned to * <code>currentDataType</code> in previous dragEnter and dragOver calls.</p> - * - * <p>The application can change the operation that will be performed by modifying the - * <code>detail</code> field but the choice must be one of the values in the <code>operations</code> + * + * <p>The application can change the operation that will be performed by modifying the + * <code>detail</code> field but the choice must be one of the values in the <code>operations</code> * field.</p> - * - * <p>The application can also change the type of data being requested by modifying the - * <code>currentDataTypes</code> field but the value must be one of the values in the + * + * <p>The application can also change the type of data being requested by modifying the + * <code>currentDataTypes</code> field but the value must be one of the values in the * <code>dataTypes</code> list.</p> - * - * <p>NOTE: At this point the <code>data</code> field is null. On some platforms, it is possible - * to obtain the data being transferred before the transfer occurs but in most platforms this is - * not possible. On those platforms where the data is available, the application can access the + * + * <p>NOTE: At this point the <code>data</code> field is null. On some platforms, it is possible + * to obtain the data being transferred before the transfer occurs but in most platforms this is + * not possible. On those platforms where the data is available, the application can access the * data as follows:</p> - * + * * <pre><code> * public void dragOver(DropTargetEvent event) { * TextTransfer textTransfer = TextTransfer.getInstance(); @@ -184,40 +184,40 @@ * </code></pre> * * @param event the information associated with the drag over event - * + * * @see DropTargetEvent */ public void dragOver(DropTargetEvent event); /** - * The data is being dropped. The data field contains java format of the data being dropped. - * To determine the type of the data object, refer to the documentation for the Transfer subclass + * The data is being dropped. The data field contains java format of the data being dropped. + * To determine the type of the data object, refer to the documentation for the Transfer subclass * specified in event.currentDataType. * * <p>The following fields in DropTargetEvent apply: * <ul> * <li>(in)widget * <li>(in)time - * <li>(in)x + * <li>(in)x * <li>(in)y * <li>(in,out)detail * <li>(in)currentDataType * <li>(in)data * </ul></p> * - * <p>The application can refuse to perform the drop operation by setting the detail + * <p>The application can refuse to perform the drop operation by setting the detail * field to DND.DROP_NONE.</p> * * @param event the information associated with the drop event - * + * * @see DropTargetEvent */ public void drop(DropTargetEvent event); /** - * The drop is about to be performed. + * The drop is about to be performed. * The drop target is given a last chance to change the nature of the drop. - * + * * <p>The following fields in the DropTargetEvent apply: * <ul> * <li>(in)widget @@ -230,19 +230,19 @@ * <li>(in,out)detail * </ul></p> * - * <p>The application can veto the drop by setting the <code>event.detail</code> field to + * <p>The application can veto the drop by setting the <code>event.detail</code> field to * <code>DND.DROP_NONE</code>.</p> * - * <p>The application can change the operation that will be performed by modifying the - * <code>detail</code> field but the choice must be one of the values in the + * <p>The application can change the operation that will be performed by modifying the + * <code>detail</code> field but the choice must be one of the values in the * <code>operations</code> field.</p> - * - * <p>The application can also change the type of data being requested by modifying the + * + * <p>The application can also change the type of data being requested by modifying the * <code>currentDataTypes</code> field but the value must be one of the values in the < * code>dataTypes</code> list.</p> * * @param event the information associated with the drop accept event - * + * * @see DropTargetEvent */ public void dropAccept(DropTargetEvent event); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/dnd/ImageTransfer.java swt4-gtk-4.6.0/org/eclipse/swt/dnd/ImageTransfer.java --- swt4-gtk-4.5.0/org/eclipse/swt/dnd/ImageTransfer.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/dnd/ImageTransfer.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.swt.dnd; -import org.eclipse.swt.SWT; +import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/dnd/TableDropTargetEffect.java swt4-gtk-4.6.0/org/eclipse/swt/dnd/TableDropTargetEffect.java --- swt4-gtk-4.5.0/org/eclipse/swt/dnd/TableDropTargetEffect.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/dnd/TableDropTargetEffect.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -11,6 +11,7 @@ package org.eclipse.swt.dnd; import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; import org.eclipse.swt.widgets.*; @@ -152,7 +153,7 @@ } else { if (index != -1 && scrollIndex == index && scrollBeginTime != 0) { if (System.currentTimeMillis() >= scrollBeginTime) { - if (coordinates.y < table.getItemHeight()) { + if (coordinates.y < DPIUtil.autoScaleUp(table.getItemHeight())) { OS.gtk_tree_path_prev(path[0]); } else { OS.gtk_tree_path_next(path[0]); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/ControlAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/events/ControlAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/ControlAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/ControlAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -33,6 +33,7 @@ * * @param e an event containing information about the move */ +@Override public void controlMoved(ControlEvent e) { } @@ -42,6 +43,7 @@ * * @param e an event containing information about the resize */ +@Override public void controlResized(ControlEvent e) { } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/ControlListener.java swt4-gtk-4.6.0/org/eclipse/swt/events/ControlListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/ControlListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/ControlListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,7 +16,7 @@ /** * Classes which implement this interface provide methods * that deal with the events that are generated by moving - * and resizing controls. + * and resizing controls. * <p> * After creating an instance of a class that implements * this interface it can be added to a control using the diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/DragDetectEvent.java swt4-gtk-4.6.0/org/eclipse/swt/events/DragDetectEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/DragDetectEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/DragDetectEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -18,7 +18,7 @@ * * @see DragDetectListener * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.3 */ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/DragDetectListener.java swt4-gtk-4.6.0/org/eclipse/swt/events/DragDetectListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/DragDetectListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/DragDetectListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -26,7 +26,7 @@ * </p> * * @see DragDetectEvent - * + * * @since 3.3 */ public interface DragDetectListener extends SWTEventListener { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/ExpandAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/events/ExpandAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/ExpandAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/ExpandAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -23,7 +23,7 @@ * @see ExpandListener * @see ExpandEvent * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.2 */ public abstract class ExpandAdapter implements ExpandListener { @@ -34,6 +34,7 @@ * * @param e an event containing information about the operation */ +@Override public void itemCollapsed(ExpandEvent e) { } @@ -43,6 +44,7 @@ * * @param e an event containing information about the operation */ +@Override public void itemExpanded(ExpandEvent e) { } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/ExpandEvent.java swt4-gtk-4.6.0/org/eclipse/swt/events/ExpandEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/ExpandEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/ExpandEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -19,14 +19,14 @@ * * @see ExpandListener * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.2 */ public class ExpandEvent extends SelectionEvent { - + static final long serialVersionUID = 3976735856884987356L; - + /** * Constructs a new instance of this class based on the * information in the given untyped event. diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/ExpandListener.java swt4-gtk-4.6.0/org/eclipse/swt/events/ExpandListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/ExpandListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/ExpandListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -19,16 +19,16 @@ * * <p> * After creating an instance of a class that implements - * this interface it can be added to a <code>ExpandBar</code> + * this interface it can be added to a <code>ExpandBar</code> * control using the <code>addExpandListener</code> method and - * removed using the <code>removeExpandListener</code> method. + * removed using the <code>removeExpandListener</code> method. * When a item of the <code>ExpandBar</code> is expanded or * collapsed, the appropriate method will be invoked. * </p> * * @see ExpandAdapter * @see ExpandEvent - * + * * @since 3.2 */ public interface ExpandListener extends SWTEventListener { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/FocusAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/events/FocusAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/FocusAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/FocusAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -32,6 +32,7 @@ * * @param e an event containing information about the focus change */ +@Override public void focusGained(FocusEvent e) { } @@ -41,6 +42,7 @@ * * @param e an event containing information about the focus change */ +@Override public void focusLost(FocusEvent e) { } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/GestureEvent.java swt4-gtk-4.6.0/org/eclipse/swt/events/GestureEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/GestureEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/GestureEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -27,7 +27,7 @@ /** * The state of the keyboard modifier keys and mouse masks * at the time the event was generated. - * + * * @see org.eclipse.swt.SWT#MODIFIER_MASK * @see org.eclipse.swt.SWT#BUTTON_MASK */ @@ -43,7 +43,7 @@ * <li>{@link org.eclipse.swt.SWT#GESTURE_ROTATE}</li> * <li>{@link org.eclipse.swt.SWT#GESTURE_SWIPE}</li> * </ul></p> - * + * * This field determines the <code>GestureEvent</code> fields that contain valid data. */ public int detail; @@ -52,7 +52,7 @@ * The meaning of this field is dependent on the value of the <code>detail</code> field * and the platform. It can represent either the x coordinate of the centroid of the * touches that make up the gesture, or the x coordinate of the cursor at the time the - * gesture was performed. + * gesture was performed. */ public int x; @@ -60,7 +60,7 @@ * The meaning of this field is dependent on the value of the <code>detail</code> field * and the platform. It can represent either the y coordinate of the centroid of the * touches that make up the gesture, or the y coordinate of the cursor at the time the - * gesture was performed. + * gesture was performed. */ public int y; @@ -79,11 +79,11 @@ * <p> * If <code>detail</code> is <code>GESTURE_SWIPE</code> then a positive value indicates a swipe * to the right and a negative value indicates a swipe to the left. - * + * * If <code>detail</code> is <code>GESTURE_PAN</code> then a positive value indicates a pan to * the right by this field's count of pixels and a negative value indicates a pan to the left - * by this field's count of pixels. - */ + * by this field's count of pixels. + */ public int xDirection; /** @@ -91,14 +91,14 @@ * or <code>GESTURE_PAN</code>. Both <code>xDirection</code> and <code>yDirection</code> * can be valid for an individual gesture. The meaning of this field is dependent on the value * of the <code>detail</code> field. - * + * * If <code>detail</code> is <code>GESTURE_SWIPE</code> then a positive value indicates a downward * swipe and a negative value indicates an upward swipe. - * + * * If <code>detail</code> is <code>GESTURE_PAN</code> then a positive value indicates a downward * pan by this field's count of pixels and a negative value indicates an upward pan by this - * field's count of pixels. - */ + * field's count of pixels. + */ public int yDirection; /** diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/GestureListener.java swt4-gtk-4.6.0/org/eclipse/swt/events/GestureListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/GestureListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/GestureListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -25,6 +25,10 @@ * the <code>removeGestureListener</code> method. When a * gesture is triggered, the appropriate method will be invoked. * </p> + * <p> + * <b>Warning</b>: This API is currently only implemented on Windows and Cocoa. + * SWT doesn't send Gesture or Touch events on GTK. + * </p> * * @see GestureEvent * diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/KeyAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/events/KeyAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/KeyAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/KeyAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -32,6 +32,7 @@ * * @param e an event containing information about the key press */ +@Override public void keyPressed(KeyEvent e) { } @@ -41,6 +42,7 @@ * * @param e an event containing information about the key release */ +@Override public void keyReleased(KeyEvent e) { } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/KeyEvent.java swt4-gtk-4.6.0/org/eclipse/swt/events/KeyEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/KeyEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/KeyEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -35,9 +35,9 @@ */ public class KeyEvent extends TypedEvent { - + /** - * the character represented by the key that was typed. + * the character represented by the key that was typed. * This is the final character that results after all modifiers have been * applied. For example, when the user types Ctrl+A, the character value * is 0x01. It is important that applications do not attempt to modify the @@ -45,7 +45,7 @@ * character will not be correct. */ public char character; - + /** * the key code of the key that was typed, * as defined by the key code constants in class <code>SWT</code>. @@ -53,11 +53,11 @@ * contains the unicode value of the original character. For example, * typing Ctrl+M or Return both result in the character '\r' but the * keyCode field will also contain '\r' when Return was typed. - * + * * @see org.eclipse.swt.SWT */ public int keyCode; - + /** * depending on the event, the location of key specified by the * keyCode or character. The possible values for this field are @@ -74,24 +74,24 @@ * the key code or character in the current event. It does not include * information about the location of modifiers in the state mask. * </p> - * + * * @see org.eclipse.swt.SWT#LEFT * @see org.eclipse.swt.SWT#RIGHT * @see org.eclipse.swt.SWT#KEYPAD - * + * * @since 3.6 */ public int keyLocation; - + /** * the state of the keyboard modifier keys and mouse masks * at the time the event was generated. - * + * * @see org.eclipse.swt.SWT#MODIFIER_MASK * @see org.eclipse.swt.SWT#BUTTON_MASK */ public int stateMask; - + /** * A flag indicating whether the operation should be allowed. * Setting this field to <code>false</code> will cancel the operation. @@ -99,7 +99,7 @@ public boolean doit; static final long serialVersionUID = 3256442491011412789L; - + /** * Constructs a new instance of this class based on the * information in the given untyped event. diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/MenuAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/events/MenuAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/MenuAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/MenuAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -32,6 +32,7 @@ * * @param e an event containing information about the menu operation */ +@Override public void menuHidden(MenuEvent e) { } @@ -41,6 +42,7 @@ * * @param e an event containing information about the menu operation */ +@Override public void menuShown(MenuEvent e) { } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/MenuDetectEvent.java swt4-gtk-4.6.0/org/eclipse/swt/events/MenuDetectEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/MenuDetectEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/MenuDetectEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -30,13 +30,13 @@ * at the time the context menu trigger occurred. */ public int x; - + /** * The display-relative y coordinate of the pointer * at the time the context menu trigger occurred. - */ + */ public int y; - + /** * A flag indicating whether the operation should be allowed. * Setting this field to <code>false</code> will cancel the operation. @@ -49,19 +49,19 @@ * <li>{@link org.eclipse.swt.SWT#MENU_MOUSE}</li> * <li>{@link org.eclipse.swt.SWT#MENU_KEYBOARD}</li> * </ul></p> - * + * * A field indicating whether the context menu was triggered by a * pointing device such as a mouse (indicated by <code>MENU_MOUSE</code>), * or by a focus-based device such as a keyboard (<code>MENU_KEYBOARD</code>). * If the trigger was <code>MENU_KEYBOARD</code>, then the application should * provide new display-relative x and y coordinates based on the current * selection or the current focus. - * + * * @since 3.8 */ public int detail; - - + + private static final long serialVersionUID = -3061660596590828941L; /** diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/MouseAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/events/MouseAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/MouseAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/MouseAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -15,7 +15,7 @@ * This adapter class provides default implementations for the * methods described by the <code>MouseListener</code> interface. * <p> - * Classes that wish to deal with <code>MouseEvent</code>s + * Classes that wish to deal with <code>MouseEvent</code>s * which occur as mouse buttons are pressed and released can * extend this class and override only the methods which they are * interested in. @@ -28,7 +28,7 @@ public abstract class MouseAdapter implements MouseListener { /** - * Sent when a mouse button is pressed twice within the + * Sent when a mouse button is pressed twice within the * (operating system specified) double click period. * The default behavior is to do nothing. * @@ -36,6 +36,7 @@ * * @see org.eclipse.swt.widgets.Display#getDoubleClickTime() */ +@Override public void mouseDoubleClick(MouseEvent e) { } @@ -45,6 +46,7 @@ * * @param e an event containing information about the mouse button press */ +@Override public void mouseDown(MouseEvent e) { } @@ -54,6 +56,7 @@ * * @param e an event containing information about the mouse button release */ +@Override public void mouseUp(MouseEvent e) { } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/MouseEvent.java swt4-gtk-4.6.0/org/eclipse/swt/events/MouseEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/MouseEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/MouseEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,7 +16,7 @@ /** * Instances of this class are sent whenever mouse * related actions occur. This includes mouse buttons - * being pressed and released, the mouse pointer being + * being pressed and released, the mouse pointer being * moved and the mouse pointer crossing widget boundaries. * <p> * Note: The <code>button</code> field is an integer that @@ -31,7 +31,7 @@ */ public class MouseEvent extends TypedEvent { - + /** * the button that was pressed or released; * <ul> @@ -41,39 +41,39 @@ * <li>etc.</li> */ public int button; - + /** * the state of the keyboard modifier keys and mouse masks * at the time the event was generated. - * + * * @see org.eclipse.swt.SWT#MODIFIER_MASK * @see org.eclipse.swt.SWT#BUTTON_MASK */ public int stateMask; - + /** * the widget-relative, x coordinate of the pointer * at the time the mouse button was pressed or released */ public int x; - + /** * the widget-relative, y coordinate of the pointer * at the time the mouse button was pressed or released - */ + */ public int y; - + /** * the number times the mouse has been clicked, as defined * by the operating system; 1 for the first click, 2 for the * second click and so on. - * + * * @since 3.3 */ public int count; static final long serialVersionUID = 3257288037011566898L; - + /** * Constructs a new instance of this class based on the * information in the given untyped event. diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/MouseListener.java swt4-gtk-4.6.0/org/eclipse/swt/events/MouseListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/MouseListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/MouseListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -32,7 +32,7 @@ public interface MouseListener extends SWTEventListener { /** - * Sent when a mouse button is pressed twice within the + * Sent when a mouse button is pressed twice within the * (operating system specified) double click period. * * @param e an event containing information about the mouse double click diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/MouseTrackAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/events/MouseTrackAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/MouseTrackAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/MouseTrackAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -34,6 +34,7 @@ * * @param e an event containing information about the mouse enter */ +@Override public void mouseEnter(MouseEvent e) { } @@ -44,6 +45,7 @@ * * @param e an event containing information about the mouse exit */ +@Override public void mouseExit(MouseEvent e) { } @@ -55,6 +57,7 @@ * * @param e an event containing information about the hover */ +@Override public void mouseHover(MouseEvent e) { } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/MouseWheelListener.java swt4-gtk-4.6.0/org/eclipse/swt/events/MouseWheelListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/MouseWheelListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/MouseWheelListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -37,5 +37,5 @@ * * @param e an event containing information about the mouse wheel action */ -public void mouseScrolled (MouseEvent e); +public void mouseScrolled (MouseEvent e); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/PaintEvent.java swt4-gtk-4.6.0/org/eclipse/swt/events/PaintEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/PaintEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/PaintEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -23,7 +23,7 @@ */ public final class PaintEvent extends TypedEvent { - + /** * the graphics context to use when painting * that is configured to use the colors, font and @@ -31,27 +31,27 @@ * only during the paint and must not be disposed */ public GC gc; - + /** - * the x offset of the bounding rectangle of the + * the x offset of the bounding rectangle of the * region that requires painting */ public int x; - + /** - * the y offset of the bounding rectangle of the + * the y offset of the bounding rectangle of the * region that requires painting */ public int y; - + /** - * the width of the bounding rectangle of the + * the width of the bounding rectangle of the * region that requires painting */ public int width; - + /** - * the height of the bounding rectangle of the + * the height of the bounding rectangle of the * region that requires painting */ public int height; @@ -64,7 +64,7 @@ public int count; static final long serialVersionUID = 3256446919205992497L; - + /** * Constructs a new instance of this class based on the * information in the given untyped event. diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/PaintListener.java swt4-gtk-4.6.0/org/eclipse/swt/events/PaintListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/PaintListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/PaintListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,7 +16,7 @@ /** * Classes which implement this interface provide methods * that deal with the events that are generated when the - * control needs to be painted. + * control needs to be painted. * <p> * After creating an instance of a class that implements * this interface it can be added to a control using the diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/SegmentEvent.java swt4-gtk-4.6.0/org/eclipse/swt/events/SegmentEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/SegmentEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/SegmentEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -25,7 +25,7 @@ * <li>elements must be in ascending order and must not have duplicates * <li>elements must not exceed the text length * </ul> - * In addition, the first element may be set to zero and the last element may + * In addition, the first element may be set to zero and the last element may * be set to the end of the line but this is not required. * * The segments field may be left null if the entire text content doesn't @@ -34,30 +34,30 @@ * A SegmentListener may be used when adjacent segments of right-to-left text * should not be reordered relative to each other. For example, within a Java * editor, you may wish multiple right-to-left string literals to be reordered - * differently than the bidi algorithm specifies. + * differently than the bidi algorithm specifies. * * Example: * <pre> * stored text = "R1R2R3" + "R4R5R6" * R1 to R6 are right-to-left characters. The quotation marks * are part of the text. The text is 13 characters long. - * - * segments = null: - * entire text content will be reordered and thus the two R2L segments - * swapped (as per the bidi algorithm). + * + * segments = null: + * entire text content will be reordered and thus the two R2L segments + * swapped (as per the bidi algorithm). * visual display (rendered on screen) = "R6R5R4" + "R3R2R1" - * - * segments = [0, 5, 8] - * "R1R2R3" will be reordered, followed by [blank]+[blank] and - * "R4R5R6". + * + * segments = [0, 5, 8] + * "R1R2R3" will be reordered, followed by [blank]+[blank] and + * "R4R5R6". * visual display = "R3R2R1" + "R6R5R4" * </pre> - * + * * <p> * The segments and segmentsChars fields can be used together to obtain different * types of bidi reordering and text display. The application can use these two fields * to insert Unicode Control Characters in specific offsets in the text, the character - * at segmentsChars[i] is inserted at the offset specified by segments[i]. When both fields + * at segmentsChars[i] is inserted at the offset specified by segments[i]. When both fields * are set, the rules for the segments field are less restrictive: * <ul> * <li>elements must be in ascending order, duplicates are allowed @@ -70,14 +70,14 @@ public class SegmentEvent extends TypedEvent { - /** - * The start offset of the <code>lineText</code> relative to text (always zero for single line widget) + /** + * The start offset of the <code>lineText</code> relative to text (always zero for single line widget) */ public int lineOffset; - - /** - * Text used to calculate the segments - */ + + /** + * Text used to calculate the segments + */ public String lineText; /** @@ -91,7 +91,7 @@ public char[] segmentsChars; static final long serialVersionUID = -2414889726745247762L; - + public SegmentEvent(Event e) { super(e); lineText = e.text; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/SegmentListener.java swt4-gtk-4.6.0/org/eclipse/swt/events/SegmentListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/SegmentListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/SegmentListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -22,7 +22,7 @@ public interface SegmentListener extends SWTEventListener { /** - * This method is called when text content is being modified. + * This method is called when text content is being modified. * <p> * The following event fields are used:<ul> * <li>event.lineText text content (input)</li> diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/SelectionAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/events/SelectionAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/SelectionAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/SelectionAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -32,6 +32,7 @@ * * @param e an event containing information about the selection */ +@Override public void widgetSelected(SelectionEvent e) { } @@ -41,6 +42,7 @@ * * @param e an event containing information about the default selection */ +@Override public void widgetDefaultSelected(SelectionEvent e) { } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/SelectionEvent.java swt4-gtk-4.6.0/org/eclipse/swt/events/SelectionEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/SelectionEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/SelectionEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -25,15 +25,15 @@ */ public class SelectionEvent extends TypedEvent { - + /** * The item that was selected. */ public Widget item; - + /** * Extra detail information about the selection, depending on the widget. - * + * * <p><b>Sash</b><ul> * <li>{@link org.eclipse.swt.SWT#DRAG}</li> * </ul></p><p><b>ScrollBar and Slider</b><ul> @@ -58,25 +58,33 @@ * The x location of the selected area. */ public int x; - + /** * The y location of selected area. */ public int y; - + /** * The width of selected area. */ public int width; - + /** * The height of selected area. */ public int height; /** - * The state of the keyboard modifier keys at the time - * the event was generated. + * The state of the keyboard modifier keys and mouse masks + * at the time the event was generated. + * <p> + * <b>Note:</b> Mouse button states are currently not included consistently + * for all widgets on all platforms. Clients should be prepared to receive + * button states, but should not rely on getting them everywhere. + * </p> + * + * @see org.eclipse.swt.SWT#MODIFIER_MASK + * @see org.eclipse.swt.SWT#BUTTON_MASK */ public int stateMask; @@ -84,21 +92,21 @@ * The text of the hyperlink that was selected. * This will be either the text of the hyperlink or the value of its HREF, * if one was specified. - * + * * @see org.eclipse.swt.widgets.Link#setText(String) * @since 3.1 */ public String text; - + /** * A flag indicating whether the operation should be allowed. * Setting this field to <code>false</code> will cancel the * operation, depending on the widget. */ public boolean doit; - + static final long serialVersionUID = 3976735856884987953L; - + /** * Constructs a new instance of this class based on the * information in the given untyped event. diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/ShellAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/events/ShellAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/ShellAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/ShellAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -32,6 +32,7 @@ * * @param e an event containing information about the activation */ +@Override public void shellActivated(ShellEvent e) { } @@ -41,6 +42,7 @@ * * @param e an event containing information about the close */ +@Override public void shellClosed(ShellEvent e) { } @@ -50,6 +52,7 @@ * * @param e an event containing information about the deactivation */ +@Override public void shellDeactivated(ShellEvent e) { } @@ -59,6 +62,7 @@ * * @param e an event containing information about the un-minimization */ +@Override public void shellDeiconified(ShellEvent e) { } @@ -68,6 +72,7 @@ * * @param e an event containing information about the minimization */ +@Override public void shellIconified(ShellEvent e) { } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/ShellEvent.java swt4-gtk-4.6.0/org/eclipse/swt/events/ShellEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/ShellEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/ShellEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -28,9 +28,9 @@ * Setting this field to <code>false</code> will cancel the operation. */ public boolean doit; - + static final long serialVersionUID = 3257569490479888441L; - + /** * Constructs a new instance of this class based on the * information in the given untyped event. diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/TouchEvent.java swt4-gtk-4.6.0/org/eclipse/swt/events/TouchEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/TouchEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/TouchEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -19,7 +19,7 @@ * * @see TouchListener * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.7 */ public class TouchEvent extends TypedEvent { @@ -27,15 +27,15 @@ /** * The set of touches representing the state of all contacts with touch input * device at the time the event was generated. - * + * * @see org.eclipse.swt.widgets.Touch */ public Touch[] touches; /** - * The state of the keyboard modifier keys and mouse masks + * The state of the keyboard modifier keys and mouse masks * at the time the event was generated. - * + * * @see org.eclipse.swt.SWT#MODIFIER_MASK * @see org.eclipse.swt.SWT#BUTTON_MASK */ @@ -50,11 +50,11 @@ /** * The widget-relative y coordinate of the pointer * at the time the touch occurred. - */ + */ public int y; static final long serialVersionUID = -8348741538373572182L; - + /** * Constructs a new instance of this class based on the * information in the given untyped event. diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/TouchListener.java swt4-gtk-4.6.0/org/eclipse/swt/events/TouchListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/TouchListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/TouchListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -25,9 +25,13 @@ * touch occurs or changes state, the <code>touch</code> method * will be invoked. * </p> + * <p> + * <b>Warning</b>: This API is currently only implemented on Windows and Cocoa. + * SWT doesn't send Gesture or Touch events on GTK. + * </p> * * @see TouchEvent - * + * * @since 3.7 */ public interface TouchListener extends SWTEventListener { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/TraverseEvent.java swt4-gtk-4.6.0/org/eclipse/swt/events/TraverseEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/TraverseEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/TraverseEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -73,13 +73,13 @@ * Note: A widget implementor will typically implement traversal using * only the doit flag to either enable or disable system traversal. * </p> - * + * * @see TraverseListener * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public final class TraverseEvent extends KeyEvent { - + /** * The traversal type. * <p><ul> @@ -94,11 +94,11 @@ * <li>{@link org.eclipse.swt.SWT#TRAVERSE_PAGE_NEXT}</li> * <li>{@link org.eclipse.swt.SWT#TRAVERSE_PAGE_PREVIOUS}</li> * </ul></p> - * + * * Setting this field will change the type of traversal. * For example, setting the detail to <code>TRAVERSE_NONE</code> * causes no traversal action to be taken. - * + * * When used in conjunction with the <code>doit</code> field, the * traversal detail field can be useful when overriding the default * traversal mechanism for a control. For example, setting the doit @@ -108,9 +108,9 @@ * described by the detail field is to be performed. */ public int detail; - + static final long serialVersionUID = 3257565105301239349L; - + /** * Constructs a new instance of this class based on the * information in the given untyped event. diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/TreeAdapter.java swt4-gtk-4.6.0/org/eclipse/swt/events/TreeAdapter.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/TreeAdapter.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/TreeAdapter.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -32,6 +32,7 @@ * * @param e an event containing information about the tree operation */ +@Override public void treeCollapsed(TreeEvent e) { } @@ -41,6 +42,7 @@ * * @param e an event containing information about the tree operation */ +@Override public void treeExpanded(TreeEvent e) { } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/TypedEvent.java swt4-gtk-4.6.0/org/eclipse/swt/events/TypedEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/TypedEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/TypedEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -23,35 +23,35 @@ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public class TypedEvent extends SWTEventObject { - + /** * the display where the event occurred - * - * @since 2.0 - */ + * + * @since 2.0 + */ public Display display; - + /** * the widget that issued the event */ public Widget widget; - + /** * the time that the event occurred. - * + * * NOTE: This field is an unsigned integer and should * be AND'ed with 0xFFFFFFFFL so that it can be treated * as a signed long. - */ + */ public int time; - + /** * a field for application use */ public Object data; static final long serialVersionUID = 3257285846578377524L; - + /** * Constructs a new instance of this class. * diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/events/VerifyEvent.java swt4-gtk-4.6.0/org/eclipse/swt/events/VerifyEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/events/VerifyEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/events/VerifyEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -22,13 +22,13 @@ */ public final class VerifyEvent extends KeyEvent { - + /** * the range of text being modified. * Setting these fields has no effect. */ public int start, end; - + /** * the new text that will be inserted. * Setting this field will change the text that is about to @@ -37,7 +37,7 @@ public String text; static final long serialVersionUID = 3257003246269577014L; - + /** * Constructs a new instance of this class based on the * information in the given untyped event. diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/Color.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/Color.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/Color.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/Color.java 2016-07-06 19:11:33.000000000 +0000 @@ -18,7 +18,7 @@ * Instances of this class manage the operating system resources that * implement SWT's RGB color model. To create a color you can either * specify the individual color components as integers in the range - * 0 to 255 or provide an instance of an <code>RGB</code> or <code>RGBA</code>. + * 0 to 255 or provide an instance of an <code>RGB</code> or <code>RGBA</code>. * <p> * Application code must explicitly invoke the <code>Color.dispose()</code> * method to release the operating system resources managed by each instance @@ -82,16 +82,16 @@ init(); } -/** +/** * Constructs a new instance of this class given a device and the * desired red, green, blue & alpha values expressed as ints in the range * 0 to 255 (where 0 is black and 255 is full brightness). On limited * color devices, the color instance created by this call may not have * the same RGB values as the ones specified by the arguments. The - * RGB values on the returned instance will be the color values of + * RGB values on the returned instance will be the color values of * the operating system color. * <p> - * You must dispose the color when it is no longer required. + * You must dispose the color when it is no longer required. * </p> * * @param device the device on which to allocate the color @@ -143,7 +143,7 @@ init(); } -/** +/** * Constructs a new instance of this class given a device and an * <code>RGBA</code> describing the desired red, green, blue & alpha values. * On limited color devices, the color instance created by this call @@ -151,7 +151,7 @@ * argument. The RGBA values on the returned instance will be the color * values of the operating system color + alpha. * <p> - * You must dispose the color when it is no longer required. + * You must dispose the color when it is no longer required. * </p> * * @param device the device on which to allocate the color @@ -173,16 +173,16 @@ init(); } -/** +/** * Constructs a new instance of this class given a device, an * <code>RGB</code> describing the desired red, green and blue values, - * alpha specifying the level of transparency. + * alpha specifying the level of transparency. * On limited color devices, the color instance created by this call * may not have the same RGB values as the ones specified by the * argument. The RGB values on the returned instance will be the color * values of the operating system color. * <p> - * You must dispose the color when it is no longer required. + * You must dispose the color when it is no longer required. * </p> * * @param device the device on which to allocate the color @@ -364,7 +364,7 @@ return gtk_new(device, gdkColor, 255); } -/** +/** * Invokes platform specific functionality to allocate a new color. * <p> * <b>IMPORTANT:</b> This method is <em>not</em> part of the public @@ -377,7 +377,7 @@ * @param device the device on which to allocate the color * @param gdkColor the handle for the color * @param alpha the int for the alpha content in the color(Currently SWT honors extreme values for alpha ie. 0 or 255) - * + * * @noreference This method is not intended to be referenced by clients. */ public static Color gtk_new(Device device, GdkColor gdkColor, int alpha) { @@ -388,7 +388,7 @@ } /** - * Allocates the operating system resources associated + * Allocates the operating system resources associated * with the receiver. * * @param device the device on which to allocate the color @@ -415,7 +415,7 @@ gdkColor.green = (short)((green & 0xFF) | ((green & 0xFF) << 8)); gdkColor.blue = (short)((blue & 0xFF) | ((blue & 0xFF) << 8)); this.alpha = alpha; - + if (!OS.GTK3) { int /*long*/ colormap = OS.gdk_colormap_get_system(); if (!OS.gdk_colormap_alloc_color(colormap, gdkColor, true, true)) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/Cursor.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/Cursor.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/Cursor.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/Cursor.java 2016-07-06 19:11:33.000000000 +0000 @@ -168,7 +168,7 @@ System.arraycopy(APPSTARTING_MASK, 0, mask, 0, mask.length); handle = createCursor(src, mask, 32, 32, 2, 2, true); } else { - handle = OS.gdk_cursor_new(shape); + handle = OS.gdk_cursor_new_for_display (OS.gdk_display_get_default(), shape); } if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES); init(); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/DeviceData.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/DeviceData.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/DeviceData.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/DeviceData.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,7 +16,7 @@ * This field is platform dependent. * <p> * <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT - * public API. It is marked protected only so that it can be shared + * public API. It is marked public only so that it can be shared * within the packages provided by SWT. It is not available on all * platforms and should never be accessed from application code. * </p> @@ -29,7 +29,7 @@ * This field is platform dependent. * <p> * <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT - * public API. It is marked protected only so that it can be shared + * public API. It is marked public only so that it can be shared * within the packages provided by SWT. It is not available on all * platforms and should never be accessed from application code. * </p> @@ -42,7 +42,7 @@ * This field is platform dependent. * <p> * <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT - * public API. It is marked protected only so that it can be shared + * public API. It is marked public only so that it can be shared * within the packages provided by SWT. It is not available on all * platforms and should never be accessed from application code. * </p> diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/Device.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/Device.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/Device.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/Device.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -25,6 +25,17 @@ */ public abstract class Device implements Drawable { /** + * @noreference This field is not intended to be referenced by clients. + * @since 3.105 + */ + protected static final int CHANGE_SCALEFACTOR = 1; + /* Settings callbacks */ + int /*long*/ gsettingsProc; + Callback gsettingsCallback; + boolean isConnected = false; + int /*long*/ displaySettings; //gsettings Dictionary + + /** * the handle to the X Display * (Warning: This field is platform dependent) * <p> @@ -82,6 +93,13 @@ /* Device dpi */ Point dpi; + /*Device Scale Factor in percentage*/ + /** + * @noreference This field is not intended to be referenced by clients. + * @since 3.105 + */ + protected int scaleFactor; + int /*long*/ emptyTab; boolean useXRender; @@ -316,6 +334,10 @@ */ public Rectangle getBounds () { checkDevice (); + return DPIUtil.autoScaleDown (getBoundsInPixels ()); +} + +private Rectangle getBoundsInPixels () { return new Rectangle(0, 0, 0, 0); } @@ -374,7 +396,6 @@ * @see #getBounds */ public Rectangle getClientArea () { - checkDevice (); return getBounds (); } @@ -446,7 +467,7 @@ byte[] buffer = new byte[length]; OS.memmove(buffer, familyName, length); String name = new String(Converter.mbcsToWcs(null, buffer)); - match = Compatibility.equalsIgnoreCase(faceName, name); + match = faceName.equalsIgnoreCase(name); } if (match) { OS.pango_font_family_list_faces(family[0], faces, n_faces); @@ -579,6 +600,8 @@ */ protected void init () { this.dpi = getDPI(); + this.scaleFactor = getDeviceZoom (); + DPIUtil.setDeviceZoom (scaleFactor); if (xDisplay != 0 && !OS.USE_CAIRO) { int[] event_basep = new int[1], error_basep = new int [1]; @@ -676,6 +699,41 @@ OS.pango_font_description_set_size(defaultFont, size * dpi.y / screenDPI.y); } systemFont = Font.gtk_new (this, defaultFont); + + /* Load certain CSS globally to save native GTK calls */ + if (OS.GTK3) { + int /*long*/ screen = OS.gdk_screen_get_default(); + int /*long*/ provider = OS.gtk_css_provider_new(); + String css = ""; + if (screen != 0 && provider != 0) { + if (OS.GTK_VERSION < OS.VERSION(3, 20, 0)) { + css = + "GtkToolbar {padding-top: 4px; padding-bottom: 4px;}\n" + + "GtkToolbar GtkButton {padding: 4px 4px 4px 4px;}\n" + + ".undershoot.top, .undershoot.right, .undershoot.bottom, .undershoot.left {background-image: none;}\n" + + "GtkToolbar GtkMenuButton {padding: 1px 0px 1px 0px;}\n"; + } else { + css = + "toolbar {padding-top: 2px; padding-bottom: 2px;}\n" + + "toolbar button {padding: 2px;}" + + "toolbar button.popup {padding: 0px;}\n" + + "toolbar toolbutton button {padding: 0px 0px 0px 0px;}" + + "scrolledwindow undershoot.top, scrolledwindow undershoot.right, scrolledwindow undershoot.bottom, " + + "scrolledwindow undershoot.left {background-image: none;}\n"; + /* + * Feature in GTK3.20: Entries have increased minimum heights + * causing them to be larger than usual. The fix is to + * adjust the minimum height to make them more like GTK3.18 + * and below. + */ + css += "entry {min-height: 26px;}"; + } + if (css != null) { + OS.gtk_style_context_add_provider_for_screen (screen, provider, OS.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + OS.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (null, css, true), -1, null); + } + } + } } /** @@ -693,6 +751,7 @@ * * @noreference This method is not intended to be referenced by clients. */ +@Override public abstract int /*long*/ internal_new_GC (GCData data); /** @@ -710,6 +769,7 @@ * * @noreference This method is not intended to be referenced by clients. */ +@Override public abstract void internal_dispose_GC (int /*long*/ hDC, GCData data); /** @@ -881,6 +941,14 @@ handler_ids = null; log_domains = null; logProc = 0; } + /* Dispose the settings callback */ + if (gsettingsCallback != null) { + gsettingsCallback.dispose(); + gsettingsCallback = null; + } + gsettingsProc = 0; + + } /** @@ -962,13 +1030,39 @@ * @return the horizontal DPI */ int _getDPIx () { + return scaleFactor * 96/100; +} +/** + * Gets the scaling factor from the device and calculates the zoom level. + * @return zoom in percentage + * + * @noreference This method is not intended to be referenced by clients. + * @nooverride This method is not intended to be re-implemented or extended by clients. + * @since 3.105 + */ +protected int getDeviceZoom() { int /*long*/ screen = OS.gdk_screen_get_default(); - int monitor = OS.gdk_screen_get_monitor_at_point(screen, 0, 0); - - GdkRectangle dest = new GdkRectangle (); - OS.gdk_screen_get_monitor_geometry(screen, monitor, dest); - int widthMM = OS.gdk_screen_get_monitor_width_mm(screen, monitor); - return Compatibility.round (254 * dest.width, widthMM * 10); + int dpi = (int) OS.gdk_screen_get_resolution (screen); + if (dpi <= 0) dpi = 96; // gdk_screen_get_resolution returns -1 in case of error + if (OS.GTK_VERSION > OS.VERSION(3, 9, 0)) { + int monitor_num = OS.gdk_screen_get_monitor_at_point (screen, 0, 0); + int scale = OS.gdk_screen_get_monitor_scale_factor (screen, monitor_num); + dpi = dpi * scale; + } + return DPIUtil.mapDPIToZoom (dpi); +} +/** + * @noreference This method is not intended to be referenced by clients. + * @nooverride This method is not intended to be re-implemented or extended by clients. + * @since 3.105 + */ +protected int /*long*/ gsettingsProc (int /*long*/ gobject, int /*long*/ arg1, int /*long*/ user_data) { + switch((int)/*64*/user_data) { + case CHANGE_SCALEFACTOR: + this.scaleFactor = getDeviceZoom (); + DPIUtil.setDeviceZoom (scaleFactor); + } + return 0; } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/DPIUtil.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/DPIUtil.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/DPIUtil.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/DPIUtil.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 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.graphics; - -import org.eclipse.swt.*; - -/** - * This class hold common constants and utility functions w.r.t. to SWT high DPI - * functionality. - * - * @since 3.104 - */ -class DPIUtil { - - /* DPI Constants */ - static final int DPI_ZOOM_200 = 192; - static final int DPI_ZOOM_150 = 144; - - /** - * Compute the zoom value based on the DPI value. - * - * @return zoom - */ - static int mapDPIToZoom (int dpi) { - int zoom; - if (dpi >= DPI_ZOOM_200) { - zoom = 200; - } else if (dpi >= DPI_ZOOM_150) { - zoom = 150; - } else { - zoom = 100; - } - return zoom; - } - - /** - * Gets Image file path at specified zoom level, if image is missing then - * fall-back to 100% image. If provider or fall-back image is not available, - * throw error. - */ - static String validateAndGetImagePathAtZoom (ImageFileNameProvider provider, int zoom, boolean[] found) { - if (provider == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - String filename = provider.getImagePath (zoom); - found [0] = (filename != null); - /* If image is null when (zoom != 100%), fall-back to image at 100% zoom */ - if (zoom != 100 && !found [0]) filename = provider.getImagePath (100); - if (filename == null) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - return filename; - } - - /** - * Gets Image data at specified zoom level, if image is missing then - * fall-back to 100% image. If provider or fall-back image is not available, - * throw error. - */ - static ImageData validateAndGetImageDataAtZoom (ImageDataProvider provider, int zoom, boolean[] found) { - if (provider == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - ImageData data = provider.getImageData (zoom); - found [0] = (data != null); - /* If image is null when (zoom != 100%), fall-back to image at 100% zoom */ - if (zoom != 100 && !found [0]) data = provider.getImageData (100); - if (data == null) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - return data; - } -} diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/Drawable.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/Drawable.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/Drawable.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/Drawable.java 2016-07-06 19:11:33.000000000 +0000 @@ -22,14 +22,14 @@ * within the packages provided by SWT. It should never be * referenced from application code. * </p> - * + * * @see Device * @see Image * @see GC */ public interface Drawable { -/** +/** * Invokes platform specific functionality to allocate a new GC handle. * <p> * <b>IMPORTANT:</b> This method is <em>not</em> part of the public @@ -39,15 +39,15 @@ * application code. * </p> * - * @param data the platform specific GC data + * @param data the platform specific GC data * @return the platform specific GC handle - * + * * @noreference This method is not intended to be referenced by clients. */ - + public int /*long*/ internal_new_GC (GCData data); -/** +/** * Invokes platform specific functionality to dispose a GC handle. * <p> * <b>IMPORTANT:</b> This method is <em>not</em> part of the public @@ -58,8 +58,8 @@ * </p> * * @param handle the platform specific GC handle - * @param data the platform specific GC data - * + * @param data the platform specific GC data + * * @noreference This method is not intended to be referenced by clients. */ public void internal_dispose_GC (int /*long*/ handle, GCData data); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/Font.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/Font.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/Font.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/Font.java 2016-07-06 19:11:33.000000000 +0000 @@ -67,7 +67,7 @@ * @exception SWTError <ul> * <li>ERROR_NO_HANDLES - if a font could not be created from the given font data</li> * </ul> - * + * * @see #dispose() */ public Font(Device device, FontData fd) { @@ -97,9 +97,9 @@ * @exception SWTError <ul> * <li>ERROR_NO_HANDLES - if a font could not be created from the given font data</li> * </ul> - * + * * @see #dispose() - * + * * @since 2.1 */ public Font(Device device, FontData[] fds) { @@ -135,7 +135,7 @@ * @exception SWTError <ul> * <li>ERROR_NO_HANDLES - if a font could not be created from the given arguments</li> * </ul> - * + * * @see #dispose() */ public Font(Device device, String name, int height, int style) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/FontMetrics.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/FontMetrics.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/FontMetrics.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/FontMetrics.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.swt.graphics; - /** * Instances of this class provide measurement information * about fonts including ascent, descent, height, leading @@ -22,7 +21,7 @@ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public final class FontMetrics { - int ascent, descent, averageCharWidth, leading, height; + int ascentInPoints, descentInPoints, averageCharWidthInPoints; FontMetrics() { } @@ -42,9 +41,8 @@ if (object == this) return true; if (!(object instanceof FontMetrics)) return false; FontMetrics metrics = (FontMetrics)object; - return ascent == metrics.ascent && descent == metrics.descent && - averageCharWidth == metrics.averageCharWidth && leading == metrics.leading && - height == metrics.height; + return ascentInPoints == metrics.ascentInPoints && descentInPoints == metrics.descentInPoints && + averageCharWidthInPoints == metrics.averageCharWidthInPoints; } /** @@ -56,7 +54,7 @@ * @return the ascent of the font */ public int getAscent() { - return ascent; + return ascentInPoints; } /** @@ -66,7 +64,7 @@ * @return the average character width of the font */ public int getAverageCharWidth() { - return averageCharWidth; + return averageCharWidthInPoints; } /** @@ -78,7 +76,7 @@ * @return the descent of the font */ public int getDescent() { - return descent; + return descentInPoints; } /** @@ -93,7 +91,7 @@ * @see #getLeading */ public int getHeight() { - return height; + return ascentInPoints + descentInPoints; } /** @@ -104,16 +102,26 @@ * @return the leading space of the font */ public int getLeading() { - return leading; + return 0; // Pango has no concept of "leading" } -public static FontMetrics gtk_new(int ascent, int descent, int averageCharWidth, int leading, int height) { +/** + * Invokes platform specific functionality to allocate a new font metrics. + * <p> + * <b>IMPORTANT:</b> This method is <em>not</em> part of the public + * API for <code>FontMetrics</code>. It is marked public only so that + * it can be shared within the packages provided by SWT. It is not + * available on all platforms, and should never be called from + * application code. + * </p> + * + * @noreference This method is not intended to be referenced by clients. + */ +public static FontMetrics gtk_new(int ascentInPoints, int descentInPoints, int averageCharWidthInPoints) { FontMetrics fontMetrics = new FontMetrics(); - fontMetrics.ascent = ascent; - fontMetrics.descent = descent; - fontMetrics.averageCharWidth = averageCharWidth; - fontMetrics.leading = leading; - fontMetrics.height = height; + fontMetrics.ascentInPoints = ascentInPoints; + fontMetrics.descentInPoints = descentInPoints; + fontMetrics.averageCharWidthInPoints = averageCharWidthInPoints; return fontMetrics; } @@ -129,7 +137,7 @@ */ @Override public int hashCode() { - return ascent ^ descent ^ averageCharWidth ^ leading ^ height; + return ascentInPoints ^ descentInPoints ^ averageCharWidthInPoints; } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/GC.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/GC.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/GC.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/GC.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -15,6 +15,7 @@ import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.cairo.*; import org.eclipse.swt.internal.gtk.*; +import org.eclipse.swt.widgets.*; /** * Class <code>GC</code> is where all of the drawing capabilities that are @@ -297,7 +298,7 @@ Cairo.cairo_set_line_join(cairo, join_style); } if ((state & LINE_WIDTH) != 0) { - Cairo.cairo_set_line_width(cairo, data.lineWidth == 0 ? 1 : data.lineWidth); + Cairo.cairo_set_line_width(cairo, data.lineWidth == 0 ? DPIUtil.autoScaleUp(1) : data.lineWidth); switch (data.lineStyle) { case SWT.LINE_DOT: case SWT.LINE_DASH: @@ -477,6 +478,10 @@ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (image.type != SWT.BITMAP || image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + Point loc = DPIUtil.autoScaleUp(new Point(x, y)); + copyAreaInPixels(image, loc.x, loc.y); +} +void copyAreaInPixels(Image image, int x, int y) { if (OS.USE_CAIRO) { int /*long*/ cairo = Cairo.cairo_create(image.surface); if (cairo == 0) SWT.error(SWT.ERROR_NO_HANDLES); @@ -508,7 +513,7 @@ Cairo.cairo_destroy(cairo); return; } - Rectangle rect = image.getBounds(); + Rectangle rect = image.getBoundsInPixels(); int /*long*/ gdkGC = OS.gdk_gc_new(image.pixmap); if (gdkGC == 0) SWT.error(SWT.ERROR_NO_HANDLES); OS.gdk_gc_set_subwindow(gdkGC, OS.GDK_INCLUDE_INFERIORS); @@ -532,7 +537,14 @@ * </ul> */ public void copyArea(int srcX, int srcY, int width, int height, int destX, int destY) { - copyArea(srcX, srcY, width, height, destX, destY, true); + if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + Rectangle src = DPIUtil.autoScaleUp(new Rectangle(srcX, srcY, width, height)); + Point dest = DPIUtil.autoScaleUp(new Point(destX, destY)); + copyAreaInPixels(src.x, src.y, src.width, src.height, dest.x, dest.y); +} + +void copyAreaInPixels(int srcX, int srcY, int width, int height, int destX, int destY) { + copyAreaInPixels(srcX, srcY, width, height, destX, destY, true); } /** * Copies a rectangular area of the receiver at the source @@ -554,6 +566,11 @@ */ public void copyArea(int srcX, int srcY, int width, int height, int destX, int destY, boolean paint) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + Rectangle srcLoc = DPIUtil.autoScaleUp(new Rectangle(srcX, srcY, width, height)); + Point destLoc = DPIUtil.autoScaleUp(new Point(destX, destY)); + copyAreaInPixels(srcLoc.x, srcLoc.y, srcLoc.width, srcLoc.height, destLoc.x, destLoc.y, paint); +} +void copyAreaInPixels(int srcX, int srcY, int width, int height, int destX, int destY, boolean paint) { if (width <= 0 || height <= 0) return; int deltaX = destX - srcX, deltaY = destY - srcY; if (deltaX == 0 && deltaY == 0) return; @@ -722,6 +739,10 @@ */ public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + Rectangle loc = DPIUtil.autoScaleUp(new Rectangle(x, y, width, height)); + drawArcInPixels(loc.x, loc.y, loc.width, loc.height, startAngle, arcAngle); +} +void drawArcInPixels(int x, int y, int width, int height, int startAngle, int arcAngle) { checkGC(DRAW); if (width < 0) { x = x + width; @@ -737,18 +758,18 @@ double xOffset = data.cairoXoffset, yOffset = data.cairoYoffset; if (width == height) { if (arcAngle >= 0) { - Cairo.cairo_arc_negative(cairo, x + xOffset + width / 2f, y + yOffset + height / 2f, width / 2f, -startAngle * (float)Compatibility.PI / 180, -(startAngle + arcAngle) * (float)Compatibility.PI / 180); + Cairo.cairo_arc_negative(cairo, x + xOffset + width / 2f, y + yOffset + height / 2f, width / 2f, -startAngle * (float)Math.PI / 180, -(startAngle + arcAngle) * (float)Math.PI / 180); } else { - Cairo.cairo_arc(cairo, x + xOffset + width / 2f, y + yOffset + height / 2f, width / 2f, -startAngle * (float)Compatibility.PI / 180, -(startAngle + arcAngle) * (float)Compatibility.PI / 180); + Cairo.cairo_arc(cairo, x + xOffset + width / 2f, y + yOffset + height / 2f, width / 2f, -startAngle * (float)Math.PI / 180, -(startAngle + arcAngle) * (float)Math.PI / 180); } } else { Cairo.cairo_save(cairo); Cairo.cairo_translate(cairo, x + xOffset + width / 2f, y + yOffset + height / 2f); Cairo.cairo_scale(cairo, width / 2f, height / 2f); if (arcAngle >= 0) { - Cairo.cairo_arc_negative(cairo, 0, 0, 1, -startAngle * (float)Compatibility.PI / 180, -(startAngle + arcAngle) * (float)Compatibility.PI / 180); + Cairo.cairo_arc_negative(cairo, 0, 0, 1, -startAngle * (float)Math.PI / 180, -(startAngle + arcAngle) * (float)Math.PI / 180); } else { - Cairo.cairo_arc(cairo, 0, 0, 1, -startAngle * (float)Compatibility.PI / 180, -(startAngle + arcAngle) * (float)Compatibility.PI / 180); + Cairo.cairo_arc(cairo, 0, 0, 1, -startAngle * (float)Math.PI / 180, -(startAngle + arcAngle) * (float)Math.PI / 180); } Cairo.cairo_restore(cairo); } @@ -777,6 +798,10 @@ */ public void drawFocus(int x, int y, int width, int height) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + Rectangle loc = DPIUtil.autoScaleUp(new Rectangle(x, y, width, height)); + drawFocusInPixels(loc.x, loc.y, loc.width, loc.height); +} +void drawFocusInPixels(int x, int y, int width, int height) { int /*long*/ cairo = data.cairo; if (cairo != 0) { checkGC(FOREGROUND); @@ -831,6 +856,10 @@ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + Point loc = DPIUtil.autoScaleUp(new Point(x, y)); + drawImageInPixels(image, loc.x, loc.y); +} +void drawImageInPixels(Image image, int x, int y) { drawImage(image, 0, 0, -1, -1, x, y, -1, -1, true); } @@ -846,12 +875,12 @@ * @param image the source image * @param srcX the x coordinate in the source image to copy from * @param srcY the y coordinate in the source image to copy from - * @param srcWidth the width in pixels to copy from the source - * @param srcHeight the height in pixels to copy from the source + * @param srcWidth the width in points to copy from the source + * @param srcHeight the height in points to copy from the source * @param destX the x coordinate in the destination to copy to * @param destY the y coordinate in the destination to copy to - * @param destWidth the width in pixels of the destination rectangle - * @param destHeight the height in pixels of the destination rectangle + * @param destWidth the width in points of the destination rectangle + * @param destHeight the height in points of the destination rectangle * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the image is null</li> @@ -874,9 +903,10 @@ } if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - drawImage(image, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, false); + Rectangle srcRect = DPIUtil.autoScaleUp(new Rectangle(srcX, srcY, srcWidth, srcHeight)); + Rectangle destRect = DPIUtil.autoScaleUp(new Rectangle(destX, destY, destWidth, destHeight)); + drawImage(image, srcRect.x, srcRect.y, srcRect.width, srcRect.height, destRect.x, destRect.y, destRect.width, destRect.height, false); } - void drawImage(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple) { /* Refresh Image as per zoom level, if required. */ srcImage.refreshImageForZoom (); @@ -903,7 +933,7 @@ simple = srcX == 0 && srcY == 0 && srcWidth == destWidth && destWidth == imgWidth && srcHeight == destHeight && destHeight == imgHeight; - if (srcX + srcWidth > imgWidth || srcY + srcHeight > imgHeight) { + if (srcX + srcWidth > imgWidth + 1 || srcY + srcHeight > imgHeight + 1) { //rounding error correction for hidpi SWT.error(SWT.ERROR_INVALID_ARGUMENT); } } @@ -1256,6 +1286,11 @@ */ public void drawLine(int x1, int y1, int x2, int y2) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + Point loc1 = DPIUtil.autoScaleUp(new Point(x1, y1)); + Point loc2 = DPIUtil.autoScaleUp(new Point(x2, y2)); + drawLineInPixels(loc1.x, loc1.y, loc2.x, loc2.y); +} +void drawLineInPixels(int x1, int y1, int x2, int y2) { checkGC(DRAW); int /*long*/ cairo = data.cairo; if (cairo != 0) { @@ -1291,6 +1326,10 @@ */ public void drawOval(int x, int y, int width, int height) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + Rectangle rect = DPIUtil.autoScaleUp(new Rectangle(x, y, width, height)); + drawOvalInPixels(rect.x, rect.y, rect.width, rect.height); +} +void drawOvalInPixels(int x, int y, int width, int height) { checkGC(DRAW); if (width < 0) { x = x + width; @@ -1304,12 +1343,12 @@ if (cairo != 0) { double xOffset = data.cairoXoffset, yOffset = data.cairoYoffset; if (width == height) { - Cairo.cairo_arc_negative(cairo, x + xOffset + width / 2f, y + yOffset + height / 2f, width / 2f, 0, -2 * (float)Compatibility.PI); + Cairo.cairo_arc_negative(cairo, x + xOffset + width / 2f, y + yOffset + height / 2f, width / 2f, 0, -2 * (float)Math.PI); } else { Cairo.cairo_save(cairo); Cairo.cairo_translate(cairo, x + xOffset + width / 2f, y + yOffset + height / 2f); Cairo.cairo_scale(cairo, width / 2f, height / 2f); - Cairo.cairo_arc_negative(cairo, 0, 0, 1, 0, -2 * (float)Compatibility.PI); + Cairo.cairo_arc_negative(cairo, 0, 0, 1, 0, -2 * (float)Math.PI); Cairo.cairo_restore(cairo); } Cairo.cairo_stroke(cairo); @@ -1378,6 +1417,10 @@ */ public void drawPoint (int x, int y) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + Point loc = DPIUtil.autoScaleUp(new Point(x, y)); + drawPointInPixels(loc.x, loc.y); +} +void drawPointInPixels (int x, int y) { checkGC(DRAW); int /*long*/ cairo = data.cairo; if (cairo != 0) { @@ -1408,6 +1451,10 @@ public void drawPolygon(int[] pointArray) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + int [] scaledPointArray = DPIUtil.autoScaleUp(pointArray); + drawPolygonInPixels(scaledPointArray); +} +void drawPolygonInPixels(int[] pointArray) { checkGC(DRAW); int /*long*/ cairo = data.cairo; if (cairo != 0) { @@ -1438,6 +1485,10 @@ public void drawPolyline(int[] pointArray) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + int [] scaledPointArray = DPIUtil.autoScaleUp(pointArray); + drawPolylineInPixels(scaledPointArray); +} +void drawPolylineInPixels(int[] pointArray) { checkGC(DRAW); int /*long*/ cairo = data.cairo; if (cairo != 0) { @@ -1476,6 +1527,9 @@ */ public void drawRectangle(int x, int y, int width, int height) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + drawRectangle(new Rectangle(x, y, width, height)); +} +void drawRectangleInPixels(int x, int y, int width, int height) { checkGC(DRAW); if (width < 0) { x = x + width; @@ -1513,7 +1567,10 @@ */ public void drawRectangle(Rectangle rect) { if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - drawRectangle (rect.x, rect.y, rect.width, rect.height); + drawRectangleInPixels(DPIUtil.autoScaleUp(rect)); +} +void drawRectangleInPixels(Rectangle rect) { + drawRectangleInPixels (rect.x, rect.y, rect.width, rect.height); } /** * Draws the outline of the round-cornered rectangle specified by @@ -1538,6 +1595,11 @@ */ public void drawRoundRectangle(int x, int y, int width, int height, int arcWidth, int arcHeight) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + Rectangle rect = DPIUtil.autoScaleUp(new Rectangle(x, y, width, height)); + Point arcSize = DPIUtil.autoScaleUp(new Point(arcWidth, arcHeight)); + drawRoundRectangleInPixels(rect.x, rect.y, rect.width, rect.height, arcSize.x, arcSize.y); +} +void drawRoundRectangleInPixels(int x, int y, int width, int height, int arcWidth, int arcHeight) { checkGC(DRAW); int nx = x; int ny = y; @@ -1569,10 +1631,10 @@ Cairo.cairo_translate(cairo, nx + xOffset, ny + yOffset); Cairo.cairo_scale(cairo, naw2, nah2); Cairo.cairo_move_to(cairo, fw - 1, 0); - Cairo.cairo_arc(cairo, fw - 1, 1, 1, Compatibility.PI + Compatibility.PI/2.0, Compatibility.PI*2.0); - Cairo.cairo_arc(cairo, fw - 1, fh - 1, 1, 0, Compatibility.PI/2.0); - Cairo.cairo_arc(cairo, 1, fh - 1, 1, Compatibility.PI/2, Compatibility.PI); - Cairo.cairo_arc(cairo, 1, 1, 1, Compatibility.PI, 270.0*Compatibility.PI/180.0); + Cairo.cairo_arc(cairo, fw - 1, 1, 1, Math.PI + Math.PI/2.0, Math.PI*2.0); + Cairo.cairo_arc(cairo, fw - 1, fh - 1, 1, 0, Math.PI/2.0); + Cairo.cairo_arc(cairo, 1, fh - 1, 1, Math.PI/2, Math.PI); + Cairo.cairo_arc(cairo, 1, 1, 1, Math.PI, 270.0*Math.PI/180.0); Cairo.cairo_close_path(cairo); Cairo.cairo_restore(cairo); } @@ -1629,7 +1691,13 @@ * </ul> */ public void drawString (String string, int x, int y) { - drawString(string, x, y, false); + if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + drawString (string, x, y, false); +} + +void drawStringInPixels (String string, int x, int y) { + drawStringInPixels(string, x, y, false); } /** * Draws the given string, using the receiver's current font and @@ -1652,7 +1720,14 @@ * </ul> */ public void drawString(String string, int x, int y, boolean isTransparent) { - drawText(string, x, y, isTransparent ? SWT.DRAW_TRANSPARENT : 0); + if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + Point loc = DPIUtil.autoScaleUp(new Point(x, y)); + drawStringInPixels(string, loc.x, loc.y, isTransparent); +} + +void drawStringInPixels(String string, int x, int y, boolean isTransparent) { + drawTextInPixels(string, x, y, isTransparent ? SWT.DRAW_TRANSPARENT : 0); } /** @@ -1676,6 +1751,9 @@ public void drawText(String string, int x, int y) { drawText(string, x, y, SWT.DRAW_DELIMITER | SWT.DRAW_TAB); } +void drawTextInPixels(String string, int x, int y) { + drawTextInPixels(string, x, y, SWT.DRAW_DELIMITER | SWT.DRAW_TAB); +} /** * Draws the given string, using the receiver's current font and @@ -1698,9 +1776,13 @@ * </ul> */ public void drawText(String string, int x, int y, boolean isTransparent) { + Point loc = DPIUtil.autoScaleUp(new Point (x, y)); + drawTextInPixels(string, loc.x, loc.y, isTransparent); +} +void drawTextInPixels(String string, int x, int y, boolean isTransparent) { int flags = SWT.DRAW_DELIMITER | SWT.DRAW_TAB; if (isTransparent) flags |= SWT.DRAW_TRANSPARENT; - drawText(string, x, y, flags); + drawTextInPixels(string, x, y, flags); } /** @@ -1738,6 +1820,10 @@ * </ul> */ public void drawText (String string, int x, int y, int flags) { + Point loc = DPIUtil.autoScaleUp(new Point (x, y)); + drawTextInPixels(string, loc.x, loc.y, flags); +} +void drawTextInPixels (String string, int x, int y, int flags) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (string.length() == 0) return; @@ -1846,6 +1932,10 @@ */ public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + Rectangle rect = DPIUtil.autoScaleUp(new Rectangle(x, y, width, height)); + fillArcInPixels(rect.x, rect.y, rect.width, rect.height, startAngle, arcAngle); +} +void fillArcInPixels(int x, int y, int width, int height, int startAngle, int arcAngle) { checkGC(FILL); if (width < 0) { x = x + width; @@ -1860,9 +1950,9 @@ if (cairo != 0) { if (width == height) { if (arcAngle >= 0) { - Cairo.cairo_arc_negative(cairo, x + width / 2f, y + height / 2f, width / 2f, -startAngle * (float)Compatibility.PI / 180, -(startAngle + arcAngle) * (float)Compatibility.PI / 180); + Cairo.cairo_arc_negative(cairo, x + width / 2f, y + height / 2f, width / 2f, -startAngle * (float)Math.PI / 180, -(startAngle + arcAngle) * (float)Math.PI / 180); } else { - Cairo.cairo_arc(cairo, x + width / 2f, y + height / 2f, width / 2f, -startAngle * (float)Compatibility.PI / 180, -(startAngle + arcAngle) * (float)Compatibility.PI / 180); + Cairo.cairo_arc(cairo, x + width / 2f, y + height / 2f, width / 2f, -startAngle * (float)Math.PI / 180, -(startAngle + arcAngle) * (float)Math.PI / 180); } Cairo.cairo_line_to(cairo, x + width / 2f, y + height / 2f); } else { @@ -1870,9 +1960,9 @@ Cairo.cairo_translate(cairo, x + width / 2f, y + height / 2f); Cairo.cairo_scale(cairo, width / 2f, height / 2f); if (arcAngle >= 0) { - Cairo.cairo_arc_negative(cairo, 0, 0, 1, -startAngle * (float)Compatibility.PI / 180, -(startAngle + arcAngle) * (float)Compatibility.PI / 180); + Cairo.cairo_arc_negative(cairo, 0, 0, 1, -startAngle * (float)Math.PI / 180, -(startAngle + arcAngle) * (float)Math.PI / 180); } else { - Cairo.cairo_arc(cairo, 0, 0, 1, -startAngle * (float)Compatibility.PI / 180, -(startAngle + arcAngle) * (float)Compatibility.PI / 180); + Cairo.cairo_arc(cairo, 0, 0, 1, -startAngle * (float)Math.PI / 180, -(startAngle + arcAngle) * (float)Math.PI / 180); } Cairo.cairo_line_to(cairo, 0, 0); Cairo.cairo_restore(cairo); @@ -1905,6 +1995,11 @@ */ public void fillGradientRectangle(int x, int y, int width, int height, boolean vertical) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + Rectangle rect = DPIUtil.autoScaleUp(new Rectangle(x, y, width, height)); + fillGradientRectangleInPixels(rect.x, rect.y, rect.width, rect.height, vertical); +} + +void fillGradientRectangleInPixels(int x, int y, int width, int height, boolean vertical) { if ((width == 0) || (height == 0)) return; /* Rewrite this to use GdkPixbuf */ @@ -1930,7 +2025,7 @@ toRGB = foregroundRGB; } if (fromRGB.equals(toRGB)) { - fillRectangle(x, y, width, height); + fillRectangleInPixels(x, y, width, height); return; } int /*long*/ cairo = data.cairo; @@ -1954,8 +2049,9 @@ return; } ImageData.fillGradientRectangle(this, data.device, - x, y, width, height, vertical, fromRGB, toRGB, - 8, 8, 8); + DPIUtil.autoScaleDown(x), DPIUtil.autoScaleDown(y), + DPIUtil.autoScaleDown(width), DPIUtil.autoScaleDown(height), + vertical, fromRGB, toRGB, 8, 8, 8); } /** @@ -1976,6 +2072,10 @@ */ public void fillOval(int x, int y, int width, int height) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + Rectangle rect = DPIUtil.autoScaleUp(new Rectangle(x, y, width, height)); + fillOvalInPixels(rect.x, rect.y, rect.width, rect.height); +} +void fillOvalInPixels(int x, int y, int width, int height) { checkGC(FILL); if (width < 0) { x = x + width; @@ -1988,12 +2088,12 @@ int /*long*/ cairo = data.cairo; if (cairo != 0) { if (width == height) { - Cairo.cairo_arc_negative(cairo, x + width / 2f, y + height / 2f, width / 2f, 0, 2 * (float)Compatibility.PI); + Cairo.cairo_arc_negative(cairo, x + width / 2f, y + height / 2f, width / 2f, 0, 2 * (float)Math.PI); } else { Cairo.cairo_save(cairo); Cairo.cairo_translate(cairo, x + width / 2f, y + height / 2f); Cairo.cairo_scale(cairo, width / 2f, height / 2f); - Cairo.cairo_arc_negative(cairo, 0, 0, 1, 0, 2 * (float)Compatibility.PI); + Cairo.cairo_arc_negative(cairo, 0, 0, 1, 0, 2 * (float)Math.PI); Cairo.cairo_restore(cairo); } Cairo.cairo_fill(cairo); @@ -2061,6 +2161,10 @@ public void fillPolygon(int[] pointArray) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + int [] scaledPointArray = DPIUtil.autoScaleUp(pointArray); + fillPolygonInPixels(scaledPointArray); +} +void fillPolygonInPixels(int[] pointArray) { checkGC(FILL); int /*long*/ cairo = data.cairo; if (cairo != 0) { @@ -2088,6 +2192,9 @@ */ public void fillRectangle(int x, int y, int width, int height) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + fillRectangle(new Rectangle(x, y, width, height)); +} +void fillRectangleInPixels(int x, int y, int width, int height) { checkGC(FILL); if (width < 0) { x = x + width; @@ -2124,7 +2231,10 @@ public void fillRectangle(Rectangle rect) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - fillRectangle(rect.x, rect.y, rect.width, rect.height); + fillRectangleInPixels(DPIUtil.autoScaleUp(rect)); +} +void fillRectangleInPixels(Rectangle rect) { + fillRectangleInPixels(rect.x, rect.y, rect.width, rect.height); } /** @@ -2146,6 +2256,11 @@ */ public void fillRoundRectangle(int x, int y, int width, int height, int arcWidth, int arcHeight) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + Rectangle rect = DPIUtil.autoScaleUp(new Rectangle(x, y, width, height)); + Point arcSize = DPIUtil.autoScaleUp(new Point(arcWidth, arcHeight)); + fillRoundRectangleInPixels(rect.x, rect.y, rect.width, rect.height, arcSize.x, arcSize.y); +} +void fillRoundRectangleInPixels(int x, int y, int width, int height, int arcWidth, int arcHeight) { checkGC(FILL); int nx = x; int ny = y; @@ -2176,10 +2291,10 @@ Cairo.cairo_translate(cairo, nx, ny); Cairo.cairo_scale(cairo, naw2, nah2); Cairo.cairo_move_to(cairo, fw - 1, 0); - Cairo.cairo_arc(cairo, fw - 1, 1, 1, Compatibility.PI + Compatibility.PI/2.0, Compatibility.PI*2.0); - Cairo.cairo_arc(cairo, fw - 1, fh - 1, 1, 0, Compatibility.PI/2.0); - Cairo.cairo_arc(cairo, 1, fh - 1, 1, Compatibility.PI/2, Compatibility.PI); - Cairo.cairo_arc(cairo, 1, 1, 1, Compatibility.PI, 270.0*Compatibility.PI/180.0); + Cairo.cairo_arc(cairo, fw - 1, 1, 1, Math.PI + Math.PI/2.0, Math.PI*2.0); + Cairo.cairo_arc(cairo, fw - 1, fh - 1, 1, 0, Math.PI/2.0); + Cairo.cairo_arc(cairo, 1, fh - 1, 1, Math.PI/2, Math.PI); + Cairo.cairo_arc(cairo, 1, 1, 1, Math.PI, 270.0*Math.PI/180.0); Cairo.cairo_close_path(cairo); Cairo.cairo_restore(cairo); } @@ -2247,7 +2362,7 @@ public int getAdvanceWidth(char ch) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); //BOGUS - return stringExtent(new String(new char[]{ch})).x; + return stringExtentInPixels(new String(new char[]{ch})).x; } /** @@ -2378,7 +2493,7 @@ public int getCharWidth(char ch) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); //BOGUS - return stringExtent(new String(new char[]{ch})).x; + return stringExtentInPixels(new String(new char[]{ch})).x; } /** @@ -2395,6 +2510,9 @@ */ public Rectangle getClipping() { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + return DPIUtil.autoScaleDown(getClippingInPixels()); +} +Rectangle getClippingInPixels() { /* Calculate visible bounds in device space */ int x = 0, y = 0, width = 0, height = 0; int[] w = new int[1], h = new int[1]; @@ -2552,10 +2670,13 @@ int /*long*/ lang = OS.pango_context_get_language(context); int /*long*/ metrics = OS.pango_context_get_metrics(context, font.handle, lang); FontMetrics fm = new FontMetrics(); - fm.ascent = OS.PANGO_PIXELS(OS.pango_font_metrics_get_ascent(metrics)); - fm.descent = OS.PANGO_PIXELS(OS.pango_font_metrics_get_descent(metrics)); - fm.averageCharWidth = OS.PANGO_PIXELS(OS.pango_font_metrics_get_approximate_char_width(metrics)); - fm.height = fm.ascent + fm.descent; + int ascent = OS.pango_font_metrics_get_ascent(metrics); + int descent = OS.pango_font_metrics_get_descent(metrics); + int ascentInPoints = DPIUtil.autoScaleDown(OS.PANGO_PIXELS(ascent)); + fm.ascentInPoints = ascentInPoints; + int heightInPoints = DPIUtil.autoScaleDown(OS.PANGO_PIXELS(ascent + descent)); + fm.descentInPoints = heightInPoints - ascentInPoints; + fm.averageCharWidthInPoints = DPIUtil.autoScaleDown(OS.PANGO_PIXELS(OS.pango_font_metrics_get_approximate_char_width(metrics))); OS.pango_font_metrics_unref(metrics); return fm; } @@ -2651,6 +2772,11 @@ */ public LineAttributes getLineAttributes() { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + LineAttributes attributes = getLineAttributesInPixels(); + attributes.width = DPIUtil.autoScaleDown(attributes.width); + return attributes; +} +LineAttributes getLineAttributesInPixels() { float[] dashes = null; if (data.lineDashes != null) { dashes = new float[data.lineDashes.length]; @@ -2748,6 +2874,9 @@ */ public int getLineWidth() { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + return (int)DPIUtil.autoScaleDown(data.lineWidth); +} +int getLineWidthInPixels() { return (int)data.lineWidth; } @@ -3330,6 +3459,9 @@ */ public void setClipping(int x, int y, int width, int height) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + setClippingInPixels(DPIUtil.autoScaleUp(x), DPIUtil.autoScaleUp(y), DPIUtil.autoScaleUp(width), DPIUtil.autoScaleUp(height)); +} +void setClippingInPixels(int x, int y, int width, int height) { if (width < 0) { x = x + width; width = -width; @@ -3405,13 +3537,16 @@ */ public void setClipping(Rectangle rect) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - if (OS.GTK_VERSION >= OS.VERSION(3, 9, 0)) { - return; + setClippingInPixels(DPIUtil.autoScaleUp(rect)); +} +void setClippingInPixels(Rectangle rect) { + if (OS.GTK_VERSION >= OS.VERSION(3, 9, 0) && (drawable instanceof Tree || drawable instanceof Table)) { + return; //FIXME: This is an atrocious hack for bug 446075 } if (rect == null) { setClipping(0); } else { - setClipping(rect.x, rect.y, rect.width, rect.height); + setClippingInPixels(rect.x, rect.y, rect.width, rect.height); } } /** @@ -3619,6 +3754,10 @@ public void setLineAttributes(LineAttributes attributes) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (attributes == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + attributes.width = DPIUtil.autoScaleUp(attributes.width); + setLineAttributesInPixels(attributes); +} +void setLineAttributesInPixels(LineAttributes attributes) { int mask = 0; float lineWidth = attributes.width; if (lineWidth != data.lineWidth) { @@ -3867,6 +4006,9 @@ */ public void setLineWidth(int lineWidth) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + setLineWidthInPixels(DPIUtil.autoScaleUp(lineWidth)); +} +void setLineWidthInPixels(int lineWidth) { if (data.lineWidth == lineWidth) return; data.lineWidth = lineWidth; data.state &= ~(LINE_WIDTH | DRAW_OFFSET); @@ -4037,7 +4179,6 @@ } data.xorMode = xor; } - /** * Returns the extent of the given string. No tab * expansion or carriage return processing will be performed. @@ -4058,7 +4199,10 @@ * </ul> */ public Point stringExtent(String string) { - return textExtent(string, 0); + return DPIUtil.autoScaleDown(stringExtentInPixels(string)); +} +Point stringExtentInPixels(String string) { + return textExtentInPixels(string, 0); } /** @@ -4081,7 +4225,11 @@ * </ul> */ public Point textExtent(String string) { - return textExtent(string, SWT.DRAW_DELIMITER | SWT.DRAW_TAB); + return DPIUtil.autoScaleDown(textExtentInPixels(string)); +} + +Point textExtentInPixels(String string) { + return textExtentInPixels(string, SWT.DRAW_DELIMITER | SWT.DRAW_TAB); } /** @@ -4118,6 +4266,9 @@ public Point textExtent(String string, int flags) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + return DPIUtil.autoScaleDown(textExtentInPixels(string, flags)); +} +Point textExtentInPixels(String string, int flags) { setString(string, flags); checkGC(FONT); if (data.stringWidth == -1) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/GlyphMetrics.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/GlyphMetrics.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/GlyphMetrics.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/GlyphMetrics.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -11,6 +11,7 @@ package org.eclipse.swt.graphics; import org.eclipse.swt.*; +import org.eclipse.swt.internal.*; /** * Instances of this class represent glyph metrics. @@ -18,37 +19,37 @@ * The hashCode() method in this class uses the values of the public * fields to compute the hash value. When storing instances of the * class in hashed collections, do not modify these fields after the - * object has been inserted. + * object has been inserted. * </p> * <p> * Application code does <em>not</em> need to explicitly release the * resources managed by each instance when those instances are no longer * required, and thus no <code>dispose()</code> method is provided. * </p> - * + * * @see TextStyle * @see TextLayout * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.2 */ public final class GlyphMetrics { - + /** * the ascent of the GlyphMetrics */ public int ascent; - + /** * the descent of the GlyphMetrics */ public int descent; - + /** * the width of the GlyphMetrics */ public int width; - + /** * Constructs an instance of this class with the given * ascent, descent and width values. @@ -70,6 +71,18 @@ this.width = width; } +int getAscentInPixels() { + return DPIUtil.autoScaleUp(ascent); +} + +int getDescentInPixels() { + return DPIUtil.autoScaleUp(descent); +} + +int getWidthInPixels() { + return DPIUtil.autoScaleUp(width); +} + /** * Compares the argument to the receiver, and returns true * if they represent the <em>same</em> object using a class @@ -89,8 +102,8 @@ } /** - * Returns an integer hash code for the receiver. Any two - * objects that return <code>true</code> when passed to + * Returns an integer hash code for the receiver. Any two + * objects that return <code>true</code> when passed to * <code>equals</code> must return the same value for this * method. * diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/ImageData.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/ImageData.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/ImageData.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/ImageData.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -12,16 +12,17 @@ import java.io.*; + import org.eclipse.swt.*; -import org.eclipse.swt.internal.CloneableCompatibility; +import org.eclipse.swt.internal.*; /** * Instances of this class are device-independent descriptions * of images. They are typically used as an intermediate format - * between loading from or writing to streams and creating an + * between loading from or writing to streams and creating an * <code>Image</code>. * <p> - * Note that the public fields <code>x</code>, <code>y</code>, + * Note that the public fields <code>x</code>, <code>y</code>, * <code>disposalMethod</code> and <code>delayTime</code> are * typically only used when the image is in a set of images used * for animation. @@ -34,8 +35,8 @@ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ -public final class ImageData implements CloneableCompatibility { - +public final class ImageData implements Cloneable { + /** * The width of the image, in pixels. */ @@ -121,7 +122,7 @@ * </p> */ public int maskPad; - + /** * The alpha data of the image. * <p> @@ -132,7 +133,7 @@ * </p> */ public byte[] alphaData; - + /** * The global alpha value to be used for every pixel. * <p> @@ -148,7 +149,7 @@ /** * The type of file from which the image was read. - * + * * It is expressed as one of the following values: * <dl> * <dt><code>IMAGE_BMP</code></dt> @@ -184,7 +185,7 @@ /** * A description of how to dispose of the current image * before displaying the next. - * + * * It is expressed as one of the following values: * <dl> * <dt><code>DM_UNSPECIFIED</code></dt> @@ -292,7 +293,7 @@ * <p> * This constructor is provided for convenience when loading a single * image only. If the stream contains multiple images, only the first - * one will be loaded. To load multiple images, use + * one will be loaded. To load multiple images, use * <code>ImageLoader.load()</code>. * </p><p> * This constructor may be used to load a resource as follows: @@ -358,7 +359,7 @@ * <p> * This constructor is provided for convenience when loading a single * image only. If the file contains multiple images, only the first - * one will be loaded. To load multiple images, use + * one will be loaded. To load multiple images, use * <code>ImageLoader.load()</code>. * </p> * @@ -428,7 +429,7 @@ int bytesPerLine = (((width * depth + 7) / 8) + (scanlinePad - 1)) / scanlinePad * scanlinePad; - + /* * When the image is being loaded from a PNG, we need to use the theoretical minimum * number of bytes per line to check whether there is enough data, because the actual @@ -492,7 +493,7 @@ this.delayTime = delayTime; } -/** +/** * Invokes internal SWT functionality to create a new instance of * this class. * <p> @@ -505,7 +506,7 @@ * <p> * This method is for internal use, and is not described further. * </p> - * + * * @noreference This method is not intended to be referenced by clients. */ public static ImageData internal_new( @@ -1090,7 +1091,7 @@ /** * Returns the byte order of the receiver. - * + * * @return MSB_FIRST or LSB_FIRST */ int getByteOrder() { @@ -1131,7 +1132,7 @@ ALPHA_OPAQUE, null, 0, 0, 0, dest.data, dest.depth, dest.bytesPerLine, dest.getByteOrder(), 0, 0, dest.width, dest.height, null, null, null, flipX, flipY); - + /* Scale the image mask or alpha */ if (maskData != null) { dest.maskPad = this.maskPad; @@ -1175,9 +1176,9 @@ public void setAlpha(int x, int y, int alpha) { if (x >= width || y >= height || x < 0 || y < 0 || alpha < 0 || alpha > 255) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - + if (alphaData == null) alphaData = new byte[width * height]; - alphaData[y * width + x] = (byte)alpha; + alphaData[y * width + x] = (byte)alpha; } /** @@ -1204,7 +1205,7 @@ if (alphas == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (putWidth < 0 || x >= width || y >= height || x < 0 || y < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT); if (putWidth == 0) return; - + if (alphaData == null) alphaData = new byte[width * height]; // may throw an IndexOutOfBoundsException System.arraycopy(alphas, startIndex, alphaData, y * width + x, putWidth); @@ -1665,7 +1666,7 @@ static final byte[] convertPad(byte[] data, int width, int height, int depth, int pad, int newPad) { if (pad == newPad) return data; int stride = (width * depth + 7) / 8; - int bpl = (stride + (pad - 1)) / pad * pad; + int bpl = (stride + (pad - 1)) / pad * pad; int newBpl = (stride + (newPad - 1)) / newPad * newPad; byte[] newData = new byte[height * newBpl]; int srcIndex = 0, destIndex = 0; @@ -1730,7 +1731,7 @@ * the masks are ignored. Hence when not changing the image * data format, 0 may be specified for the masks. * </p> - * + * * @param op the blitter operation: a combination of BLIT_xxx flags * (see BLIT_xxx constants) * @param srcData the source byte array containing image data @@ -1811,7 +1812,7 @@ default: //throw new IllegalArgumentException("Invalid source type"); return; - } + } int spr = srcY * srcStride + srcX * sbpp; /*** Prepare destination-related data ***/ @@ -1836,7 +1837,7 @@ default: //throw new IllegalArgumentException("Invalid destination type"); return; - } + } int dpr = ((flipY) ? destY + dhm1 : destY) * destStride + ((flipX) ? destX + dwm1 : destX) * dbpp; final int dprxi = (flipX) ? -dbpp : dbpp; final int dpryi = (flipY) ? -destStride : destStride; @@ -1888,7 +1889,7 @@ sp += (sfx >>> 16); } } - break; + break; case 2: for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) { for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) { @@ -2063,7 +2064,7 @@ case ALPHA_MASK_UNPACKED: alpha = (alphaData[ap] != 0) ? 0x10000 : 0; ap += (sfx >> 16); - break; + break; case ALPHA_MASK_PACKED: alpha = (alphaData[ap >> 3] << ((ap & 7) + 9)) & 0x10000; ap += (sfx >> 16); @@ -2140,7 +2141,7 @@ } /*** WRITE NEXT PIXEL ***/ - final int data = + final int data = (r >>> destRedPreShift << destRedShift) | (g >>> destGreenPreShift << destGreenShift) | (b >>> destBluePreShift << destBlueShift) | @@ -2176,7 +2177,7 @@ } break; } } - } + } } /** @@ -2186,7 +2187,7 @@ * arrays may be null if no alpha blending or dither is to be * performed. * </p> - * + * * @param op the blitter operation: a combination of BLIT_xxx flags * (see BLIT_xxx constants) * @param srcData the source byte array containing image data @@ -2262,8 +2263,8 @@ break; default: //throw new IllegalArgumentException("Invalid source type"); - return; - } + return; + } int spr = srcY * srcStride + srcX; /*** Prepare destination-related data ***/ @@ -2287,7 +2288,7 @@ default: //throw new IllegalArgumentException("Invalid source type"); return; - } + } int dpr = ((flipY) ? destY + dhm1 : destY) * destStride + ((flipX) ? destX + dwm1 : destX); final int dprxi = (flipX) ? -1 : 1; final int dpryi = (flipY) ? -destStride : destStride; @@ -2390,7 +2391,7 @@ sp += (sfx >>> 16); } } - break; + break; case TYPE_INDEX_4: for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) { for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) { @@ -2412,7 +2413,7 @@ destData[dp >> 2] = (byte)(destData[dp >> 2] & ~(0x03 << shift) | (index << shift)); } } - break; + break; case TYPE_INDEX_1_MSB: for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) { for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) { @@ -2422,7 +2423,7 @@ destData[dp >> 3] = (byte)(destData[dp >> 3] & ~(0x01 << shift) | (index << shift)); } } - break; + break; case TYPE_INDEX_1_LSB: for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) { for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) { @@ -2449,20 +2450,20 @@ case TYPE_INDEX_8: index = srcData[sp] & 0xff; sp += (sfx >>> 16); - break; + break; case TYPE_INDEX_4: if ((sp & 1) != 0) index = srcData[sp >> 1] & 0x0f; else index = (srcData[sp >> 1] >>> 4) & 0x0f; sp += (sfx >>> 16); - break; + break; case TYPE_INDEX_2: index = (srcData[sp >> 2] >>> (6 - (sp & 3) * 2)) & 0x03; sp += (sfx >>> 16); - break; + break; case TYPE_INDEX_1_MSB: index = (srcData[sp >> 3] >>> (7 - (sp & 7))) & 0x01; sp += (sfx >>> 16); - break; + break; case TYPE_INDEX_1_LSB: index = (srcData[sp >> 3] >>> (sp & 7)) & 0x01; sp += (sfx >>> 16); @@ -2500,7 +2501,7 @@ } break; } index = paletteMapping[index] & 0xff; - + /*** WRITE NEXT PIXEL ***/ switch (dtype) { case TYPE_INDEX_8: @@ -2509,11 +2510,11 @@ case TYPE_INDEX_4: if ((dp & 1) != 0) destData[dp >> 1] = (byte)((destData[dp >> 1] & 0xf0) | index); else destData[dp >> 1] = (byte)((destData[dp >> 1] & 0x0f) | (index << 4)); - break; + break; case TYPE_INDEX_2: { final int shift = 6 - (dp & 3) * 2; destData[dp >> 2] = (byte)(destData[dp >> 2] & ~(0x03 << shift) | (index << shift)); - } break; + } break; case TYPE_INDEX_1_MSB: { final int shift = 7 - (dp & 7); destData[dp >> 3] = (byte)(destData[dp >> 3] & ~(0x01 << shift) | (index << shift)); @@ -2521,14 +2522,14 @@ case TYPE_INDEX_1_LSB: { final int shift = dp & 7; destData[dp >> 3] = (byte)(destData[dp >> 3] & ~(0x01 << shift) | (index << shift)); - } break; + } break; } } } } return; } - + /*** Comprehensive blit (apply transformations) ***/ int alpha = alphaMode; int index = 0; @@ -2586,7 +2587,7 @@ case ALPHA_MASK_UNPACKED: alpha = (alphaData[ap] != 0) ? 0x10000 : 0; ap += (sfx >> 16); - break; + break; case ALPHA_MASK_PACKED: alpha = (alphaData[ap >> 3] << ((ap & 7) + 9)) & 0x10000; ap += (sfx >> 16); @@ -2693,7 +2694,7 @@ case TYPE_INDEX_2: { final int shift = 6 - (dp & 3) * 2; destData[dp >> 2] = (byte)(destData[dp >> 2] & ~(0x03 << shift) | (lastindex << shift)); - } break; + } break; case TYPE_INDEX_1_MSB: { final int shift = 7 - (dp & 7); destData[dp >> 3] = (byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift)); @@ -2701,7 +2702,7 @@ case TYPE_INDEX_1_LSB: { final int shift = dp & 7; destData[dp >> 3] = (byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift)); - } break; + } break; } } } @@ -2713,7 +2714,7 @@ * Note: The source and destination masks and palettes must * always be fully specified. * </p> - * + * * @param op the blitter operation: a combination of BLIT_xxx flags * (see BLIT_xxx constants) * @param srcData the source byte array containing image data @@ -2819,7 +2820,7 @@ default: //throw new IllegalArgumentException("Invalid source type"); return; - } + } int spr = srcY * srcStride + srcX; /*** Prepare destination-related data ***/ @@ -2844,7 +2845,7 @@ default: //throw new IllegalArgumentException("Invalid destination type"); return; - } + } int dpr = ((flipY) ? destY + dhm1 : destY) * destStride + ((flipX) ? destX + dwm1 : destX) * dbpp; final int dprxi = (flipX) ? -dbpp : dbpp; final int dpryi = (flipY) ? -destStride : destStride; @@ -2947,7 +2948,7 @@ case ALPHA_MASK_UNPACKED: alpha = (alphaData[ap] != 0) ? 0x10000 : 0; ap += (sfx >> 16); - break; + break; case ALPHA_MASK_PACKED: alpha = (alphaData[ap >> 3] << ((ap & 7) + 9)) & 0x10000; ap += (sfx >> 16); @@ -3032,7 +3033,7 @@ } /*** WRITE NEXT PIXEL ***/ - final int data = + final int data = (r >>> destRedPreShift << destRedShift) | (g >>> destGreenPreShift << destGreenShift) | (b >>> destBluePreShift << destBlueShift) | @@ -3068,7 +3069,7 @@ } break; } } - } + } } /** @@ -3077,7 +3078,7 @@ * Note: The source and destination masks and palettes must * always be fully specified. * </p> - * + * * @param op the blitter operation: a combination of BLIT_xxx flags * (see BLIT_xxx constants) * @param srcData the source byte array containing image data @@ -3158,7 +3159,7 @@ default: //throw new IllegalArgumentException("Invalid source type"); return; - } + } int spr = srcY * srcStride + srcX * sbpp; /*** Prepare destination-related data ***/ @@ -3182,7 +3183,7 @@ default: //throw new IllegalArgumentException("Invalid source type"); return; - } + } int dpr = ((flipY) ? destY + dhm1 : destY) * destStride + ((flipX) ? destX + dwm1 : destX); final int dprxi = (flipX) ? -1 : 1; final int dpryi = (flipY) ? -destStride : destStride; @@ -3327,7 +3328,7 @@ case ALPHA_MASK_UNPACKED: alpha = (alphaData[ap] != 0) ? 0x10000 : 0; ap += (sfx >> 16); - break; + break; case ALPHA_MASK_PACKED: alpha = (alphaData[ap >> 3] << ((ap & 7) + 9)) & 0x10000; ap += (sfx >> 16); @@ -3426,7 +3427,7 @@ case TYPE_INDEX_2: { final int shift = 6 - (dp & 3) * 2; destData[dp >> 2] = (byte)(destData[dp >> 2] & ~(0x03 << shift) | (lastindex << shift)); - } break; + } break; case TYPE_INDEX_1_MSB: { final int shift = 7 - (dp & 7); destData[dp >> 3] = (byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift)); @@ -3434,7 +3435,7 @@ case TYPE_INDEX_1_LSB: { final int shift = dp & 7; destData[dp >> 3] = (byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift)); - } break; + } break; } } } @@ -3534,7 +3535,7 @@ bitmapData = new byte[bandHeight * bytesPerLine]; buildDitheredGradientChannel(fromRGB.blue, toRGB.blue, steps, bandWidth, bandHeight, vertical, bitmapData, 0, bytesPerLine, blueBits); buildDitheredGradientChannel(fromRGB.green, toRGB.green, steps, bandWidth, bandHeight, vertical, bitmapData, 1, bytesPerLine, greenBits); - buildDitheredGradientChannel(fromRGB.red, toRGB.red, steps, bandWidth, bandHeight, vertical, bitmapData, 2, bytesPerLine, redBits); + buildDitheredGradientChannel(fromRGB.red, toRGB.red, steps, bandWidth, bandHeight, vertical, bitmapData, 2, bytesPerLine, redBits); } } else { /* Dithered two tone */ @@ -3559,7 +3560,7 @@ bitmapData[dp + dx] = (blend + DITHER_MATRIX[dy & 7][dx]) < 0x1000000 ? (byte)0 : (byte)1; } - } + } } else { for (int dx = 0, blend = 0; dx < bandWidth; ++dx, blend += blendi) { for (int dy = 0, dptr = dx; dy < bandHeight; ++dy, dptr += bytesPerLine) { @@ -3572,7 +3573,7 @@ return new ImageData(bandWidth, bandHeight, bitmapDepth, paletteData, 4, bitmapData); } -/* +/* * Fill in gradated values for a color channel */ static final void buildPreciseGradientChannel(int from, int to, int steps, @@ -3590,10 +3591,10 @@ bitmapData[dp] = (byte)(val >>> 16); val += inc; } - } + } } -/* +/* * Fill in dithered gradated values for a color channel */ static final void buildDitheredGradientChannel(int from, int to, int steps, @@ -3654,20 +3655,26 @@ fromRGB, toRGB, redBits, greenBits, blueBits); Image image = new Image(device, band); if ((band.width == 1) || (band.height == 1)) { - gc.drawImage(image, 0, 0, band.width, band.height, x, y, width, height); - } else { + gc.drawImage(image, 0, 0, DPIUtil.autoScaleDown(band.width), DPIUtil.autoScaleDown(band.height), + DPIUtil.autoScaleDown(x), DPIUtil.autoScaleDown(y), DPIUtil.autoScaleDown(width), + DPIUtil.autoScaleDown(height)); + } else { if (vertical) { for (int dx = 0; dx < width; dx += band.width) { int blitWidth = width - dx; if (blitWidth > band.width) blitWidth = band.width; - gc.drawImage(image, 0, 0, blitWidth, band.height, dx + x, y, blitWidth, band.height); - } + gc.drawImage(image, 0, 0, DPIUtil.autoScaleDown(blitWidth), DPIUtil.autoScaleDown(band.height), + DPIUtil.autoScaleDown(dx + x), DPIUtil.autoScaleDown(y), DPIUtil.autoScaleDown(blitWidth), + DPIUtil.autoScaleDown(band.height)); + } } else { for (int dy = 0; dy < height; dy += band.height) { int blitHeight = height - dy; if (blitHeight > band.height) blitHeight = band.height; - gc.drawImage(image, 0, 0, band.width, blitHeight, x, dy + y, band.width, blitHeight); - } + gc.drawImage(image, 0, 0, DPIUtil.autoScaleDown(band.width), DPIUtil.autoScaleDown(blitHeight), + DPIUtil.autoScaleDown(x), DPIUtil.autoScaleDown(dy + y), DPIUtil.autoScaleDown(band.width), + DPIUtil.autoScaleDown(blitHeight)); + } } } image.dispose(); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/ImageDataProvider.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/ImageDataProvider.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/ImageDataProvider.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/ImageDataProvider.java 2016-07-06 19:11:33.000000000 +0000 @@ -15,7 +15,7 @@ * when the application is moved from a low DPI monitor to a high DPI monitor. * This provides API which will be called by SWT during the image rendering. * - * This interface needs to be implemented by client code to provide the + * This interface needs to be implemented by client code to provide the * image information on demand. * * @since 3.104 @@ -29,7 +29,7 @@ * If no image is available for a particular zoom level, this method should * return <code>null</code>. For <code>zoom == 100</code>, returning * <code>null</code> in not allowed, and SWT will throw an exception. - * + * * @param zoom * The zoom level in % of the standard resolution (which is 1 * physical monitor pixel == 1 SWT logical pixel). Typically 100, diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/ImageFileNameProvider.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/ImageFileNameProvider.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/ImageFileNameProvider.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/ImageFileNameProvider.java 2016-07-06 19:11:33.000000000 +0000 @@ -15,7 +15,7 @@ * when the application is moved from a low DPI monitor to a high DPI monitor. * This provides API which will be called by SWT during the image rendering. * - * This interface needs to be implemented by client code to provide the + * This interface needs to be implemented by client code to provide the * image information on demand. * * @since 3.104 @@ -28,7 +28,7 @@ * If no image is available for a particular zoom level, this method should * return <code>null</code>. For <code>zoom == 100</code>, returning * <code>null</code> in not allowed, and SWT will throw an exception. - * + * * @param zoom * The zoom level in % of the standard resolution (which is 1 * physical monitor pixel == 1 SWT logical pixel). Typically 100, diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/Image.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/Image.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/Image.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/Image.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -164,20 +164,21 @@ /** * ImageFileNameProvider to provide file names at various Zoom levels */ - ImageFileNameProvider imageFileNameProvider; + private ImageFileNameProvider imageFileNameProvider; /** * ImageDataProvider to provide ImageData at various Zoom levels */ - ImageDataProvider imageDataProvider; + private ImageDataProvider imageDataProvider; /** * Attribute to cache current device zoom level */ - int currentDeviceZoom = 100; + private int currentDeviceZoom = 100; Image(Device device) { super(device); + currentDeviceZoom = DPIUtil.getDeviceZoom(); } /** @@ -212,12 +213,14 @@ * @exception SWTError <ul> * <li>ERROR_NO_HANDLES if a handle could not be obtained for image creation</li> * </ul> - * + * * @see #dispose() */ public Image(Device device, int width, int height) { super(device); - init(width, height); + Point size = DPIUtil.autoScaleUp(new Point(width, height)); + currentDeviceZoom = DPIUtil.getDeviceZoom(); + init(size.x, size.y); init(); } @@ -383,6 +386,7 @@ } } init(); + currentDeviceZoom = DPIUtil.getDeviceZoom(); return; } @@ -502,6 +506,7 @@ OS.g_object_unref(gdkGC); } init(); + currentDeviceZoom = DPIUtil.getDeviceZoom(); } /** @@ -542,7 +547,9 @@ public Image(Device device, Rectangle bounds) { super(device); if (bounds == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - init(bounds.width, bounds.height); + currentDeviceZoom = DPIUtil.getDeviceZoom(); + Rectangle bounds1 = DPIUtil.autoScaleUp (bounds); + init(bounds1.width, bounds1.height); init(); } @@ -571,6 +578,9 @@ */ public Image(Device device, ImageData data) { super(device); + if (data == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + currentDeviceZoom = DPIUtil.getDeviceZoom(); + data = DPIUtil.autoScaleUp (device, data); init(data); init(); } @@ -612,6 +622,9 @@ if (source.width != mask.width || source.height != mask.height) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); } + currentDeviceZoom = DPIUtil.getDeviceZoom(); + source = DPIUtil.autoScaleUp (device, source); + mask = DPIUtil.autoScaleUp (device, mask); mask = ImageData.convertMask (mask); ImageData image = new ImageData(source.width, source.height, source.depth, source.palette, source.scanlinePad, source.data); image.maskPad = mask.scanlinePad; @@ -675,7 +688,10 @@ */ public Image(Device device, InputStream stream) { super(device); - init(new ImageData(stream)); + ImageData data = new ImageData(stream); + currentDeviceZoom = DPIUtil.getDeviceZoom(); + data = DPIUtil.autoScaleUp (device, data); + init(data); init(); } @@ -714,8 +730,11 @@ public Image(Device device, String filename) { super(device); if (filename == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - initNative(filename); - if (this.pixmap == 0 && this.surface == 0) init(new ImageData(filename)); + + ImageData data = new ImageData(filename); + currentDeviceZoom = DPIUtil.getDeviceZoom(); + data = DPIUtil.autoScaleUp (device, data); + init(data); init(); } @@ -751,10 +770,20 @@ public Image(Device device, ImageFileNameProvider imageFileNameProvider) { super(device); this.imageFileNameProvider = imageFileNameProvider; - currentDeviceZoom = getDeviceZoom (); - String filename = DPIUtil.validateAndGetImagePathAtZoom (imageFileNameProvider, currentDeviceZoom, new boolean[1]); - initNative (filename); - if (this.pixmap == 0 && this.surface == 0) init(new ImageData(filename)); + currentDeviceZoom = DPIUtil.getDeviceZoom(); + boolean[] found = new boolean[1]; + String filename = DPIUtil.validateAndGetImagePathAtZoom (imageFileNameProvider, currentDeviceZoom, found); + if (found[0]) { + initNative (filename); + if (this.pixmap == 0 && this.surface == 0) { + ImageData data = new ImageData(filename); + init(data); + } + } else { + ImageData imageData = new ImageData (filename); + ImageData resizedData = DPIUtil.autoScaleUp (device, imageData); + init(resizedData); + } init (); } @@ -790,16 +819,18 @@ public Image(Device device, ImageDataProvider imageDataProvider) { super(device); this.imageDataProvider = imageDataProvider; - currentDeviceZoom = getDeviceZoom (); - ImageData data = DPIUtil.validateAndGetImageDataAtZoom(imageDataProvider, currentDeviceZoom, new boolean[1]); - init (data); + currentDeviceZoom = DPIUtil.getDeviceZoom(); + boolean[] found = new boolean[1]; + ImageData data = DPIUtil.validateAndGetImageDataAtZoom(imageDataProvider, currentDeviceZoom, found); + if (found[0]) { + init (data); + } else { + ImageData resizedData = DPIUtil.autoScaleUp (device, data); + init (resizedData); + } init (); } -int getDeviceZoom () { - return DPIUtil.mapDPIToZoom (device._getDPIx ()); -} - /** * Refresh the Image based on the zoom level, if required. * @@ -807,8 +838,9 @@ */ boolean refreshImageForZoom () { boolean refreshed = false; + int deviceZoom = DPIUtil.getDeviceZoom(); if (imageFileNameProvider != null) { - int deviceZoomLevel = getDeviceZoom(); + int deviceZoomLevel = deviceZoom; if (deviceZoomLevel != currentDeviceZoom) { boolean[] found = new boolean[1]; String filename = DPIUtil.validateAndGetImagePathAtZoom (imageFileNameProvider, deviceZoomLevel, found); @@ -817,14 +849,26 @@ /* Release current native resources */ destroy (); initNative(filename); - if (this.pixmap == 0 && this.surface == 0) init(new ImageData(filename)); + if (this.pixmap == 0 && this.surface == 0) { + ImageData data = new ImageData(filename); + init(data); + } + init (); + refreshed = true; + } + if (!found[0]) { + /* Release current native resources */ + destroy (); + ImageData imageData = new ImageData (filename); + ImageData resizedData = DPIUtil.autoScaleUp (device, imageData); + init(resizedData); init (); refreshed = true; } currentDeviceZoom = deviceZoomLevel; } } else if (imageDataProvider != null) { - int deviceZoomLevel = getDeviceZoom(); + int deviceZoomLevel = deviceZoom; if (deviceZoomLevel != currentDeviceZoom) { boolean[] found = new boolean[1]; ImageData data = DPIUtil.validateAndGetImageDataAtZoom (imageDataProvider, deviceZoomLevel, found); @@ -836,6 +880,25 @@ init(); refreshed = true; } + if (!found[0]) { + /* Release current native resources */ + destroy (); + ImageData resizedData = DPIUtil.autoScaleImageData(device, data, deviceZoomLevel, 100); + init(resizedData); + init(); + refreshed = true; + } + currentDeviceZoom = deviceZoomLevel; + } + } else { + int deviceZoomLevel = deviceZoom; + if (deviceZoomLevel != currentDeviceZoom) { + ImageData data = getImageDataAtCurrentZoom(); + destroy (); + ImageData resizedData = DPIUtil.autoScaleImageData(device, data, deviceZoomLevel, currentDeviceZoom); + init(resizedData); + init(); + refreshed = true; currentDeviceZoom = deviceZoomLevel; } } @@ -1023,7 +1086,7 @@ return; } if (mask != 0) return; - mask = createMask(getImageData(), false); + mask = createMask(getImageDataAtCurrentZoom(), false); if (mask == 0) SWT.error(SWT.ERROR_NO_HANDLES); } @@ -1242,13 +1305,12 @@ //NOT DONE return null; } - /** * Returns the bounds of the receiver. The rectangle will always * have x and y values of 0, and the width and height of the * image. * - * @return a rectangle specifying the image's bounds + * @return a rectangle specifying the image's bounds in points. * * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> @@ -1257,6 +1319,24 @@ */ public Rectangle getBounds() { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + return DPIUtil.autoScaleBounds(getBoundsInPixels(), 100, currentDeviceZoom); +} + +/** + * Returns the bounds of the receiver. The rectangle will always + * have x and y values of 0, and the width and height of the + * image in pixels. + * + * @return a rectangle specifying the image's bounds in pixels. + * + * @exception SWTException <ul> + * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon</li> + * </ul> + * @since 3.105 + */ +public Rectangle getBoundsInPixels() { + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (width != -1 && height != -1) { return new Rectangle(0, 0, width, height); } @@ -1270,11 +1350,12 @@ } /** - * Returns an <code>ImageData</code> based on the receiver + * Returns an <code>ImageData</code> based on the receiver. * Modifications made to this <code>ImageData</code> will not * affect the Image. * - * @return an <code>ImageData</code> containing the image's data and attributes + * @return an <code>ImageData</code> containing the image's data and + * attributes at 100% zoom level. * * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> @@ -1283,7 +1364,29 @@ * * @see ImageData */ -public ImageData getImageData() { +public ImageData getImageData () { + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + return getImageData(100); + +} + +/** + * Returns an <code>ImageData</code> based on the receiver. + * Modifications made to this <code>ImageData</code> will not + * affect the Image. + * + * @return an <code>ImageData</code> containing the image's data + * and attributes at the current zoom level. + * + * @exception SWTException <ul> + * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon</li> + * </ul> + * + * @see ImageData + * @since 3.105 + */ +public ImageData getImageDataAtCurrentZoom () { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (OS.USE_CAIRO) { @@ -1396,6 +1499,32 @@ } /** + * Returns an <code>ImageData</code> for specified zoom, based on the receiver + * Modifications made to this <code>ImageData</code> will not affect the + * Image. + * + * @param zoom + * The zoom level in % of the standard resolution (which is 1 + * physical monitor pixel == 1 SWT logical pixel). Typically 100, + * 150, or 200. + * @return an <code>ImageData</code> containing the image's data and + * attributes at specified zoom if present else null is returned. + * + * @exception SWTException <ul> + * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon</li> + * </ul> + * + * @see ImageData + * + * @since 3.105 + */ +ImageData getImageData (int zoom) { + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + return DPIUtil.autoScaleImageData (device, getImageDataAtCurrentZoom (), zoom, currentDeviceZoom); +} + +/** * Invokes platform specific functionality to allocate a new image. * <p> * <b>IMPORTANT:</b> This method is <em>not</em> part of the public @@ -1749,6 +1878,7 @@ * * @noreference This method is not intended to be referenced by clients. */ +@Override public int /*long*/ internal_new_GC (GCData data) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (type != SWT.BITMAP || memGC != null) { @@ -1794,6 +1924,7 @@ * * @noreference This method is not intended to be referenced by clients. */ +@Override public void internal_dispose_GC (int /*long*/ hDC, GCData data) { int /*long*/ gc = hDC; if (OS.USE_CAIRO) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/ImageLoaderEvent.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/ImageLoaderEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/ImageLoaderEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/ImageLoaderEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -20,20 +20,20 @@ * <b>Notes:</b> * </p><ul> * <li>The number of events which will be sent when loading images - * is not constant. It varies by image type, and for JPEG images it + * is not constant. It varies by image type, and for JPEG images it * varies from image to image.</li> - * <li>For image sources which contain multiple images, the + * <li>For image sources which contain multiple images, the * <code>endOfImage</code> flag in the event will be set to true * after each individual image is loaded.</li> * </ul> - * + * * @see ImageLoader * @see ImageLoaderListener * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public class ImageLoaderEvent extends SWTEventObject { - + /** * if the <code>endOfImage</code> flag is false, then this is a * partially complete copy of the current <code>ImageData</code>, @@ -55,9 +55,9 @@ * exception is thrown */ public boolean endOfImage; - + static final long serialVersionUID = 3257284738325558065L; - + /** * Constructs a new instance of this class given the event source and * the values to store in its fields. diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/ImageLoader.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/ImageLoader.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/ImageLoader.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/ImageLoader.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -12,9 +12,9 @@ import java.io.*; -import java.util.Vector; +import java.util.*; + import org.eclipse.swt.*; -import org.eclipse.swt.internal.Compatibility; import org.eclipse.swt.internal.image.*; /** @@ -43,14 +43,14 @@ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public class ImageLoader { - + /** * the array of ImageData objects in this ImageLoader. * This array is read in when the load method is called, * and it is written out when the save method is called */ public ImageData[] data; - + /** * the width of the logical screen on which the images * reside, in pixels (this corresponds to the GIF89a @@ -66,10 +66,10 @@ public int logicalScreenHeight; /** - * the background pixel for the logical screen (this + * the background pixel for the logical screen (this * corresponds to the GIF89a Background Color Index value). * The default is -1 which means 'unspecified background' - * + * */ public int backgroundPixel; @@ -80,27 +80,27 @@ * The default is 1. A value of 0 means 'display repeatedly' */ public int repeatCount; - + /** * This is the compression used when saving jpeg and png files. * <p> - * When saving jpeg files, the value is from 1 to 100, - * where 1 is very high compression but low quality, and 100 is + * When saving jpeg files, the value is from 1 to 100, + * where 1 is very high compression but low quality, and 100 is * no compression and high quality; default is 75. * </p><p> - * When saving png files, the value is from 0 to 3, but they do not impact the quality + * When saving png files, the value is from 0 to 3, but they do not impact the quality * because PNG is lossless compression. 0 is uncompressed, 1 is low compression and fast, * 2 is default compression, and 3 is high compression but slow. * </p> - * + * * @since 3.8 */ public int compression; - + /* * the set of ImageLoader event listeners, created on demand */ - Vector<ImageLoaderListener> imageLoaderListeners; + List<ImageLoaderListener> imageLoaderListeners; /** * Construct a new empty ImageLoader. @@ -169,7 +169,7 @@ if (filename == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); InputStream stream = null; try { - stream = Compatibility.newFileInputStream(filename); + stream = new FileInputStream(filename); return load(stream); } catch (IOException e) { SWT.error(SWT.ERROR_IO, e); @@ -252,7 +252,7 @@ if (filename == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); OutputStream stream = null; try { - stream = Compatibility.newFileOutputStream(filename); + stream = new FileOutputStream(filename); } catch (IOException e) { SWT.error(SWT.ERROR_IO, e); } @@ -263,43 +263,43 @@ } } -/** +/** * Adds the listener to the collection of listeners who will be * notified when image data is either partially or completely loaded. * <p> * An ImageLoaderListener should be added before invoking - * one of the receiver's load methods. The listener's + * one of the receiver's load methods. The listener's * <code>imageDataLoaded</code> method is called when image * data has been partially loaded, as is supported by interlaced * GIF/PNG or progressive JPEG images. * * @param listener the listener which should be notified - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> - * + * * @see ImageLoaderListener * @see ImageLoaderEvent */ public void addImageLoaderListener(ImageLoaderListener listener) { if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); if (imageLoaderListeners == null) { - imageLoaderListeners = new Vector<ImageLoaderListener>(); + imageLoaderListeners = new ArrayList<>(); } imageLoaderListeners.add(listener); } -/** +/** * Removes the listener from the collection of listeners who will be * notified when image data is either partially or completely loaded. * * @param listener the listener which should no longer be notified - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> - * + * * @see #addImageLoaderListener(ImageLoaderListener) */ public void removeImageLoaderListener(ImageLoaderListener listener) { @@ -308,7 +308,7 @@ imageLoaderListeners.remove(listener); } -/** +/** * Returns <code>true</code> if the receiver has image loader * listeners, and <code>false</code> otherwise. * @@ -321,7 +321,7 @@ return imageLoaderListeners != null && imageLoaderListeners.size() > 0; } -/** +/** * Notifies all image loader listeners that an image loader event * has occurred. Pass the specified event object to each listener. * diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/ImageLoaderListener.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/ImageLoaderListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/ImageLoaderListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/ImageLoaderListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -15,7 +15,7 @@ /** * Classes which implement this interface provide methods - * that deal with the incremental loading of image data. + * that deal with the incremental loading of image data. * <p> * After creating an instance of a class that implements * this interface it can be added to an image loader using the diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/LineAttributes.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/LineAttributes.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/LineAttributes.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/LineAttributes.java 2016-07-06 19:11:33.000000000 +0000 @@ -20,11 +20,11 @@ * resources managed by each instance when those instances are no longer * required, and thus no <code>dispose()</code> method is provided. * </p> - * + * * @see GC#getLineAttributes() * @see GC#setLineAttributes(LineAttributes) * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.3 */ public class LineAttributes { @@ -36,7 +36,7 @@ /** * The line style. - * + * * @see org.eclipse.swt.SWT#LINE_CUSTOM * @see org.eclipse.swt.SWT#LINE_DASH * @see org.eclipse.swt.SWT#LINE_DASHDOT @@ -48,7 +48,7 @@ /** * The line cap style. - * + * * @see org.eclipse.swt.SWT#CAP_FLAT * @see org.eclipse.swt.SWT#CAP_ROUND * @see org.eclipse.swt.SWT#CAP_SQUARE @@ -57,7 +57,7 @@ /** * The line join style. - * + * * @see org.eclipse.swt.SWT#JOIN_BEVEL * @see org.eclipse.swt.SWT#JOIN_MITER * @see org.eclipse.swt.SWT#JOIN_ROUND @@ -79,7 +79,7 @@ */ public float miterLimit; -/** +/** * Create a new line attributes with the specified line width. * * @param width the line width @@ -87,8 +87,8 @@ public LineAttributes(float width) { this(width, SWT.CAP_FLAT, SWT.JOIN_MITER, SWT.LINE_SOLID, null, 0, 10); } - -/** + +/** * Create a new line attributes with the specified line cap, join and width. * * @param width the line width @@ -99,7 +99,7 @@ this(width, cap, join, SWT.LINE_SOLID, null, 0, 10); } -/** +/** * Create a new line attributes with the specified arguments. * * @param width the line width @@ -153,8 +153,8 @@ } /** - * Returns an integer hash code for the receiver. Any two - * objects that return <code>true</code> when passed to + * Returns an integer hash code for the receiver. Any two + * objects that return <code>true</code> when passed to * <code>equals</code> must return the same value for this * method. * diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/PaletteData.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/PaletteData.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/PaletteData.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/PaletteData.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2015 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Lars Vogel <Lars.Vogel@vogella.com> - Bug 483460 *******************************************************************************/ package org.eclipse.swt.graphics; @@ -52,46 +53,46 @@ * @see RGB * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ - + public final class PaletteData { - + /** - * true if the receiver is a direct palette, + * true if the receiver is a direct palette, * and false otherwise */ public boolean isDirect; - + /** * the RGB values for an indexed palette, where the * indices of the array correspond to pixel values */ public RGB[] colors; - + /** * the red mask for a direct palette */ public int redMask; - + /** * the green mask for a direct palette */ public int greenMask; - + /** * the blue mask for a direct palette */ public int blueMask; - + /** * the red shift for a direct palette */ public int redShift; - + /** * the green shift for a direct palette */ public int greenShift; - + /** * the blue shift for a direct palette */ @@ -106,7 +107,7 @@ * <li>ERROR_NULL_ARGUMENT - if the argument is null</li> * </ul> */ -public PaletteData(RGB[] colors) { +public PaletteData(RGB... colors) { if (colors == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); this.colors = colors; this.isDirect = false; @@ -134,7 +135,7 @@ * * @param rgb the RGB to get the pixel value for * @return the pixel value for the given RGB - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the argument is null</li> * <li>ERROR_INVALID_ARGUMENT - if the RGB is not found in the palette</li> @@ -205,7 +206,7 @@ * @see PaletteData */ int shiftForMask(int mask) { - for (int i = 31; i >= 0; i--) { + for (int i = 31; i >= 0; i--) { if (((mask >> i) & 0x1) != 0) return 7 - i; } return 32; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/PathData.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/PathData.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/PathData.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/PathData.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,16 +16,16 @@ * * @see Path * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.1 */ public final class PathData { - + /** - * The type of each point. + * The type of each point. */ public byte[] types; - + /** * The points of a path. */ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/Path.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/Path.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/Path.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/Path.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -20,7 +20,7 @@ * described using lines, rectangles, arcs, cubic or quadratic bezier curves, * glyphs, or other paths. * <p> - * Application code must explicitly invoke the <code>Path.dispose()</code> + * Application code must explicitly invoke the <code>Path.dispose()</code> * method to release the operating system resources managed by each instance * when those instances are no longer required. * </p> @@ -32,11 +32,11 @@ * @see <a href="http://www.eclipse.org/swt/snippets/#path">Path, Pattern snippets</a> * @see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: GraphicsExample</a> * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.1 */ public class Path extends Resource { - + /** * the OS resource for the Path * (Warning: This field is platform dependent) @@ -46,11 +46,11 @@ * within the packages provided by SWT. It is not available on all * platforms and should never be accessed from application code. * </p> - * + * * @noreference This field is not intended to be referenced by clients. */ public int /*long*/ handle; - + boolean moved, closed = true; /** @@ -63,9 +63,9 @@ * <p> * You must dispose the path when it is no longer required. * </p> - * + * * @param device the device on which to allocate the path - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the device is null and there is no current device</li> * </ul> @@ -75,7 +75,7 @@ * @exception SWTError <ul> * <li>ERROR_NO_HANDLES if a handle for the path could not be obtained</li> * </ul> - * + * * @see #dispose() */ public Path (Device device) { @@ -103,11 +103,11 @@ * <p> * You must dispose the path when it is no longer required. * </p> - * + * * @param device the device on which to allocate the path * @param path the path to make a copy * @param flatness the flatness value - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the device is null and there is no current device</li> * <li>ERROR_NULL_ARGUMENT - if the path is null</li> @@ -119,7 +119,7 @@ * @exception SWTError <ul> * <li>ERROR_NO_HANDLES if a handle for the path could not be obtained</li> * </ul> - * + * * @see #dispose() * @since 3.4 */ @@ -135,7 +135,7 @@ int /*long*/ copy; flatness = Math.max(0, flatness); if (flatness == 0) { - copy = Cairo.cairo_copy_path(path.handle); + copy = Cairo.cairo_copy_path(path.handle); } else { double tolerance = Cairo.cairo_get_tolerance(path.handle); Cairo.cairo_set_tolerance(path.handle, flatness); @@ -161,10 +161,10 @@ * <p> * You must dispose the path when it is no longer required. * </p> - * + * * @param device the device on which to allocate the path * @param data the data for the path - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the device is null and there is no current device</li> * <li>ERROR_NULL_ARGUMENT - if the data is null</li> @@ -175,7 +175,7 @@ * @exception SWTError <ul> * <li>ERROR_NO_HANDLES if a handle for the path could not be obtained</li> * </ul> - * + * * @see #dispose() * @since 3.4 */ @@ -189,15 +189,15 @@ * Adds to the receiver a circular or elliptical arc that lies within * the specified rectangular area. * <p> - * The resulting arc begins at <code>startAngle</code> and extends + * The resulting arc begins at <code>startAngle</code> and extends * for <code>arcAngle</code> degrees. * Angles are interpreted such that 0 degrees is at the 3 o'clock * position. A positive value indicates a counter-clockwise rotation * while a negative value indicates a clockwise rotation. * </p><p> - * The center of the arc is the center of the rectangle whose origin - * is (<code>x</code>, <code>y</code>) and whose size is specified by the - * <code>width</code> and <code>height</code> arguments. + * The center of the arc is the center of the rectangle whose origin + * is (<code>x</code>, <code>y</code>) and whose size is specified by the + * <code>width</code> and <code>height</code> arguments. * </p><p> * The resulting arc covers an area <code>width + 1</code> pixels wide * by <code>height + 1</code> pixels tall. @@ -216,25 +216,33 @@ */ public void addArc(float x, float y, float width, float height, float startAngle, float arcAngle) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + x = DPIUtil.autoScaleUp(x); + y = DPIUtil.autoScaleUp(y); + width = DPIUtil.autoScaleUp(width); + height = DPIUtil.autoScaleUp(height); + addArcInPixels(x, y, width, height, startAngle, arcAngle); +} + +void addArcInPixels(float x, float y, float width, float height, float startAngle, float arcAngle) { moved = true; if (width == height) { - float angle = -startAngle * (float)Compatibility.PI / 180; + float angle = -startAngle * (float)Math.PI / 180; if (closed) Cairo.cairo_move_to(handle, (x + width / 2f) + width / 2f * Math.cos(angle), (y + height / 2f) + height / 2f * Math.sin(angle)); if (arcAngle >= 0) { - Cairo.cairo_arc_negative(handle, x + width / 2f, y + height / 2f, width / 2f, angle, -(startAngle + arcAngle) * (float)Compatibility.PI / 180); + Cairo.cairo_arc_negative(handle, x + width / 2f, y + height / 2f, width / 2f, angle, -(startAngle + arcAngle) * (float)Math.PI / 180); } else { - Cairo.cairo_arc(handle, x + width / 2f, y + height / 2f, width / 2f, angle, -(startAngle + arcAngle) * (float)Compatibility.PI / 180); + Cairo.cairo_arc(handle, x + width / 2f, y + height / 2f, width / 2f, angle, -(startAngle + arcAngle) * (float)Math.PI / 180); } } else { Cairo.cairo_save(handle); Cairo.cairo_translate(handle, x + width / 2f, y + height / 2f); Cairo.cairo_scale(handle, width / 2f, height / 2f); - float angle = -startAngle * (float)Compatibility.PI / 180; + float angle = -startAngle * (float)Math.PI / 180; if (closed) Cairo.cairo_move_to(handle, Math.cos(angle), Math.sin(angle)); if (arcAngle >= 0) { - Cairo.cairo_arc_negative(handle, 0, 0, 1, angle, -(startAngle + arcAngle) * (float)Compatibility.PI / 180); + Cairo.cairo_arc_negative(handle, 0, 0, 1, angle, -(startAngle + arcAngle) * (float)Math.PI / 180); } else { - Cairo.cairo_arc(handle, 0, 0, 1, angle, -(startAngle + arcAngle) * (float)Compatibility.PI / 180); + Cairo.cairo_arc(handle, 0, 0, 1, angle, -(startAngle + arcAngle) * (float)Math.PI / 180); } Cairo.cairo_restore(handle); } @@ -281,6 +289,14 @@ */ public void addRectangle(float x, float y, float width, float height) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + x = DPIUtil.autoScaleUp(x); + y = DPIUtil.autoScaleUp(y); + width = DPIUtil.autoScaleUp(width); + height = DPIUtil.autoScaleUp(height); + addRectangleInPixels(x, y, width, height); +} + +void addRectangleInPixels(float x, float y, float width, float height) { moved = false; Cairo.cairo_rectangle(handle, x, y, width, height); closed = true; @@ -307,6 +323,16 @@ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (font == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + x = DPIUtil.autoScaleUp(x); + y = DPIUtil.autoScaleUp(y); + // Scale up the font + FontData fd = font.getFontData()[0]; + fd.setHeight(DPIUtil.autoScaleUp(fd.getHeight())); + Font scaledFont = new Font(font.getDevice(), fd); + addStringInPixels(string, x, y, scaledFont); + scaledFont.dispose(); // Dispose the scaled up font +} +void addStringInPixels(String string, float x, float y, Font font) { moved = false; GC.addCairoString(handle, string, x, y, font); closed = true; @@ -355,6 +381,11 @@ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (gc == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (gc.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + x = DPIUtil.autoScaleUp(x); + y = DPIUtil.autoScaleUp(y); + return containsInPixels(x, y, gc, outline); +} +boolean containsInPixels(float x, float y, GC gc, boolean outline) { //TODO - see Windows gc.initCairo(); gc.checkGC(GC.LINE_CAP | GC.LINE_JOIN | GC.LINE_STYLE | GC.LINE_WIDTH); @@ -365,7 +396,7 @@ Cairo.cairo_append_path(cairo, copy); Cairo.cairo_path_destroy(copy); if (outline) { - result = Cairo.cairo_in_stroke(cairo, x, y) != 0; + result = Cairo.cairo_in_stroke(cairo, x, y) != 0; } else { result = Cairo.cairo_in_fill(cairo, x, y) != 0; } @@ -389,6 +420,15 @@ */ public void cubicTo(float cx1, float cy1, float cx2, float cy2, float x, float y) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + cx1 = DPIUtil.autoScaleUp(cx1); + cy1 = DPIUtil.autoScaleUp(cy1); + cx2 = DPIUtil.autoScaleUp(cx2); + cy2 = DPIUtil.autoScaleUp(cy2); + x = DPIUtil.autoScaleUp(x); + y = DPIUtil.autoScaleUp(y); + cubicToInPixels(cx1, cy1, cx2, cy2, x, y); +} +void cubicToInPixels(float cx1, float cy1, float cx2, float cy2, float x, float y) { if (!moved) { double[] currentX = new double[1], currentY = new double[1]; Cairo.cairo_get_current_point(handle, currentX, currentY); @@ -405,7 +445,7 @@ * receiver (i.e. the bounding box). * * @param bounds the array to hold the result - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the parameter is null</li> * <li>ERROR_INVALID_ARGUMENT - if the parameter is too small to hold the bounding box</li> @@ -418,6 +458,12 @@ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (bounds == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (bounds.length < 4) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + getBoundsInPixels(bounds); + for (int i = 0; i < bounds.length; i++) { + bounds [i] = DPIUtil.autoScaleDown(bounds[i]); + } +} +void getBoundsInPixels(float[] bounds) { int /*long*/ copy = Cairo.cairo_copy_path(handle); if (copy == 0) SWT.error(SWT.ERROR_NO_HANDLES); cairo_path_t path = new cairo_path_t(); @@ -427,7 +473,7 @@ minX = minY = Double.POSITIVE_INFINITY; maxX = maxY = Double.NEGATIVE_INFINITY; int i = 0; - double[] points = new double[6]; + double[] points = new double[6]; cairo_path_data_t data = new cairo_path_data_t(); while (i < path.num_data) { int /*long*/ offset = path.data + i * cairo_path_data_t.sizeof; @@ -479,7 +525,7 @@ * describe the current point of the path. * * @param point the array to hold the result - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the parameter is null</li> * <li>ERROR_INVALID_ARGUMENT - if the parameter is too small to hold the end point</li> @@ -490,6 +536,13 @@ */ public void getCurrentPoint(float[] point) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + getCurrentPointInPixels(point); + for (int i = 0; i < point.length; i++) { + point [i] = DPIUtil.autoScaleDown(point[i]); + } +} + +void getCurrentPointInPixels(float[] point) { if (point == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (point.length < 2) SWT.error(SWT.ERROR_INVALID_ARGUMENT); double[] x = new double[1], y = new double[1]; @@ -500,17 +553,23 @@ /** * Returns a device independent representation of the receiver. - * + * * @return the PathData for the receiver - * + * * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> - * + * * @see PathData */ public PathData getPathData() { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + PathData result = getPathDataInPixels(); + result.points = DPIUtil.autoScaleDown(result.points); + return result; +} + +PathData getPathDataInPixels() { int /*long*/ copy = Cairo.cairo_copy_path(handle); if (copy == 0) SWT.error(SWT.ERROR_NO_HANDLES); cairo_path_t path = new cairo_path_t(); @@ -520,7 +579,7 @@ int typeIndex = 0, ptsIndex = 0; if (path.num_data > 0) { int i = 0; - double[] points = new double[6]; + double[] points = new double[6]; cairo_path_data_t data = new cairo_path_data_t(); while (i < path.num_data) { int /*long*/ offset = path.data + i * cairo_path_data_t.sizeof; @@ -585,6 +644,11 @@ */ public void lineTo(float x, float y) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + x = DPIUtil.autoScaleUp(x); + y = DPIUtil.autoScaleUp(y); + lineToInPixels(x, y); +} +void lineToInPixels(float x, float y) { if (!moved) { double[] currentX = new double[1], currentY = new double[1]; Cairo.cairo_get_current_point(handle, currentX, currentY); @@ -609,12 +673,17 @@ */ public void moveTo(float x, float y) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + x = DPIUtil.autoScaleUp(x); + y = DPIUtil.autoScaleUp(y); + moveToInPixels(x, y); +} +void moveToInPixels(float x, float y) { /* * Bug in Cairo. If cairo_move_to() is not called at the * begining of a subpath, the first cairo_line_to() or * cairo_curve_to() segment do not output anything. The fix * is to detect that the app did not call cairo_move_to() - * before those calls and call it explicitly. + * before those calls and call it explicitly. */ moved = true; Cairo.cairo_move_to(handle, x, y); @@ -635,6 +704,13 @@ */ public void quadTo(float cx, float cy, float x, float y) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + x = DPIUtil.autoScaleUp(x); + y = DPIUtil.autoScaleUp(y); + cx = DPIUtil.autoScaleUp(cx); + cy = DPIUtil.autoScaleUp(cy); + quadToInPixels(cx, cy, x, y); +} +void quadToInPixels(float cx, float cy, float x, float y) { double[] currentX = new double[1], currentY = new double[1]; Cairo.cairo_get_current_point(handle, currentX, currentY); if (!moved) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/Pattern.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/Pattern.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/Pattern.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/Pattern.java 2016-07-06 19:11:33.000000000 +0000 @@ -11,13 +11,14 @@ package org.eclipse.swt.graphics; import org.eclipse.swt.*; +import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.cairo.*; /** * Instances of this class represent patterns to use while drawing. Patterns * can be specified either as bitmaps or gradients. * <p> - * Application code must explicitly invoke the <code>Pattern.dispose()</code> + * Application code must explicitly invoke the <code>Pattern.dispose()</code> * method to release the operating system resources managed by each instance * when those instances are no longer required. * </p> @@ -25,7 +26,7 @@ * This class requires the operating system's advanced graphics subsystem * which may not be available on some platforms. * </p> - * + * * @see <a href="http://www.eclipse.org/swt/snippets/#path">Path, Pattern snippets</a> * @see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: GraphicsExample</a> * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> @@ -43,11 +44,11 @@ * within the packages provided by SWT. It is not available on all * platforms and should never be accessed from application code. * </p> - * + * * @noreference This field is not intended to be referenced by clients. */ public int /*long*/ handle; - + int /*long*/ surface; /** @@ -61,10 +62,10 @@ * <p> * You must dispose the pattern when it is no longer required. * </p> - * + * * @param device the device on which to allocate the pattern * @param image the image that the pattern will draw - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the device is null and there is no current device, or the image is null</li> * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li> @@ -75,7 +76,7 @@ * @exception SWTError <ul> * <li>ERROR_NO_HANDLES if a handle for the pattern could not be obtained</li> * </ul> - * + * * @see #dispose() */ public Pattern(Device device, Image image) { @@ -103,7 +104,7 @@ * <p> * You must dispose the pattern when it is no longer required. * </p> - * + * * @param device the device on which to allocate the pattern * @param x1 the x coordinate of the starting corner of the gradient * @param y1 the y coordinate of the starting corner of the gradient @@ -111,9 +112,9 @@ * @param y2 the y coordinate of the ending corner of the gradient * @param color1 the starting color of the gradient * @param color2 the ending color of the gradient - * + * * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the device is null and there is no current device, + * <li>ERROR_NULL_ARGUMENT - if the device is null and there is no current device, * or if either color1 or color2 is null</li> * <li>ERROR_INVALID_ARGUMENT - if either color1 or color2 has been disposed</li> * </ul> @@ -123,7 +124,7 @@ * @exception SWTError <ul> * <li>ERROR_NO_HANDLES if a handle for the pattern could not be obtained</li> * </ul> - * + * * @see #dispose() */ public Pattern(Device device, float x1, float y1, float x2, float y2, Color color1, Color color2) { @@ -141,7 +142,7 @@ * <p> * You must dispose the pattern when it is no longer required. * </p> - * + * * @param device the device on which to allocate the pattern * @param x1 the x coordinate of the starting corner of the gradient * @param y1 the y coordinate of the starting corner of the gradient @@ -151,9 +152,9 @@ * @param alpha1 the starting alpha value of the gradient * @param color2 the ending color of the gradient * @param alpha2 the ending alpha value of the gradient - * + * * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the device is null and there is no current device, + * <li>ERROR_NULL_ARGUMENT - if the device is null and there is no current device, * or if either color1 or color2 is null</li> * <li>ERROR_INVALID_ARGUMENT - if either color1 or color2 has been disposed</li> * </ul> @@ -163,13 +164,17 @@ * @exception SWTError <ul> * <li>ERROR_NO_HANDLES if a handle for the pattern could not be obtained</li> * </ul> - * + * * @see #dispose() - * + * * @since 3.2 */ public Pattern(Device device, float x1, float y1, float x2, float y2, Color color1, int alpha1, Color color2, int alpha2) { super(device); + x1 = DPIUtil.autoScaleUp(x1); + y1 = DPIUtil.autoScaleUp(y1); + x2 = DPIUtil.autoScaleUp(x2); + y2 = DPIUtil.autoScaleUp(y2); if (color1 == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (color1.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); if (color2 == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); @@ -182,7 +187,7 @@ Cairo.cairo_pattern_set_extend(handle, Cairo.CAIRO_EXTEND_REPEAT); init(); } - + @Override void destroy() { Cairo.cairo_pattern_destroy(handle); @@ -215,5 +220,5 @@ if (isDisposed()) return "Pattern {*DISPOSED*}"; return "Pattern {" + handle + "}"; } - + } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/Point.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/Point.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/Point.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/Point.java 2016-07-06 19:11:33.000000000 +0000 @@ -11,7 +11,7 @@ package org.eclipse.swt.graphics; -import org.eclipse.swt.internal.SerializableCompatibility; +import java.io.*; /** * Instances of this class represent places on the (x, y) @@ -26,7 +26,7 @@ * The hashCode() method in this class uses the values of the public * fields to compute the hash value. When storing instances of the * class in hashed collections, do not modify these fields after the - * object has been inserted. + * object has been inserted. * </p> * <p> * Application code does <em>not</em> need to explicitly release the @@ -38,20 +38,20 @@ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ -public final class Point implements SerializableCompatibility { - +public final class Point implements Serializable { + /** * the x coordinate of the point */ public int x; - + /** * the y coordinate of the point */ public int y; - + static final long serialVersionUID = 3257002163938146354L; - + /** * Constructs a new point with the given x and y coordinates. * @@ -82,8 +82,8 @@ } /** - * Returns an integer hash code for the receiver. Any two - * objects that return <code>true</code> when passed to + * Returns an integer hash code for the receiver. Any two + * objects that return <code>true</code> when passed to * <code>equals</code> must return the same value for this * method. * diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/Rectangle.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/Rectangle.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/Rectangle.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/Rectangle.java 2016-07-06 19:11:33.000000000 +0000 @@ -11,7 +11,8 @@ package org.eclipse.swt.graphics; -import org.eclipse.swt.internal.SerializableCompatibility; +import java.io.*; + import org.eclipse.swt.*; /** @@ -29,7 +30,7 @@ * The hashCode() method in this class uses the values of the public * fields to compute the hash value. When storing instances of the * class in hashed collections, do not modify these fields after the - * object has been inserted. + * object has been inserted. * </p> * <p> * Application code does <em>not</em> need to explicitly release the @@ -41,32 +42,32 @@ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ -public final class Rectangle implements SerializableCompatibility { - +public final class Rectangle implements Serializable { + /** * the x coordinate of the rectangle */ public int x; - + /** * the y coordinate of the rectangle */ public int y; - + /** * the width of the rectangle */ public int width; - + /** * the height of the rectangle */ public int height; static final long serialVersionUID = 3256439218279428914L; - + /** - * Construct a new instance of this class given the + * Construct a new instance of this class given the * x, y, width and height values. * * @param x the x coordinate of the origin of the rectangle @@ -159,8 +160,8 @@ } /** - * Returns an integer hash code for the receiver. Any two - * objects that return <code>true</code> when passed to + * Returns an integer hash code for the receiver. Any two + * objects that return <code>true</code> when passed to * <code>equals</code> must return the same value for this * method. * @@ -183,7 +184,7 @@ * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the argument is null</li> * </ul> - * + * * since 3.0 */ public void intersect (Rectangle rect) { @@ -205,7 +206,7 @@ /** * Returns a new rectangle which represents the intersection - * of the receiver and the given rectangle. + * of the receiver and the given rectangle. * <p> * The intersection of two rectangles is the rectangle that * covers the area which is contained within both rectangles. @@ -257,7 +258,7 @@ * * @see #intersection(Rectangle) * @see #isEmpty() - * + * * @since 3.0 */ public boolean intersects (int x, int y, int width, int height) { @@ -287,14 +288,14 @@ if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); return rect == this || intersects (rect.x, rect.y, rect.width, rect.height); } - + /** * Returns <code>true</code> if the receiver does not cover any * area in the (x, y) coordinate plane, and <code>false</code> if * the receiver does cover some area in the plane. * <p> - * A rectangle is considered to <em>cover area</em> in the - * (x, y) coordinate plane if both its width and height are + * A rectangle is considered to <em>cover area</em> in the + * (x, y) coordinate plane if both its width and height are * non-zero. * </p> * diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/Region.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/Region.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/Region.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/Region.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -11,9 +11,10 @@ package org.eclipse.swt.graphics; +import org.eclipse.swt.*; +import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.cairo.*; import org.eclipse.swt.internal.gtk.*; -import org.eclipse.swt.*; /** * Instances of this class represent areas of an x-y coordinate @@ -48,7 +49,7 @@ * <p> * You must dispose the region when it is no longer required. * </p> - * + * * @exception SWTError <ul> * <li>ERROR_NO_HANDLES if a handle could not be obtained for region creation</li> * </ul> @@ -155,11 +156,14 @@ * </ul> * * @since 3.0 -* + * */ public void add (int[] pointArray) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + addInPixels(DPIUtil.autoScaleUp(pointArray)); +} +void addInPixels (int[] pointArray) { /* * Bug in GTK. If gdk_region_polygon() is called with one point, * it segment faults. The fix is to make sure that it is called @@ -188,7 +192,10 @@ public void add(Rectangle rect) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - add (rect.x, rect.y, rect.width, rect.height); + addInPixels(DPIUtil.autoScaleUp(rect)); +} +void addInPixels(Rectangle rect) { + addInPixels (rect.x, rect.y, rect.width, rect.height); } /** @@ -212,6 +219,9 @@ public void add(int x, int y, int width, int height) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (width < 0 || height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + add(new Rectangle(x, y, width, height)); +} +void addInPixels(int x, int y, int width, int height) { GdkRectangle gdkRect = new GdkRectangle(); gdkRect.x = x; gdkRect.y = y; @@ -257,6 +267,9 @@ */ public boolean contains(int x, int y) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + return contains(new Point(x, y)); +} +boolean containsInPixels(int x, int y) { return OS.gdk_region_point_in(handle, x, y); } @@ -276,8 +289,12 @@ * </ul> */ public boolean contains(Point pt) { + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + return containsInPixels(DPIUtil.autoScaleUp(pt)); +} +boolean containsInPixels(Point pt) { if (pt == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - return contains(pt.x, pt.y); + return containsInPixels(pt.x, pt.y); } @Override @@ -319,6 +336,9 @@ */ public Rectangle getBounds() { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + return DPIUtil.autoScaleDown(getBoundsInPixels()); +} +Rectangle getBoundsInPixels() { GdkRectangle gdkRect = new GdkRectangle(); OS.gdk_region_get_clipbox(handle, gdkRect); return new Rectangle(gdkRect.x, gdkRect.y, gdkRect.width, gdkRect.height); @@ -378,7 +398,11 @@ public void intersect(Rectangle rect) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - intersect (rect.x, rect.y, rect.width, rect.height); + intersectInPixels(DPIUtil.autoScaleUp(rect)); +} + +void intersectInPixels(Rectangle rect) { + intersectInPixels (rect.x, rect.y, rect.width, rect.height); } /** @@ -402,6 +426,10 @@ public void intersect(int x, int y, int width, int height) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (width < 0 || height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + intersect(new Rectangle(x, y, width, height)); +} + +void intersectInPixels(int x, int y, int width, int height) { GdkRectangle gdkRect = new GdkRectangle(); gdkRect.x = x; gdkRect.y = y; @@ -455,6 +483,10 @@ */ public boolean intersects (int x, int y, int width, int height) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + return intersects(new Rectangle(x, y, width, height)); +} + +boolean intersectsInPixels (int x, int y, int width, int height) { GdkRectangle gdkRect = new GdkRectangle(); gdkRect.x = x; gdkRect.y = y; @@ -481,7 +513,12 @@ */ public boolean intersects(Rectangle rect) { if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - return intersects(rect.x, rect.y, rect.width, rect.height); + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + return intersectsInPixels(DPIUtil.autoScaleUp(rect)); +} + +boolean intersectsInPixels(Rectangle rect) { + return intersectsInPixels(rect.x, rect.y, rect.width, rect.height); } /** @@ -533,6 +570,10 @@ public void subtract (int[] pointArray) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + subtractInPixels(DPIUtil.autoScaleUp(pointArray)); +} + +void subtractInPixels (int[] pointArray) { /* * Bug in GTK. If gdk_region_polygon() is called with one point, * it segment faults. The fix is to make sure that it is called @@ -543,7 +584,6 @@ OS.gdk_region_subtract(handle, polyRgn); OS.gdk_region_destroy(polyRgn); } - /** * Subtracts the given rectangle from the collection of polygons * the receiver maintains to describe its area. @@ -563,7 +603,11 @@ public void subtract(Rectangle rect) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - subtract (rect.x, rect.y, rect.width, rect.height); + subtractInPixels(DPIUtil.autoScaleUp(rect)); +} + +void subtractInPixels(Rectangle rect) { + subtractInPixels (rect.x, rect.y, rect.width, rect.height); } /** @@ -587,6 +631,10 @@ public void subtract(int x, int y, int width, int height) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (width < 0 || height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + subtract(new Rectangle(x, y, width, height)); +} + +void subtractInPixels(int x, int y, int width, int height) { GdkRectangle gdkRect = new GdkRectangle(); gdkRect.x = x; gdkRect.y = y; @@ -636,6 +684,10 @@ */ public void translate (int x, int y) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + translate(new Point(x, y)); +} + +void translateInPixels (int x, int y) { OS.gdk_region_offset (handle, x, y); } @@ -657,7 +709,11 @@ public void translate (Point pt) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (pt == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - translate (pt.x, pt.y); + translate(DPIUtil.autoScaleUp(pt)); +} + +void translateInPixels (Point pt) { + translateInPixels (pt.x, pt.y); } /** diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/Resource.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/Resource.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/Resource.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/Resource.java 2016-07-06 19:11:33.000000000 +0000 @@ -13,7 +13,7 @@ import org.eclipse.swt.*; /** - * This class is the abstract superclass of all graphics resource objects. + * This class is the abstract superclass of all graphics resource objects. * Resources created by the application must be disposed. * <p> * IMPORTANT: This class is intended to be subclassed <em>only</em> @@ -32,11 +32,11 @@ * @see #dispose * @see #isDisposed * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.1 */ public abstract class Resource { - + /** * the device where this resource was created */ @@ -73,7 +73,7 @@ * created. * * @return <code>Device</code> the device of the receiver - * + * * @since 3.2 */ public Device getDevice() { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/RGBA.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/RGBA.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/RGBA.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/RGBA.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015 IBM Corporation and others. + * Copyright (c) 2015, 2016 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 @@ -10,8 +10,9 @@ *******************************************************************************/ package org.eclipse.swt.graphics; +import java.io.*; + import org.eclipse.swt.*; -import org.eclipse.swt.internal.*; /** * Instances of this class are descriptions of colors in @@ -26,7 +27,7 @@ * The hashCode() method in this class uses the values of the public * fields to compute the hash value. When storing instances of the * class in hashed collections, do not modify these fields after the - * object has been inserted. + * object has been inserted. * </p> * <p> * Application code does <em>not</em> need to explicitly release the @@ -39,19 +40,19 @@ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> * @since 3.104 */ -public final class RGBA implements SerializableCompatibility { +public final class RGBA implements Serializable { /** * the RGB component of the RGBA */ public final RGB rgb; - + /** * the alpha component of the RGBA */ public int alpha; - + static final long serialVersionUID = 1049467103126495855L; - + /** * Constructs an instance of this class with the given * red, green, blue and alpha values. @@ -85,7 +86,7 @@ * the saturation or brightness is not between 0 and 1 or if the alpha * is not between 0 and 255</li> * </ul> -* +* */ public RGBA(float hue, float saturation, float brightness, float alpha) { if ((alpha > 255) || (alpha < 0)) SWT.error(SWT.ERROR_INVALID_ARGUMENT); @@ -95,7 +96,7 @@ /** * Returns the hue, saturation, and brightness of the color. - * + * * @return color space values in float format:<ul> * <li>hue (from 0 to 360)</li> * <li>saturation (from 0 to 1)</li> @@ -104,10 +105,10 @@ * </ul> * @see #RGBA(float, float, float, float) */ -public float[] getHSBA() { +public float[] getHSBA() { float[] hsb = rgb.getHSB(); return new float[] {hsb[0], hsb[1], hsb[2], alpha}; -} +} /** * Compares the argument to the receiver, and returns true @@ -129,8 +130,8 @@ } /** - * Returns an integer hash code for the receiver. Any two - * objects that return <code>true</code> when passed to + * Returns an integer hash code for the receiver. Any two + * objects that return <code>true</code> when passed to * <code>equals</code> must return the same value for this * method. * @@ -140,7 +141,7 @@ */ @Override public int hashCode() { - return (alpha << 32) | (rgb.blue << 16) | (rgb.green << 8) | rgb.red; + return (alpha << 24) | (rgb.blue << 16) | (rgb.green << 8) | rgb.red; } /** diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/RGB.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/RGB.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/RGB.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/RGB.java 2016-07-06 19:11:33.000000000 +0000 @@ -10,8 +10,9 @@ *******************************************************************************/ package org.eclipse.swt.graphics; +import java.io.*; + import org.eclipse.swt.*; -import org.eclipse.swt.internal.*; /** * Instances of this class are descriptions of colors in @@ -25,7 +26,7 @@ * The hashCode() method in this class uses the values of the public * fields to compute the hash value. When storing instances of the * class in hashed collections, do not modify these fields after the - * object has been inserted. + * object has been inserted. * </p> * <p> * Application code does <em>not</em> need to explicitly release the @@ -38,25 +39,25 @@ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ -public final class RGB implements SerializableCompatibility { - +public final class RGB implements Serializable { + /** * the red component of the RGB */ public int red; - + /** * the green component of the RGB */ public int green; - + /** * the blue component of the RGB */ public int blue; - + static final long serialVersionUID = 3258415023461249074L; - + /** * Constructs an instance of this class with the given * red, green and blue values. @@ -91,20 +92,20 @@ * <li>ERROR_INVALID_ARGUMENT - if the hue is not between 0 and 360 or * the saturation or brightness is not between 0 and 1</li> * </ul> -* +* * @since 3.2 */ public RGB(float hue, float saturation, float brightness) { - if (hue < 0 || hue > 360 || saturation < 0 || saturation > 1 || + if (hue < 0 || hue > 360 || saturation < 0 || saturation > 1 || brightness < 0 || brightness > 1) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); } float r, g, b; if (saturation == 0) { - r = g = b = brightness; + r = g = b = brightness; } else { if (hue == 360) hue = 0; - hue /= 60; + hue /= 60; int i = (int)hue; float f = hue - i; float p = brightness * (1 - saturation); @@ -146,22 +147,22 @@ } red = (int)(r * 255 + 0.5); green = (int)(g * 255 + 0.5); - blue = (int)(b * 255 + 0.5); + blue = (int)(b * 255 + 0.5); } /** * Returns the hue, saturation, and brightness of the color. - * + * * @return color space values in float format:<ul> * <li>hue (from 0 to 360)</li> * <li>saturation (from 0 to 1)</li> * <li>brightness (from 0 to 1)</li> * </ul> * @see #RGB(float, float, float) - * + * * @since 3.2 */ -public float[] getHSB() { +public float[] getHSB() { float r = red / 255f; float g = green / 255f; float b = blue / 255f; @@ -176,7 +177,7 @@ hue = (g - b) / delta; } else { if (g == max) { - hue = 2 + (b - r) / delta; + hue = 2 + (b - r) / delta; } else { hue = 4 + (r - g) / delta; } @@ -185,7 +186,7 @@ if (hue < 0) hue += 360; } return new float[] {hue, saturation, brightness}; -} +} /** * Compares the argument to the receiver, and returns true @@ -206,8 +207,8 @@ } /** - * Returns an integer hash code for the receiver. Any two - * objects that return <code>true</code> when passed to + * Returns an integer hash code for the receiver. Any two + * objects that return <code>true</code> when passed to * <code>equals</code> must return the same value for this * method. * diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/TextLayout.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/TextLayout.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/TextLayout.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/TextLayout.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -10,10 +10,12 @@ *******************************************************************************/ package org.eclipse.swt.graphics; +import java.util.*; + +import org.eclipse.swt.*; import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.cairo.*; import org.eclipse.swt.internal.gtk.*; -import org.eclipse.swt.*; /** * <code>TextLayout</code> is a graphic object that represents @@ -48,7 +50,7 @@ Font font; String text; - int ascent, descent; + int ascentInPoints, descentInPoints; int indent, wrapIndent, wrapWidth; int[] segments; char[] segmentsChars; @@ -87,7 +89,7 @@ OS.pango_layout_set_tabs(layout, device.emptyTab); OS.pango_layout_set_auto_dir(layout, false); text = ""; - wrapWidth = ascent = descent = -1; + wrapWidth = ascentInPoints = descentInPoints = -1; styles = new StyleItem[2]; styles[0] = new StyleItem(); styles[1] = new StyleItem(); @@ -104,7 +106,7 @@ String segmentsText = getSegmentsText(); byte[] buffer = Converter.wcsToMbcs(null, segmentsText, false); OS.pango_layout_set_text (layout, buffer, buffer.length); - if (stylesCount == 2 && styles[0].style == null && ascent == -1 && descent == -1 && segments == null) return; + if (stylesCount == 2 && styles[0].style == null && ascentInPoints == -1 && descentInPoints == -1 && segments == null) return; int /*long*/ ptr = OS.pango_layout_get_text(layout); attrList = OS.pango_attr_list_new(); selAttrList = OS.pango_attr_list_new(); @@ -114,10 +116,10 @@ int nSegments = segementsLength - text.length(); int offsetCount = nSegments; int[] lineOffsets = null; - if ((ascent != -1 || descent != -1) && segementsLength > 0) { + if ((ascentInPoints != -1 || descentInPoints != -1) && segementsLength > 0) { PangoRectangle rect = new PangoRectangle(); - if (ascent != -1) rect.y = -(ascent * OS.PANGO_SCALE); - rect.height = (Math.max(0, ascent) + Math.max(0, descent)) * OS.PANGO_SCALE; + if (ascentInPoints != -1) rect.y = -(DPIUtil.autoScaleUp(ascentInPoints) * OS.PANGO_SCALE); + rect.height = DPIUtil.autoScaleUp((Math.max(0, ascentInPoints) + Math.max(0, descentInPoints))) * OS.PANGO_SCALE; int lineCount = OS.pango_layout_get_line_count(layout); chars = new char[segementsLength + lineCount * 2]; lineOffsets = new int [lineCount]; @@ -289,9 +291,9 @@ GlyphMetrics metrics = style.metrics; if (metrics != null) { PangoRectangle rect = new PangoRectangle(); - rect.y = -(metrics.ascent * OS.PANGO_SCALE); - rect.height = (metrics.ascent + metrics.descent) * OS.PANGO_SCALE; - rect.width = metrics.width * OS.PANGO_SCALE; + rect.y = -(DPIUtil.autoScaleUp(metrics.ascent) * OS.PANGO_SCALE); + rect.height = DPIUtil.autoScaleUp((metrics.ascent + metrics.descent)) * OS.PANGO_SCALE; + rect.width = DPIUtil.autoScaleUp(metrics.width) * OS.PANGO_SCALE; int /*long*/ attr = OS.pango_attr_shape_new (rect, rect); OS.memmove (attribute, attr, PangoAttribute.sizeof); attribute.start_index = byteStart; @@ -302,7 +304,7 @@ } int rise = style.rise; if (rise != 0) { - int /*long*/ attr = OS.pango_attr_rise_new (rise * OS.PANGO_SCALE); + int /*long*/ attr = OS.pango_attr_rise_new (DPIUtil.autoScaleUp(rise) * OS.PANGO_SCALE); OS.memmove (attribute, attr, PangoAttribute.sizeof); attribute.start_index = byteStart; attribute.end_index = byteEnd; @@ -367,7 +369,13 @@ * </ul> */ public void draw(GC gc, int x, int y) { - draw(gc, x, y, -1, -1, null, null); + x = DPIUtil.autoScaleUp(x); + y = DPIUtil.autoScaleUp(y); + drawInPixels(gc, x, y); +} + +void drawInPixels(GC gc, int x, int y) { + drawInPixels(gc, x, y, -1, -1, null, null); } /** @@ -390,7 +398,13 @@ * </ul> */ public void draw(GC gc, int x, int y, int selectionStart, int selectionEnd, Color selectionForeground, Color selectionBackground) { - draw(gc, x, y, selectionStart, selectionEnd, selectionForeground, selectionBackground, 0); + checkLayout (); + x = DPIUtil.autoScaleUp(x); + y = DPIUtil.autoScaleUp(y); + drawInPixels(gc, x, y, selectionStart, selectionEnd, selectionForeground, selectionBackground); +} +void drawInPixels(GC gc, int x, int y, int selectionStart, int selectionEnd, Color selectionForeground, Color selectionBackground) { + drawInPixels(gc, x, y, selectionStart, selectionEnd, selectionForeground, selectionBackground, 0); } /** @@ -422,6 +436,12 @@ */ public void draw(GC gc, int x, int y, int selectionStart, int selectionEnd, Color selectionForeground, Color selectionBackground, int flags) { checkLayout (); + x = DPIUtil.autoScaleUp(x); + y = DPIUtil.autoScaleUp(y); + drawInPixels(gc, x, y, selectionStart, selectionEnd, selectionForeground, selectionBackground, flags); +} +void drawInPixels(GC gc, int x, int y, int selectionStart, int selectionEnd, Color selectionForeground, Color selectionBackground, int flags) { + checkLayout (); computeRuns(); if (gc == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (gc.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); @@ -477,8 +497,8 @@ int lineX = x + OS.PANGO_PIXELS(rect.x) + OS.PANGO_PIXELS(rect.width); int lineY = y + OS.PANGO_PIXELS(rect.y); int height = OS.PANGO_PIXELS(rect.height); - if (ascent != -1 && descent != -1) { - height = Math.max (height, ascent + descent); + if (ascentInPoints != -1 && descentInPoints != -1) { + height = Math.max (height, DPIUtil.autoScaleUp(ascentInPoints + descentInPoints)); } int width = (flags & SWT.FULL_SELECTION) != 0 ? 0x7fff : height / 3; if (cairo != 0) { @@ -757,7 +777,7 @@ */ public int getAscent () { checkLayout(); - return ascent; + return ascentInPoints; } /** @@ -776,6 +796,17 @@ */ public Rectangle getBounds() { checkLayout(); + Rectangle bounds = DPIUtil.autoScaleDown(getBoundsInPixels()); + int lineCount = OS.pango_layout_get_line_count(layout); + int totalLineheight = 0; + for (int i = 0; i < lineCount; i++) { + totalLineheight += this.getLineBounds(i).height; + } + bounds.height = totalLineheight; + return bounds; +} +Rectangle getBoundsInPixels() { + checkLayout(); computeRuns(); int[] w = new int[1], h = new int[1]; OS.pango_layout_get_size(layout, w, h); @@ -783,8 +814,8 @@ w[0] = wrapWidth != -1 ? wrapWidth : w[0] + OS.pango_layout_get_indent(layout); int width = OS.PANGO_PIXELS(w[0]); int height = OS.PANGO_PIXELS(h[0]); - if (ascent != -1 && descent != -1) { - height = Math.max (height, ascent + descent); + if (ascentInPoints != -1 && descentInPoints != -1) { + height = Math.max (height, DPIUtil.autoScaleUp(ascentInPoints + descentInPoints)); } height += OS.PANGO_PIXELS(OS.pango_layout_get_spacing(layout)); return new Rectangle(0, 0, width, height); @@ -806,6 +837,11 @@ */ public Rectangle getBounds(int start, int end) { checkLayout(); + return DPIUtil.autoScaleDown(getBoundsInPixels(start, end)); +} + +Rectangle getBoundsInPixels(int start, int end) { + checkLayout(); computeRuns(); int length = text.length(); if (length == 0) return new Rectangle(0, 0, 0, 0); @@ -879,7 +915,7 @@ */ public int getDescent () { checkLayout(); - return descent; + return descentInPoints; } /** @@ -910,6 +946,10 @@ */ public int getIndent () { checkLayout(); + return DPIUtil.autoScaleDown(getIndentInPixels()); +} + +int getIndentInPixels () { return indent; } @@ -988,6 +1028,10 @@ */ public Rectangle getLineBounds(int lineIndex) { checkLayout(); + return DPIUtil.autoScaleDown(getLineBoundsInPixels(lineIndex)); +} + +Rectangle getLineBoundsInPixels(int lineIndex) { computeRuns(); int lineCount = OS.pango_layout_get_line_count(layout); if (!(0 <= lineIndex && lineIndex < lineCount)) SWT.error(SWT.ERROR_INVALID_RANGE); @@ -1001,8 +1045,8 @@ int y = OS.PANGO_PIXELS(rect.y); int width = OS.PANGO_PIXELS(rect.width); int height = OS.PANGO_PIXELS(rect.height); - if (ascent != -1 && descent != -1) { - height = Math.max (height, ascent + descent); + if (ascentInPoints != -1 && descentInPoints != -1) { + height = Math.max (height, DPIUtil.autoScaleUp(ascentInPoints + descentInPoints)); } if (OS.pango_context_get_base_dir(context) == OS.PANGO_DIRECTION_RTL) { x = width() - x - width; @@ -1080,25 +1124,29 @@ computeRuns(); int lineCount = OS.pango_layout_get_line_count(layout); if (!(0 <= lineIndex && lineIndex < lineCount)) SWT.error(SWT.ERROR_INVALID_RANGE); - int ascent = 0, descent = 0; PangoLayoutLine line = new PangoLayoutLine(); OS.memmove(line, OS.pango_layout_get_line(layout, lineIndex), PangoLayoutLine.sizeof); + int heightInPoints; + int ascentInPoints; if (line.runs == 0) { int /*long*/ font = this.font != null ? this.font.handle : device.systemFont.handle; int /*long*/ lang = OS.pango_context_get_language(context); int /*long*/ metrics = OS.pango_context_get_metrics(context, font, lang); - ascent = OS.pango_font_metrics_get_ascent(metrics); - descent = OS.pango_font_metrics_get_descent(metrics); + int ascent = OS.pango_font_metrics_get_ascent(metrics); + int descent = OS.pango_font_metrics_get_descent(metrics); + ascentInPoints = DPIUtil.autoScaleDown(OS.PANGO_PIXELS(ascent)); + heightInPoints = DPIUtil.autoScaleDown(OS.PANGO_PIXELS(ascent + descent)); OS.pango_font_metrics_unref(metrics); } else { PangoRectangle rect = new PangoRectangle(); OS.pango_layout_line_get_extents(OS.pango_layout_get_line(layout, lineIndex), null, rect); - ascent = -rect.y; - descent = rect.height - ascent; + ascentInPoints = DPIUtil.autoScaleDown(OS.PANGO_PIXELS(-rect.y)); + heightInPoints = DPIUtil.autoScaleDown(OS.PANGO_PIXELS(rect.height)); } - ascent = Math.max(this.ascent, OS.PANGO_PIXELS(ascent)); - descent = Math.max(this.descent, OS.PANGO_PIXELS(descent)); - return FontMetrics.gtk_new(ascent, descent, 0, 0, ascent + descent); + heightInPoints = Math.max(this.ascentInPoints + this.descentInPoints, heightInPoints); + ascentInPoints = Math.max(this.ascentInPoints, ascentInPoints); + int descentInPoints = heightInPoints - ascentInPoints; + return FontMetrics.gtk_new(ascentInPoints, descentInPoints, 0); } /** @@ -1147,6 +1195,10 @@ */ public Point getLocation(int offset, boolean trailing) { checkLayout(); + return DPIUtil.autoScaleDown(getLocationInPixels(offset, trailing)); +} + +Point getLocationInPixels(int offset, boolean trailing) { computeRuns(); int length = text.length(); if (!(0 <= offset && offset <= length)) SWT.error(SWT.ERROR_INVALID_RANGE); @@ -1282,8 +1334,12 @@ */ public int getOffset(Point point, int[] trailing) { checkLayout(); + return getOffsetInPixels(DPIUtil.autoScaleUp(point), trailing); +} + +int getOffsetInPixels(Point point, int[] trailing) { if (point == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - return getOffset(point.x, point.y, trailing); + return getOffsetInPixels(point.x, point.y, trailing); } /** @@ -1311,6 +1367,10 @@ */ public int getOffset(int x, int y, int[] trailing) { checkLayout(); + return getOffset(new Point(x, y), trailing); +} + +int getOffsetInPixels(int x, int y, int[] trailing) { computeRuns(); if (trailing != null && trailing.length < 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT); x -= Math.min (indent, wrapIndent); @@ -1500,6 +1560,10 @@ */ public int getSpacing () { checkLayout(); + return DPIUtil.autoScaleDown(getSpacingInPixels()); +} + +int getSpacingInPixels () { return OS.PANGO_PIXELS(OS.pango_layout_get_spacing(layout)); } @@ -1570,6 +1634,10 @@ */ public int[] getTabs() { checkLayout(); + return DPIUtil.autoScaleDown (getTabsInPixels ()); +} + +int[] getTabsInPixels () { return tabs; } @@ -1613,6 +1681,10 @@ */ public int getWidth () { checkLayout (); + return DPIUtil.autoScaleDown(getWidthInPixels()); +} + +int getWidthInPixels () { return wrapWidth; } @@ -1629,6 +1701,9 @@ */ public int getWrapIndent () { checkLayout (); + return DPIUtil.autoScaleDown(getWrapIndentInPixels()); +} +int getWrapIndentInPixels () { return wrapIndent; } @@ -1707,9 +1782,9 @@ public void setAscent (int ascent) { checkLayout(); if (ascent < -1) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - if (this.ascent == ascent) return; + if (this.ascentInPoints == ascent) return; freeRuns(); - this.ascent = ascent; + this.ascentInPoints = ascent; } /** @@ -1733,9 +1808,9 @@ public void setDescent (int descent) { checkLayout(); if (descent < -1) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - if (this.descent == descent) return; + if (this.descentInPoints == descent) return; freeRuns(); - this.descent = descent; + this.descentInPoints = descent; } /** @@ -1780,6 +1855,11 @@ * @since 3.2 */ public void setIndent (int indent) { + checkLayout (); + setIndentInPixels(DPIUtil.autoScaleUp(indent)); +} + +void setIndentInPixels (int indent) { checkLayout(); if (indent < 0) return; if (this.indent == indent) return; @@ -1849,6 +1929,10 @@ public void setSpacing (int spacing) { checkLayout(); if (spacing < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + setSpacingInPixels(DPIUtil.autoScaleUp(spacing)); +} + +void setSpacingInPixels (int spacing) { OS.pango_layout_set_spacing(layout, spacing * OS.PANGO_SCALE); } @@ -2035,7 +2119,7 @@ /** * Sets the receiver's tab list. Each value in the tab list specifies - * the space in pixels from the origin of the text layout to the respective + * the space in points from the origin of the text layout to the respective * tab stop. The last tab stop width is repeated continuously. * * @param tabs the new tab list @@ -2047,15 +2131,11 @@ public void setTabs(int[] tabs) { checkLayout(); if (this.tabs == null && tabs == null) return; - if (this.tabs!= null && tabs != null) { - if (this.tabs.length == tabs.length) { - int i; - for (i = 0; i <tabs.length; i++) { - if (this.tabs[i] != tabs[i]) break; - } - if (i == tabs.length) return; - } - } + setTabsInPixels (DPIUtil.autoScaleUp (tabs)); +} + +void setTabsInPixels (int[] tabs) { + if (Arrays.equals (this.tabs, tabs)) return; this.tabs = tabs; if (tabs == null) { OS.pango_layout_set_tabs(layout, device.emptyTab); @@ -2109,7 +2189,8 @@ /** * Sets the text direction of the receiver, which must be one - * of <code>SWT.LEFT_TO_RIGHT</code> or <code>SWT.RIGHT_TO_LEFT</code>. + * of <code>SWT.LEFT_TO_RIGHT</code>, <code>SWT.RIGHT_TO_LEFT</code> + * or <code>SWT.AUTO_TEXT_DIRECTION</code>. * * <p> * <b>Warning</b>: This API is currently only implemented on Windows. @@ -2146,6 +2227,10 @@ public void setWidth (int width) { checkLayout (); if (width < -1 || width == 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + setWidthInPixels(DPIUtil.autoScaleUp(width)); +} + +void setWidthInPixels (int width) { if (wrapWidth == width) return; freeRuns(); wrapWidth = width; @@ -2180,6 +2265,10 @@ public void setWrapIndent (int wrapIndent) { checkLayout(); if (wrapIndent < 0) return; + setWrapIndentInPixels(DPIUtil.autoScaleUp(wrapIndent)); +} + +void setWrapIndentInPixels (int wrapIndent) { if (this.wrapIndent == wrapIndent) return; this.wrapIndent = wrapIndent; OS.pango_layout_set_indent(layout, (indent - wrapIndent) * OS.PANGO_SCALE); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/TextStyle.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/TextStyle.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/TextStyle.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/TextStyle.java 2016-07-06 19:11:33.000000000 +0000 @@ -19,20 +19,20 @@ * The hashCode() method in this class uses the values of the public * fields to compute the hash value. When storing instances of the * class in hashed collections, do not modify these fields after the - * object has been inserted. + * object has been inserted. * </p> * <p> * Application code does <em>not</em> need to explicitly release the * resources managed by each instance when those instances are no longer * required, and thus no <code>dispose()</code> method is provided. * </p> - * + * * @see TextLayout * @see Font * @see Color * @see <a href="http://www.eclipse.org/swt/snippets/#textlayout">TextLayout, TextStyle snippets</a> * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.0 */ public class TextStyle { @@ -55,131 +55,131 @@ /** * the underline flag of the style. The default underline * style is <code>SWT.UNDERLINE_SINGLE</code>. - * - * + * + * * @since 3.1 - */ + */ public boolean underline; - + /** * the underline color of the style - * + * * @since 3.4 - */ + */ public Color underlineColor; /** * the underline style. This style is ignored when * <code>underline</code> is false. - * <p> + * <p> * This value should be one of <code>SWT.UNDERLINE_SINGLE</code>, * <code>SWT.UNDERLINE_DOUBLE</code>, <code>SWT.UNDERLINE_ERROR</code>, * <code>SWT.UNDERLINE_SQUIGGLE</code>, or <code>SWT.UNDERLINE_LINK</code>. * </p> - * + * * @see SWT#UNDERLINE_SINGLE - * @see SWT#UNDERLINE_DOUBLE + * @see SWT#UNDERLINE_DOUBLE * @see SWT#UNDERLINE_ERROR * @see SWT#UNDERLINE_SQUIGGLE * @see SWT#UNDERLINE_LINK - * + * * @since 3.4 - */ + */ public int underlineStyle; /** * the strikeout flag of the style - * + * * @since 3.1 - */ + */ public boolean strikeout; - + /** * the strikeout color of the style - * + * * @since 3.4 - */ + */ public Color strikeoutColor; - + /** * the border style. The default border style is <code>SWT.NONE</code>. - * <p> + * <p> * This value should be one of <code>SWT.BORDER_SOLID</code>, * <code>SWT.BORDER_DASH</code>,<code>SWT.BORDER_DOT</code> or * <code>SWT.NONE</code>. * </p> - * + * * @see SWT#BORDER_SOLID - * @see SWT#BORDER_DASH + * @see SWT#BORDER_DASH * @see SWT#BORDER_DOT * @see SWT#NONE - * + * * @since 3.4 - */ + */ public int borderStyle; - + /** * the border color of the style - * + * * @since 3.4 - */ + */ public Color borderColor; - + /** * the GlyphMetrics of the style - * + * * @since 3.2 - */ + */ public GlyphMetrics metrics; - + /** - * the baseline rise of the style. - * + * the baseline rise of the style. + * * @since 3.2 - */ + */ public int rise; - - + + /** - * the data. An user data field. It can be used to hold the HREF when the range + * the data. An user data field. It can be used to hold the HREF when the range * is used as a link or the embed object when the range is used with <code>GlyphMetrics</code>. * <p> - * + * * @since 3.5 */ public Object data; -/** +/** * Create an empty text style. * * @since 3.4 */ public TextStyle () { } - -/** + +/** * Create a new text style with the specified font, foreground * and background. * - * @param font the font of the style, <code>null</code> if none - * @param foreground the foreground color of the style, <code>null</code> if none + * @param font the font of the style, <code>null</code> if none + * @param foreground the foreground color of the style, <code>null</code> if none * @param background the background color of the style, <code>null</code> if none */ public TextStyle (Font font, Color foreground, Color background) { if (font != null && font.isDisposed()) SWT.error (SWT.ERROR_INVALID_ARGUMENT); if (foreground != null && foreground.isDisposed()) SWT.error (SWT.ERROR_INVALID_ARGUMENT); - if (background != null && background.isDisposed()) SWT.error (SWT.ERROR_INVALID_ARGUMENT); + if (background != null && background.isDisposed()) SWT.error (SWT.ERROR_INVALID_ARGUMENT); this.font = font; this.foreground = foreground; this.background = background; } -/** +/** * Create a new text style from an existing text style. - * - * @param style the style to copy + * + * @param style the style to copy * * @since 3.4 */ @@ -215,7 +215,7 @@ if (object == this) return true; if (object == null) return false; if (!(object instanceof TextStyle)) return false; - TextStyle style = (TextStyle)object; + TextStyle style = (TextStyle)object; if (foreground != null) { if (!foreground.equals(style.foreground)) return false; } else if (style.foreground != null) return false; @@ -248,8 +248,8 @@ } /** - * Returns an integer hash code for the receiver. Any two - * objects that return <code>true</code> when passed to + * Returns an integer hash code for the receiver. Any two + * objects that return <code>true</code> when passed to * <code>equals</code> must return the same value for this * method. * @@ -261,7 +261,7 @@ public int hashCode() { int hash = 0; if (foreground != null) hash ^= foreground.hashCode(); - if (background != null) hash ^= background.hashCode(); + if (background != null) hash ^= background.hashCode(); if (font != null) hash ^= font.hashCode(); if (metrics != null) hash ^= metrics.hashCode(); if (underline) hash ^= (hash << 1); @@ -336,7 +336,7 @@ buffer.append(font); } if (foreground != null) { - if (buffer.length() > startLength) buffer.append(", "); //$NON-NLS-1$ + if (buffer.length() > startLength) buffer.append(", "); //$NON-NLS-1$ buffer.append("foreground="); //$NON-NLS-1$ buffer.append(foreground); } @@ -349,11 +349,11 @@ if (buffer.length() > startLength) buffer.append(", "); //$NON-NLS-1$ buffer.append("underline="); //$NON-NLS-1$ switch (underlineStyle) { - case SWT.UNDERLINE_SINGLE: buffer.append("single"); break; //$NON-NLS-1$ - case SWT.UNDERLINE_DOUBLE: buffer.append("double"); break; //$NON-NLS-1$ - case SWT.UNDERLINE_SQUIGGLE: buffer.append("squiggle"); break; //$NON-NLS-1$ - case SWT.UNDERLINE_ERROR: buffer.append("error"); break; //$NON-NLS-1$ - case SWT.UNDERLINE_LINK: buffer.append("link"); break; //$NON-NLS-1$ + case SWT.UNDERLINE_SINGLE: buffer.append("single"); break; //$NON-NLS-1$ + case SWT.UNDERLINE_DOUBLE: buffer.append("double"); break; //$NON-NLS-1$ + case SWT.UNDERLINE_SQUIGGLE: buffer.append("squiggle"); break; //$NON-NLS-1$ + case SWT.UNDERLINE_ERROR: buffer.append("error"); break; //$NON-NLS-1$ + case SWT.UNDERLINE_LINK: buffer.append("link"); break; //$NON-NLS-1$ } if (underlineColor != null) { buffer.append(", underlineColor="); //$NON-NLS-1$ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/graphics/Transform.java swt4-gtk-4.6.0/org/eclipse/swt/graphics/Transform.java --- swt4-gtk-4.5.0/org/eclipse/swt/graphics/Transform.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/graphics/Transform.java 2016-07-06 19:11:33.000000000 +0000 @@ -15,10 +15,10 @@ import org.eclipse.swt.internal.cairo.*; /** - * Instances of this class represent transformation matrices for + * Instances of this class represent transformation matrices for * points expressed as (x, y) pairs of floating point numbers. * <p> - * Application code must explicitly invoke the <code>Transform.dispose()</code> + * Application code must explicitly invoke the <code>Transform.dispose()</code> * method to release the operating system resources managed by each instance * when those instances are no longer required. * </p> @@ -26,10 +26,10 @@ * This class requires the operating system's advanced graphics subsystem * which may not be available on some platforms. * </p> - * + * * @see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: GraphicsExample</a> * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.1 */ public class Transform extends Resource { @@ -42,11 +42,11 @@ * within the packages provided by SWT. It is not available on all * platforms and should never be accessed from application code. * </p> - * + * * @noreference This field is not intended to be referenced by clients. */ public double[] handle; - + /** * Constructs a new identity Transform. * <p> @@ -55,11 +55,11 @@ * platforms. * </p> * <p> - * You must dispose the transform when it is no longer required. + * You must dispose the transform when it is no longer required. * </p> - * + * * @param device the device on which to allocate the Transform - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if device is null and there is no current device</li> * </ul> @@ -69,7 +69,7 @@ * @exception SWTError <ul> * <li>ERROR_NO_HANDLES if a handle for the Transform could not be obtained</li> * </ul> - * + * * @see #dispose() */ public Transform (Device device) { @@ -77,7 +77,7 @@ } /** - * Constructs a new Transform given an array of elements that represent the + * Constructs a new Transform given an array of elements that represent the * matrix that describes the transformation. * <p> * This operation requires the operating system's advanced @@ -85,12 +85,12 @@ * platforms. * </p> * <p> - * You must dispose the transform when it is no longer required. + * You must dispose the transform when it is no longer required. * </p> - * + * * @param device the device on which to allocate the Transform * @param elements an array of floats that describe the transformation matrix - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if device is null and there is no current device, or the elements array is null</li> * <li>ERROR_INVALID_ARGUMENT - if the elements array is too small to hold the matrix values</li> @@ -101,7 +101,7 @@ * @exception SWTError <ul> * <li>ERROR_NO_HANDLES if a handle for the Transform could not be obtained</li> * </ul> - * + * * @see #dispose() */ public Transform(Device device, float[] elements) { @@ -109,7 +109,7 @@ } /** - * Constructs a new Transform given all of the elements that represent the + * Constructs a new Transform given all of the elements that represent the * matrix that describes the transformation. * <p> * This operation requires the operating system's advanced @@ -117,9 +117,9 @@ * platforms. * </p> * <p> - * You must dispose the transform when it is no longer required. + * You must dispose the transform when it is no longer required. * </p> - * + * * @param device the device on which to allocate the Transform * @param m11 the first element of the first row of the matrix * @param m12 the second element of the first row of the matrix @@ -127,7 +127,7 @@ * @param m22 the second element of the second row of the matrix * @param dx the third element of the first row of the matrix * @param dy the third element of the second row of the matrix - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if device is null and there is no current device</li> * </ul> @@ -137,7 +137,7 @@ * @exception SWTError <ul> * <li>ERROR_NO_HANDLES if a handle for the Transform could not be obtained</li> * </ul> - * + * * @see #dispose() */ public Transform (Device device, float m11, float m12, float m21, float m22, float dx, float dy) { @@ -145,7 +145,7 @@ this.device.checkCairo(); handle = new double[6]; if (handle == null) SWT.error(SWT.ERROR_NO_HANDLES); - Cairo.cairo_matrix_init(handle, m11, m12, m21, m22, dx, dy); + Cairo.cairo_matrix_init(handle, m11, m12, m21, m22, DPIUtil.autoScaleUp(dx), DPIUtil.autoScaleUp(dy)); init(); } @@ -182,18 +182,18 @@ elements[1] = (float)handle[1]; elements[2] = (float)handle[2]; elements[3] = (float)handle[3]; - elements[4] = (float)handle[4]; - elements[5] = (float)handle[5]; + elements[4] = DPIUtil.autoScaleDown((float)handle[4]); + elements[5] = DPIUtil.autoScaleDown((float)handle[5]); } /** * Modifies the receiver such that the matrix it represents becomes the - * identity matrix. + * identity matrix. * * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> - * + * * @since 3.4 */ public void identity() { @@ -203,7 +203,7 @@ /** * Modifies the receiver such that the matrix it represents becomes - * the mathematical inverse of the matrix it previously represented. + * the mathematical inverse of the matrix it previously represented. * * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> @@ -248,10 +248,10 @@ /** * Modifies the receiver such that the matrix it represents becomes the * the result of multiplying the matrix it previously represented by the - * argument. + * argument. * * @param matrix the matrix to multiply the receiver by - * + * * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> @@ -275,23 +275,23 @@ * while a negative value indicates a counter-clockwise rotation. * * @param angle the angle to rotate the transformation by - * + * * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> */ public void rotate(float angle) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - Cairo.cairo_matrix_rotate(handle, angle * (float)Compatibility.PI / 180); + Cairo.cairo_matrix_rotate(handle, angle * (float)Math.PI / 180); } /** * Modifies the receiver so that it represents a transformation that is * equivalent to its previous transformation scaled by (scaleX, scaleY). - * + * * @param scaleX the amount to scale in the X direction * @param scaleY the amount to scale in the Y direction - * + * * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> @@ -304,34 +304,34 @@ /** * Modifies the receiver to represent a new transformation given all of * the elements that represent the matrix that describes that transformation. - * + * * @param m11 the first element of the first row of the matrix * @param m12 the second element of the first row of the matrix * @param m21 the first element of the second row of the matrix * @param m22 the second element of the second row of the matrix * @param dx the third element of the first row of the matrix * @param dy the third element of the second row of the matrix - * + * * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> */ public void setElements(float m11, float m12, float m21, float m22, float dx, float dy) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - Cairo.cairo_matrix_init(handle, m11, m12, m21, m22, dx, dy); + Cairo.cairo_matrix_init(handle, m11, m12, m21, m22, DPIUtil.autoScaleUp(dx), DPIUtil.autoScaleUp(dy)); } /** * Modifies the receiver so that it represents a transformation that is * equivalent to its previous transformation sheared by (shearX, shearY). - * + * * @param shearX the shear factor in the X direction * @param shearY the shear factor in the Y direction - * + * * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> - * + * * @since 3.4 */ public void shear(float shearX, float shearY) { @@ -340,7 +340,7 @@ Cairo.cairo_matrix_multiply(handle, matrix, handle); } -/** +/** * Given an array containing points described by alternating x and y values, * modify that array such that each point has been replaced with the result of * applying the transformation represented by the receiver to that point. @@ -349,7 +349,7 @@ * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the point array is null</li> - * </ul> + * </ul> * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> @@ -360,28 +360,28 @@ double[] dx = new double[1], dy = new double[1]; int length = pointArray.length / 2; for (int i = 0, j = 0; i < length; i++, j += 2) { - dx[0] = pointArray[j]; - dy[0] = pointArray[j + 1]; + dx[0] = DPIUtil.autoScaleUp(pointArray[j]); + dy[0] = DPIUtil.autoScaleUp(pointArray[j + 1]); Cairo.cairo_matrix_transform_point(handle, dx, dy); - pointArray[j] = (float)dx[0]; - pointArray[j + 1] = (float)dy[0]; + pointArray[j] = DPIUtil.autoScaleDown((float)dx[0]); + pointArray[j + 1] = DPIUtil.autoScaleDown((float)dy[0]); } } /** * Modifies the receiver so that it represents a transformation that is * equivalent to its previous transformation translated by (offsetX, offsetY). - * + * * @param offsetX the distance to translate in the X direction * @param offsetY the distance to translate in the Y direction - * + * * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> */ public void translate(float offsetX, float offsetY) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - Cairo.cairo_matrix_translate(handle, offsetX, offsetY); + Cairo.cairo_matrix_translate(handle, DPIUtil.autoScaleUp(offsetX), DPIUtil.autoScaleUp(offsetY)); } /** diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkActionIface.java swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkActionIface.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkActionIface.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkActionIface.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -28,7 +28,7 @@ /** @field cast=(const gchar *(*)()) */ public int /*long*/ get_keybinding; /** @field cast=(gboolean (*)()) */ - public int /*long*/ set_description; + public int /*long*/ set_description; // AtkFunction pad1; // AtkFunction pad2; } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkAttribute.java swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkAttribute.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkAttribute.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkAttribute.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkComponentIface.java swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkComponentIface.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkComponentIface.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkComponentIface.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkEditableTextIface.java swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkEditableTextIface.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkEditableTextIface.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkEditableTextIface.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkHypertextIface.java swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkHypertextIface.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkHypertextIface.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkHypertextIface.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/ATK.java swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/ATK.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/ATK.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/ATK.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -36,7 +36,7 @@ public static final int ATK_RELATION_SUBWINDOW_OF = 9; public static final int ATK_RELATION_EMBEDS = 10; public static final int ATK_RELATION_EMBEDDED_BY = 11; - public static final int ATK_RELATION_POPUP_FOR = 12; + public static final int ATK_RELATION_POPUP_FOR = 12; public static final int ATK_RELATION_PARENT_WINDOW_OF = 13; public static final int ATK_RELATION_DESCRIBED_BY = 14; public static final int ATK_RELATION_DESCRIPTION_FOR = 15; @@ -83,6 +83,7 @@ public static final int ATK_ROLE_FORM = 85; public static final int ATK_ROLE_HEADING = 81; public static final int ATK_ROLE_DOCUMENT_FRAME = 80; + public static final int ATK_ROLE_TABLE_ROW = 88; //since atk 2.1.0 public static final int ATK_ROLE_IMAGE = 26; public static final int ATK_ROLE_PAGE = 82; public static final int ATK_ROLE_SECTION = 83; @@ -149,7 +150,7 @@ public static final int ATK_TEXT_ATTR_VARIANT = 26; public static final int ATK_TEXT_ATTR_STYLE = 27; public static final int ATK_XY_WINDOW = 1; - + /** Signals */ public static final byte[] selection_changed = OS.ascii ("selection_changed"); public static final byte[] active_descendant_changed = OS.ascii ("active_descendant_changed"); @@ -171,7 +172,7 @@ public static final byte[] row_deleted = OS.ascii ("row-deleted"); public static final byte[] row_inserted = OS.ascii ("row-inserted"); public static final byte[] focus_event = OS.ascii ("focus-event"); - + /** Properties */ public static final byte[] accessible_name = OS.ascii ("accessible-name"); public static final byte[] accessible_description = OS.ascii ("accessible-description"); @@ -187,14 +188,14 @@ public static final byte[] accessible_table_row_description = OS.ascii ("accessible-table-row-description"); public static final byte[] accessible_table_row_header = OS.ascii ("accessible-table-row-header"); public static final byte[] accessible_table_summary = OS.ascii ("accessible-table-summary"); - + /** 64 bit */ public static final native int AtkObjectFactory_sizeof (); public static final native int AtkObjectFactoryClass_sizeof (); public static final native int AtkAttribute_sizeof (); public static final native int AtkTextRange_sizeof (); public static final native int AtkTextRectangle_sizeof (); - + /** Natives */ /** @method flags=const */ @@ -332,9 +333,10 @@ } } /** + * @method flags=dynamic * @param name cast=(const gchar *) */ -public static final native int _atk_role_register (byte[] name); +public static final native int _atk_role_register (byte[] name); //Note, deprecated, do not use. See atk docu. public static final int atk_role_register (byte[] name) { lock.lock(); try { @@ -445,7 +447,7 @@ public static final native void memmove (AtkHypertextIface dest, int /*long*/ src); public static final native void memmove (AtkObjectClass dest, int /*long*/ src); public static final native void memmove (AtkObjectFactoryClass dest, int /*long*/ src); -public static final native void memmove (AtkSelectionIface dest, int /*long*/ src); +public static final native void memmove (AtkSelectionIface dest, int /*long*/ src); public static final native void memmove (AtkTableIface dest, int /*long*/ src); public static final native void memmove (AtkTextIface dest, int /*long*/ src); public static final native void memmove (AtkValueIface dest, int /*long*/ src); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkObjectClass.java swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkObjectClass.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkObjectClass.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkObjectClass.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkObjectFactoryClass.java swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkObjectFactoryClass.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkObjectFactoryClass.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkObjectFactoryClass.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkSelectionIface.java swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkSelectionIface.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkSelectionIface.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkSelectionIface.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkTableIface.java swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkTableIface.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkTableIface.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkTableIface.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkTextIface.java swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkTextIface.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkTextIface.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkTextIface.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkTextRange.java swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkTextRange.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkTextRange.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkTextRange.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkTextRectangle.java swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkTextRectangle.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkTextRectangle.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkTextRectangle.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkValueIface.java swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkValueIface.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/AtkValueIface.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/AtkValueIface.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/GtkAccessible.java swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/GtkAccessible.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/accessibility/gtk/GtkAccessible.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/accessibility/gtk/GtkAccessible.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/BidiUtil.java swt4-gtk-4.6.0/org/eclipse/swt/internal/BidiUtil.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/BidiUtil.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/BidiUtil.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2015 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 @@ -10,13 +10,14 @@ *******************************************************************************/ package org.eclipse.swt.internal; +import org.eclipse.swt.*; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.widgets.Control; /* - * This class is supplied so that the StyledText code that supports bidi text (supported - * for win platforms) is not platform dependent. Bidi text is not implemented on - * emulated platforms. + * Wraps Win32 API used to bidi enable widgets. Up to 3.104 was used by + * StyledText widget exclusively. 3.105 release introduced the method + * #resolveTextDirection, which is used by other widgets as well. */ public class BidiUtil { // Keyboard language types @@ -29,13 +30,13 @@ public static final int LINKBEFORE = 2; public static final int LINKAFTER = 4; - // bidi rendering/ordering constants, not used on + // bidi rendering/ordering constants, not used on // emulated platforms public static final int CLASS_HEBREW = 2; public static final int CLASS_ARABIC = 2; public static final int CLASS_LOCALNUMBER = 4; - public static final int CLASS_LATINNUMBER = 5; - public static final int REORDER = 0; + public static final int CLASS_LATINNUMBER = 5; + public static final int REORDER = 0; public static final int LIGATE = 0; public static final int GLYPHSHAPE = 0; @@ -69,7 +70,7 @@ * Not implemented. */ public static int getFontBidiAttributes(GC gc) { - return 0; + return 0; } /* * Not implemented. @@ -94,10 +95,16 @@ * Not implemented. */ public static void removeLanguageListener(int /*long*/ hwnd) { -} +} public static void removeLanguageListener (Control control) { } /* + * Not implemented. Returns SWT.NONE. + */ +public static int resolveTextDirection (String text) { + return SWT.NONE; +} +/* * Not implemented. */ public static void setKeyboardLanguage(int language) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/cairo/Cairo.java swt4-gtk-4.6.0/org/eclipse/swt/internal/cairo/Cairo.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/cairo/Cairo.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/cairo/Cairo.java 2016-07-06 19:11:33.000000000 +0000 @@ -31,7 +31,7 @@ public static final int CAIRO_ANTIALIAS_DEFAULT = 0; public static final int CAIRO_ANTIALIAS_NONE = 1; public static final int CAIRO_ANTIALIAS_GRAY = 2; - public static final int CAIRO_ANTIALIAS_SUBPIXEL = 3; + public static final int CAIRO_ANTIALIAS_SUBPIXEL = 3; public static final int CAIRO_CONTENT_COLOR = 0x1000; public static final int CAIRO_CONTENT_ALPHA = 0x2000; public static final int CAIRO_CONTENT_COLOR_ALPHA = 0x3000; @@ -88,11 +88,11 @@ public static final int CAIRO_PATH_LINE_TO = 1; public static final int CAIRO_PATH_CURVE_TO = 2; public static final int CAIRO_PATH_CLOSE_PATH = 3; - + /** 64*/ public static final native int cairo_path_data_t_sizeof (); public static final native int cairo_path_t_sizeof (); - + /** Natives */ public static final native int CAIRO_VERSION_ENCODE(int major, int minor, int micro); /** diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/Callback.java swt4-gtk-4.6.0/org/eclipse/swt/internal/Callback.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/Callback.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/Callback.java 2016-07-06 19:11:33.000000000 +0000 @@ -18,13 +18,13 @@ * <p> * IMPORTANT: A callback is only valid when invoked on the * thread which created it. The results are undefined (and - * typically bad) when a callback is passed out to the + * typically bad) when a callback is passed out to the * operating system (or other code) in such a way that the * callback is called from a different thread. */ public class Callback { - + Object object; String method, signature; int argCount; @@ -58,7 +58,7 @@ * Constructs a new instance of this class given an object * to send the message to, a string naming the method to * invoke, an argument count and a flag indicating whether - * or not the arguments will be passed in an array. Note + * or not the arguments will be passed in an array. Note * that, if the object is an instance of <code>Class</code> * it is assumed that the method is a static method on that * class. @@ -97,7 +97,7 @@ this.isStatic = object instanceof Class; this.isArrayBased = isArrayBased; this.errorResult = errorResult; - + /* Inline the common cases */ if (isArrayBased) { signature = SIGNATURE_N; @@ -112,7 +112,7 @@ signature = getSignature(argCount); } } - + /* Bind the address */ address = bind (this, object, method, signature, argCount, isStatic, isArrayBased, errorResult); } @@ -169,9 +169,9 @@ * <p> * Note: This should not be called by application code. * </p> - * + * * @return the entry count - * + * * @since 2.1 */ public static native int getEntryCount (); @@ -222,7 +222,7 @@ @Deprecated static final void ignoreCallbacks (boolean ignore) { setEnabled (!ignore); -} +} /** * Immediately wipes out all native level state associated diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/cde/CDE.java swt4-gtk-4.6.0/org/eclipse/swt/internal/cde/CDE.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/cde/CDE.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/cde/CDE.java 2016-07-06 19:11:33.000000000 +0000 @@ -20,7 +20,7 @@ public static final String DtDTS_DA_ICON = "ICON"; public static final String DtDTS_DA_MIME_TYPE = "MIME_TYPE"; public static final String DtDTS_DA_NAME_TEMPLATE = "NAME_TEMPLATE"; - + /** 64 bit */ public static final native int DtActionArg_sizeof(); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/C.java swt4-gtk-4.6.0/org/eclipse/swt/internal/C.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/C.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/C.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -22,6 +22,11 @@ public static final native void free (int /*long*/ ptr); /** @param env cast=(const char *) */ public static final native int /*long*/ getenv (byte[] env); +/** + * @param env cast=(const char *) + * @param value cast=(const char *) + */ +public static final native int setenv (byte[] env, byte[] value, int overwrite); public static final native int /*long*/ malloc (int /*long*/ size); /** * @param dest cast=(void *) diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/CloneableCompatibility.java swt4-gtk-4.6.0/org/eclipse/swt/internal/CloneableCompatibility.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/CloneableCompatibility.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/CloneableCompatibility.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 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; - - -/** - * This interface is the cross-platform version of the - * java.lang.Cloneable interface. - * <p> - * It is part of our effort to provide support for both J2SE - * and J2ME platforms. Under this scheme, classes need to - * implement CloneableCompatibility instead of java.lang.Cloneable. - * </p> - * <p> - * Note: java.lang.Cloneable is not part of CLDC. - * </p> - */ -public interface CloneableCompatibility extends Cloneable { -} diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/Compatibility.java swt4-gtk-4.6.0/org/eclipse/swt/internal/Compatibility.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/Compatibility.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/Compatibility.java 2016-07-06 19:11:33.000000000 +0000 @@ -10,16 +10,12 @@ *******************************************************************************/ package org.eclipse.swt.internal; - + import java.io.*; -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; -import java.util.zip.Deflater; -import java.util.zip.InflaterInputStream; -import java.util.zip.DeflaterOutputStream; +import java.text.*; +import java.util.*; -import org.eclipse.swt.SWT; +import org.eclipse.swt.*; /** * This class is a placeholder for utility methods commonly @@ -31,66 +27,25 @@ * </p> * <p> * IMPORTANT: some of the methods have been modified from their - * J2SE parents. Refer to the description of each method for + * J2SE parents. Refer to the description of each method for * specific changes. * </p> * <ul> - * <li>Exceptions thrown may differ since J2ME's set of + * <li>Exceptions thrown may differ since J2ME's set of * exceptions is a subset of J2SE's one. * </li> * <li>The range of the mathematic functions is subject to * change. - * </li> + * </li> * </ul> */ public final class Compatibility { /** - * Returns the PI constant as a double. - */ -public static double PI = Math.PI; - -static double toRadians = PI / 180; - -/** - * Answers the length of the side adjacent to the given angle - * of a right triangle. In other words, it returns the integer - * conversion of length * cos (angle). - * <p> - * IMPORTANT: the j2me version has an additional restriction on - * the argument. length must be between -32767 and 32767 (inclusive). - * </p> - * - * @param angle the angle in degrees - * @param length the length of the triangle's hypotenuse - * @return the integer conversion of length * cos (angle) - */ -public static int cos(int angle, int length) { - return (int)(Math.cos(angle * toRadians) * length); -} - -/** - * Answers the length of the side opposite to the given angle - * of a right triangle. In other words, it returns the integer - * conversion of length * sin (angle). - * <p> - * IMPORTANT: the j2me version has an additional restriction on - * the argument. length must be between -32767 and 32767 (inclusive). - * </p> - * - * @param angle the angle in degrees - * @param length the length of the triangle's hypotenuse - * @return the integer conversion of length * sin (angle) - */ -public static int sin(int angle, int length) { - return (int)(Math.sin(angle * toRadians) * length); -} - -/** * Answers the most negative (i.e. closest to negative infinity) - * integer value which is greater than the number obtained by dividing + * integer value which is greater than or equal to the number obtained by dividing * the first argument p by the second argument q. - * + * * @param p numerator * @param q denominator (must be different from zero) * @return the ceiling of the rational number p / q. @@ -101,7 +56,7 @@ /** * Answers whether the indicated file exists or not. - * + * * @param parent the file's parent directory * @param child the file's name * @return true if the file exists @@ -111,27 +66,14 @@ } /** - * Answers the most positive (i.e. closest to positive infinity) - * integer value which is less than the number obtained by dividing - * the first argument p by the second argument q. - * - * @param p numerator - * @param q denominator (must be different from zero) - * @return the floor of the rational number p / q. - */ -public static int floor(int p, int q) { - return (int)Math.floor((double)p / q); -} - -/** - * Answers the result of rounding to the closest integer the number obtained + * Answers the result of rounding to the closest integer the number obtained * by dividing the first argument p by the second argument q. * <p> * IMPORTANT: the j2me version has an additional restriction on * the arguments. p must be within the range 0 - 32767 (inclusive). * q must be within the range 1 - 32767 (inclusive). * </p> - * + * * @param p numerator * @param q denominator (must be different from zero) * @return the closest integer to the rational number p / q @@ -160,112 +102,6 @@ } /** - * Create a DeflaterOutputStream if such things are supported. - * - * @param stream the output stream - * @return a deflater stream or <code>null</code> - * @exception IOException - * - * @since 3.4 - */ -public static OutputStream newDeflaterOutputStream(OutputStream stream, int level) throws IOException { - return new DeflaterOutputStream(stream, new Deflater(level)); -} - -/** - * Open a file if such things are supported. - * - * @param filename the name of the file to open - * @return a stream on the file if it could be opened. - * @exception IOException - */ -public static InputStream newFileInputStream(String filename) throws IOException { - return new FileInputStream(filename); -} - -/** - * Open a file if such things are supported. - * - * @param filename the name of the file to open - * @return a stream on the file if it could be opened. - * @exception IOException - */ -public static OutputStream newFileOutputStream(String filename) throws IOException { - return new FileOutputStream(filename); -} - -/** - * Create an InflaterInputStream if such things are supported. - * - * @param stream the input stream - * @return a inflater stream or <code>null</code> - * @exception IOException - * - * @since 3.3 - */ -public static InputStream newInflaterInputStream(InputStream stream) throws IOException { - return new BufferedInputStream(new InflaterInputStream(stream)); -} - -/** - * Answers whether the character is a letter. - * - * @param c the character - * @return true when the character is a letter - */ -public static boolean isLetter(char c) { - return Character.isLetter(c); -} - -/** - * Answers whether the character is a letter or a digit. - * - * @param c the character - * @return true when the character is a letter or a digit - */ -public static boolean isLetterOrDigit(char c) { - return Character.isLetterOrDigit(c); -} - -/** - * Answers whether the character is a Unicode space character. - * - * @param c the character - * @return true when the character is a Unicode space character - */ -public static boolean isSpaceChar(char c) { - return Character.isSpaceChar(c); -} - -/** - * Answers whether the character is a whitespace character. - * - * @param c the character to test - * @return true if the character is whitespace - */ -public static boolean isWhitespace(char c) { - return Character.isWhitespace(c); -} - -/** - * Execute progArray[0] in a separate platform process if the - * underlying platform support this. - * <p> - * The new process inherits the environment of the caller. - * <p> - * - * @param progArray array containing the program to execute and its arguments - * - * @exception IOException - * if the program cannot be executed - * @exception SecurityException - * if the current SecurityManager disallows program execution - */ -public static void exec(String[] progArray) throws java.io.IOException{ - Runtime.getRuntime().exec(progArray); -} - -/** * Execute prog[0] in a separate platform process if the * underlying platform supports this. * <p> @@ -296,18 +132,18 @@ /** * Returns the NLS'ed message for the given argument. This is only being * called from SWT. - * + * * @param key the key to look up * @return the message for the given key - * + * * @see SWT#getMessage(String) */ public static String getMessage(String key) { String answer = key; - + if (key == null) { SWT.error (SWT.ERROR_NULL_ARGUMENT); - } + } if (msgs == null) { try { msgs = ResourceBundle.getBundle("org.eclipse.swt.internal.SWTMessages"); //$NON-NLS-1$ @@ -325,7 +161,7 @@ public static String getMessage(String key, Object[] args) { String answer = key; - + if (key == null || args == null) { SWT.error (SWT.ERROR_NULL_ARGUMENT); } @@ -338,34 +174,12 @@ } if (msgs != null) { try { - MessageFormat formatter = new MessageFormat(""); - formatter.applyPattern(msgs.getString(key)); + MessageFormat formatter = new MessageFormat(""); + formatter.applyPattern(msgs.getString(key)); answer = formatter.format(args); } catch (MissingResourceException ex2) {} } return answer; } -/** - * Interrupt the current thread. - * <p> - * Note that this is not available on CLDC. - * </p> - */ -public static void interrupt() { - Thread.currentThread().interrupt(); -} - -/** - * Compares two instances of class String ignoring the case of the - * characters and answers if they are equal. - * - * @param s1 string - * @param s2 string - * @return true if the two instances of class String are equal - */ -public static boolean equalsIgnoreCase(String s1, String s2) { - return s1.equalsIgnoreCase(s2); -} - } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/DPIUtil.java swt4-gtk-4.6.0/org/eclipse/swt/internal/DPIUtil.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/DPIUtil.java 1970-01-01 00:00:00.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/DPIUtil.java 2016-07-06 19:11:33.000000000 +0000 @@ -0,0 +1,391 @@ +/******************************************************************************* + * Copyright (c) 2016 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; + +import org.eclipse.swt.*; +import org.eclipse.swt.graphics.*; + +/** + * This class hold common constants and utility functions w.r.t. to SWT high DPI + * functionality. + * <p> + * The {@code autoScaleUp(..)} methods convert from API coordinates (in + * SWT points) to internal high DPI coordinates (in pixels) that interface with + * native widgets. + * </p> + * <p> + * The {@code autoScaleDown(..)} convert from high DPI pixels to API coordinates + * (in SWT points). + * </p> + * + * @since 3.105 + */ +public class DPIUtil { + + private static final int DPI_ZOOM_100 = 96; + + private static int deviceZoom = 100; + + private static enum AutoScaleMethod { AUTO, NEAREST, SMOOTH } + private static AutoScaleMethod autoScaleMethodSetting = AutoScaleMethod.AUTO; + private static AutoScaleMethod autoScaleMethod = AutoScaleMethod.NEAREST; + + /** + * System property that controls the autoScale functionality. + * <ul> + * <li><b>false</b>: deviceZoom is set to 100%</li> + * <li><b>integer</b>: deviceZoom depends on the current display resolution, + * but only uses integer multiples of 100%. The detected native zoom is + * generally rounded down (e.g. at 150%, will use 100%), unless close to + * the next integer multiple (currently at 175%, will use 200%).</li> + * <li><b>quarter</b>: deviceZoom depends on the current display resolution, + * but only uses integer multiples of 25%. The detected native zoom is + * rounded to the closest permissible value.</li> + * <li><b>exact</b>: deviceZoom uses the native zoom (with 1% as minimal + * step).</li> + * <li><i><value></i>: deviceZoom uses the given integer value in + * percent as zoom level.</li> + * </ul> + * The current default is "integer". + */ + private static final String SWT_AUTOSCALE = "swt.autoScale"; + + /** + * System property that controls the method for scaling images: + * <ul> + * <li>"nearest": nearest-neighbor interpolation, may look jagged</li> + * <li>"smooth": smooth edges, may look blurry</li> + * </ul> + * The current default is to use "nearest", except on + * GTK when the deviceZoom is not an integer multiple of 100%. + * The smooth strategy currently doesn't work on Win32 and Cocoa, see + * <a href="https://bugs.eclipse.org/493455">bug 493455</a>. + */ + private static final String SWT_AUTOSCALE_METHOD = "swt.autoScale.method"; + static { + String value = System.getProperty (SWT_AUTOSCALE_METHOD); + if (value != null) { + if (AutoScaleMethod.NEAREST.name().equalsIgnoreCase(value)) { + autoScaleMethod = autoScaleMethodSetting = AutoScaleMethod.NEAREST; + } else if (AutoScaleMethod.SMOOTH.name().equalsIgnoreCase(value)) { + autoScaleMethod = autoScaleMethodSetting = AutoScaleMethod.SMOOTH; + } + } + } + +/** + * Auto-scale down ImageData + */ +public static ImageData autoScaleDown (Device device, final ImageData imageData) { + if (deviceZoom == 100 || imageData == null) return imageData; + float scaleFactor = 1.0f / getScalingFactor (); + return autoScaleImageData(device, imageData, scaleFactor); +} + +public static int[] autoScaleDown(int[] pointArray) { + if (deviceZoom == 100 || pointArray == null) return pointArray; + float scaleFactor = getScalingFactor (); + int [] returnArray = new int[pointArray.length]; + for (int i = 0; i < pointArray.length; i++) { + returnArray [i] = Math.round (pointArray [i] / scaleFactor); + } + return returnArray; +} + +/** + * Auto-scale up float array dimensions. + */ +public static float[] autoScaleDown (float size[]) { + if (deviceZoom == 100 || size == null) return size; + float scaleFactor = getScalingFactor (); + float scaledSize[] = new float[size.length]; + for (int i = 0; i < scaledSize.length; i++) { + scaledSize[i] = size[i] / scaleFactor; + } + return scaledSize; +} +/** + * Auto-scale down int dimensions. + */ +public static int autoScaleDown (int size) { + if (deviceZoom == 100 || size == SWT.DEFAULT) return size; + float scaleFactor = getScalingFactor (); + return Math.round (size / scaleFactor); +} +/** + * Auto-scale down float dimensions. + */ +public static float autoScaleDown (float size) { + if (deviceZoom == 100 || size == SWT.DEFAULT) return size; + float scaleFactor = getScalingFactor (); + return (size / scaleFactor); +} + +/** + * Returns a new scaled down Point. + */ +public static Point autoScaleDown (Point point) { + if (deviceZoom == 100 || point == null) return point; + float scaleFactor = getScalingFactor (); + Point scaledPoint = new Point (0,0); + scaledPoint.x = Math.round (point.x / scaleFactor); + scaledPoint.y = Math.round (point.y / scaleFactor); + return scaledPoint; +} + +/** + * Returns a new scaled down Rectangle. + */ +public static Rectangle autoScaleDown (Rectangle rect) { + if (deviceZoom == 100 || rect == null) return rect; + Rectangle scaledRect = new Rectangle (0,0,0,0); + Point scaledTopLeft = DPIUtil.autoScaleDown (new Point (rect.x, rect.y)); + Point scaledBottomRight = DPIUtil.autoScaleDown (new Point (rect.x + rect.width, rect.y + rect.height)); + + scaledRect.x = scaledTopLeft.x; + scaledRect.y = scaledTopLeft.y; + scaledRect.width = scaledBottomRight.x - scaledTopLeft.x; + scaledRect.height = scaledBottomRight.y - scaledTopLeft.y; + return scaledRect; +} + +/** + * Auto-scale image with ImageData + */ +public static ImageData autoScaleImageData (Device device, final ImageData imageData, int targetZoom, int currentZoom) { + if (deviceZoom == 100 || imageData == null || targetZoom == currentZoom) return imageData; + float scaleFactor = (float) targetZoom / (float) currentZoom; + return autoScaleImageData(device, imageData, scaleFactor); +} + +private static ImageData autoScaleImageData (Device device, final ImageData imageData, float scaleFactor) { + // Guards are already implemented in callers: if (deviceZoom == 100 || imageData == null || scaleFactor == 1.0f) return imageData; + int width = imageData.width; + int height = imageData.height; + int scaledWidth = Math.round ((float) width * scaleFactor); + int scaledHeight = Math.round ((float) height * scaleFactor); + switch (autoScaleMethod) { + case SMOOTH: + Image original = new Image (device, new ImageDataProvider () { + @Override + public ImageData getImageData (int zoom) { + return imageData; + } + }); + + /* Create a 24 bit image data with alpha channel */ + final ImageData resultData = new ImageData (scaledWidth, scaledHeight, 24, new PaletteData (0xFF, 0xFF00, 0xFF0000)); + resultData.alphaData = new byte [scaledWidth * scaledHeight]; + + Image resultImage = new Image (device, new ImageDataProvider () { + @Override + public ImageData getImageData (int zoom) { + return resultData; + } + }); + GC gc = new GC (resultImage); + gc.setAntialias (SWT.ON); + gc.drawImage (original, 0, 0, DPIUtil.autoScaleDown (width), DPIUtil.autoScaleDown (height), + /* E.g. destWidth here is effectively DPIUtil.autoScaleDown (scaledWidth), but avoiding rounding errors. + * Nevertheless, we still have some rounding errors due to the point-based API GC#drawImage(..). + */ + 0, 0, Math.round (DPIUtil.autoScaleDown ((float) width * scaleFactor)), Math.round (DPIUtil.autoScaleDown ((float) height * scaleFactor))); + gc.dispose (); + original.dispose (); + ImageData result = resultImage.getImageDataAtCurrentZoom (); + resultImage.dispose (); + return result; + case NEAREST: + default: + return imageData.scaledTo (scaledWidth, scaledHeight); + } +} + +/** + * Returns a new rectangle as per the scaleFactor. + */ +public static Rectangle autoScaleBounds (Rectangle rect, int targetZoom, int currentZoom) { + if (deviceZoom == 100 || rect == null || targetZoom == currentZoom) return rect; + float scaleFactor = ((float)targetZoom) / (float)currentZoom; + Rectangle returnRect = new Rectangle (0,0,0,0); + returnRect.x = Math.round (rect.x * scaleFactor); + returnRect.y = Math.round (rect.y * scaleFactor); + returnRect.width = Math.round (rect.width * scaleFactor); + returnRect.height = Math.round (rect.height * scaleFactor); + return returnRect; +} + +/** + * Auto-scale up ImageData + */ +public static ImageData autoScaleUp (Device device, final ImageData imageData) { + if (deviceZoom == 100 || imageData == null) return imageData; + float scaleFactor = getScalingFactor (); + return autoScaleImageData(device, imageData, scaleFactor); +} + +public static int[] autoScaleUp(int[] pointArray) { + if (deviceZoom == 100 || pointArray == null) return pointArray; + float scaleFactor = getScalingFactor (); + int [] returnArray = new int[pointArray.length]; + for (int i = 0; i < pointArray.length; i++) { + returnArray [i] = Math.round (pointArray [i] * scaleFactor); + } + return returnArray; +} + +/** + * Auto-scale up int dimensions. + */ +public static int autoScaleUp (int size) { + if (deviceZoom == 100 || size == SWT.DEFAULT) return size; + float scaleFactor = getScalingFactor (); + return Math.round (size * scaleFactor); +} + +public static float autoScaleUp(float size) { + if (deviceZoom == 100 || size == SWT.DEFAULT) return size; + float scaleFactor = getScalingFactor (); + return (size * scaleFactor); +} + +/** + * Returns a new scaled up Point. + */ +public static Point autoScaleUp (Point point) { + if (deviceZoom == 100 || point == null) return point; + float scaleFactor = getScalingFactor (); + Point scaledPoint = new Point (0,0); + scaledPoint.x = Math.round (point.x * scaleFactor); + scaledPoint.y = Math.round (point.y * scaleFactor); + return scaledPoint; +} + +/** + * Returns a new scaled up Rectangle. + */ +public static Rectangle autoScaleUp (Rectangle rect) { + if (deviceZoom == 100 || rect == null) return rect; + Rectangle scaledRect = new Rectangle (0,0,0,0); + Point scaledTopLeft = DPIUtil.autoScaleUp (new Point (rect.x, rect.y)); + Point scaledBottomRight = DPIUtil.autoScaleUp (new Point (rect.x + rect.width, rect.y + rect.height)); + + scaledRect.x = scaledTopLeft.x; + scaledRect.y = scaledTopLeft.y; + scaledRect.width = scaledBottomRight.x - scaledTopLeft.x; + scaledRect.height = scaledBottomRight.y - scaledTopLeft.y; + return scaledRect; +} + +/** + * Returns Scaling factor from the display + * @return float scaling factor + */ +private static float getScalingFactor () { + return deviceZoom / 100f; +} + +/** + * Compute the zoom value based on the DPI value. + * + * @return zoom + */ +public static int mapDPIToZoom (int dpi) { + double zoom = (double) dpi * 100 / DPI_ZOOM_100; + int roundedZoom = (int) Math.round (zoom); + return roundedZoom; +} +/** + * Gets Image data at specified zoom level, if image is missing then + * fall-back to 100% image. If provider or fall-back image is not available, + * throw error. + */ +public static ImageData validateAndGetImageDataAtZoom (ImageDataProvider provider, int zoom, boolean[] found) { + if (provider == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + ImageData data = provider.getImageData (zoom); + found [0] = (data != null); + /* If image is null when (zoom != 100%), fall-back to image at 100% zoom */ + if (zoom != 100 && !found [0]) data = provider.getImageData (100); + if (data == null) SWT.error (SWT.ERROR_INVALID_ARGUMENT); + return data; +} + +/** + * Gets Image file path at specified zoom level, if image is missing then + * fall-back to 100% image. If provider or fall-back image is not available, + * throw error. + */ +public static String validateAndGetImagePathAtZoom (ImageFileNameProvider provider, int zoom, boolean[] found) { + if (provider == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + String filename = provider.getImagePath (zoom); + found [0] = (filename != null); + /* If image is null when (zoom != 100%), fall-back to image at 100% zoom */ + if (zoom != 100 && !found [0]) filename = provider.getImagePath (100); + if (filename == null) SWT.error (SWT.ERROR_INVALID_ARGUMENT); + return filename; +} + +public static int getDeviceZoom() { + return deviceZoom; +} + +public static void setDeviceZoom (int nativeDeviceZoom) { + int deviceZoom = 0; + String value = System.getProperty (SWT_AUTOSCALE); + if (value != null) { + if ("false".equalsIgnoreCase (value)) { + deviceZoom = 100; + } else if ("quarter".equalsIgnoreCase (value)) { + deviceZoom = (int) (Math.round (nativeDeviceZoom / 25f) * 25); + } else if ("exact".equalsIgnoreCase (value)) { + deviceZoom = nativeDeviceZoom; + } else { + try { + int zoom = Integer.parseInt (value); + deviceZoom = Math.max (Math.min (zoom, 1600), 25); + } catch (NumberFormatException e) { + // unsupported value, use default + } + } + } + if (deviceZoom == 0) { // || "integer".equalsIgnoreCase (value) + deviceZoom = Math.max ((nativeDeviceZoom + 25) / 100 * 100, 100); + } + + DPIUtil.deviceZoom = deviceZoom; + System.setProperty("org.eclipse.swt.internal.deviceZoom", Integer.toString(deviceZoom)); + if (deviceZoom != 100 && autoScaleMethodSetting == AutoScaleMethod.AUTO) { + if (deviceZoom / 100 * 100 == deviceZoom || !"gtk".equals(SWT.getPlatform())) { + autoScaleMethod = AutoScaleMethod.NEAREST; + } else { + autoScaleMethod = AutoScaleMethod.SMOOTH; + } + } +} + +/** + * AutoScale ImageDataProvider. + */ +public static final class AutoScaleImageDataProvider implements ImageDataProvider { + Device device; + ImageData imageData; + int currentZoom; + public AutoScaleImageDataProvider(Device device, ImageData data, int zoom){ + this.device = device; + this.imageData = data; + this.currentZoom = zoom; + } + @Override + public ImageData getImageData(int zoom) { + return DPIUtil.autoScaleImageData(device, imageData, zoom, currentZoom); + } +} +} diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gnome/GNOME.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gnome/GNOME.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gnome/GNOME.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gnome/GNOME.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -150,7 +150,7 @@ * @param uris cast=(GList *) */ public static final native int _gnome_vfs_mime_application_launch(int /*long*/ application, int /*long*/ uris); -public static final int gnome_vfs_mime_application_launch(int /*long*/ application, int /*long*/ uris) { +public static final int gnome_vfs_mime_application_launch(int /*long*/ application, int /*long*/ uris) { lock.lock(); try { return _gnome_vfs_mime_application_launch(application, uris); @@ -180,9 +180,9 @@ lock.unlock(); } } -/** +/** * @param mime_type cast=(const char *) - * @param base_mime_type cast=(const char *) + * @param base_mime_type cast=(const char *) */ public static final native int /*long*/ _gnome_vfs_mime_type_get_equivalence(int /*long*/ mime_type, byte [] base_mime_type); public static final int /*long*/ gnome_vfs_mime_type_get_equivalence(int /*long*/ mime_type, byte [] base_mime_type) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gnome/GnomeVFSMimeApplication.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gnome/GnomeVFSMimeApplication.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gnome/GnomeVFSMimeApplication.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gnome/GnomeVFSMimeApplication.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,13 +8,13 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.swt.internal.gnome; - + public class GnomeVFSMimeApplication { /** @field cast=(char *) */ public int /*long*/ id; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkColor.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkColor.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkColor.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkColor.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -19,7 +19,7 @@ /** @field cast=(guint32) */ public int pixel; /** @field cast=(guint16) */ - public short red; + public short red; /** @field cast=(guint16) */ public short green; /** @field cast=(guint16) */ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkDragContext.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkDragContext.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkDragContext.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkDragContext.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,14 +8,14 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.swt.internal.gtk; -public class GdkDragContext { +public class GdkDragContext { /** @field cast=(GdkDragProtocol) */ public int protocol; /** @field cast=(gboolean) */ @@ -31,7 +31,7 @@ /** @field cast=(GdkDragAction) */ public int suggested_action; /** @field cast=(GdkDragAction) */ - public int action; + public int action; /** @field cast=(guint32) */ public int start_time; public static final int sizeof = OS.GdkDragContext_sizeof(); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkEventAny.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkEventAny.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkEventAny.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkEventAny.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkEventButton.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkEventButton.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkEventButton.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkEventButton.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkEventCrossing.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkEventCrossing.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkEventCrossing.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkEventCrossing.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkEventExpose.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkEventExpose.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkEventExpose.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkEventExpose.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkEventFocus.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkEventFocus.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkEventFocus.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkEventFocus.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkEvent.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkEventKey.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkEventKey.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkEventKey.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkEventKey.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkEventMotion.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkEventMotion.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkEventMotion.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkEventMotion.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkEventProperty.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkEventProperty.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkEventProperty.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkEventProperty.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkEventScroll.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkEventScroll.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkEventScroll.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkEventScroll.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkEventWindowState.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkEventWindowState.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkEventWindowState.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkEventWindowState.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -18,7 +18,7 @@ public class GdkEventWindowState extends GdkEvent { /** @field cast=(GdkWindow *) */ public int /*long*/ window; - public byte send_event; + public byte send_event; public int changed_mask; public int new_window_state; public static final int sizeof = OS.GdkEventWindowState_sizeof(); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkGCValues.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkGCValues.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkGCValues.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkGCValues.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkGeometry.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkGeometry.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkGeometry.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkGeometry.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkImage.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkImage.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkImage.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkImage.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkRectangle.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkRectangle.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkRectangle.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkRectangle.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkRGBA.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkRGBA.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkRGBA.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkRGBA.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -16,7 +16,7 @@ public class GdkRGBA { - public double red; + public double red; public double green; public double blue; public double alpha; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkVisual.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkVisual.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkVisual.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkVisual.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkWindowAttr.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkWindowAttr.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GdkWindowAttr.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GdkWindowAttr.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GInterfaceInfo.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GInterfaceInfo.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GInterfaceInfo.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GInterfaceInfo.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GObjectClass.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GObjectClass.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GObjectClass.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GObjectClass.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GtkAdjustment.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GtkAdjustment.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GtkAdjustment.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GtkAdjustment.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GtkAllocation.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GtkAllocation.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GtkAllocation.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GtkAllocation.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GtkBorder.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GtkBorder.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GtkBorder.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GtkBorder.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GtkCellRendererClass.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GtkCellRendererClass.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GtkCellRendererClass.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GtkCellRendererClass.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GtkFixed.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GtkFixed.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GtkFixed.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GtkFixed.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GtkRequisition.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GtkRequisition.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GtkRequisition.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GtkRequisition.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GtkTargetEntry.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GtkTargetEntry.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GtkTargetEntry.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GtkTargetEntry.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GtkWidgetClass.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GtkWidgetClass.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GtkWidgetClass.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GtkWidgetClass.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GTypeInfo.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GTypeInfo.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GTypeInfo.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GTypeInfo.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -36,5 +36,5 @@ public int /*long*/ instance_init; /** @field cast=(GTypeValueTable *) */ public int /*long*/ value_table; - public static final int sizeof = OS.GTypeInfo_sizeof(); + public static final int sizeof = OS.GTypeInfo_sizeof(); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GTypeQuery.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GTypeQuery.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/GTypeQuery.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/GTypeQuery.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/OS.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/OS.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/OS.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/OS.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. All rights reserved. + * Copyright (c) 2000, 2016 IBM Corporation and others. All rights reserved. * The contents of this file are made available under the terms * of the GNU Lesser General Public License (LGPL) Version 2.1 that * accompanies this distribution (lgpl-v21.txt). The LGPL is also @@ -20,20 +20,10 @@ public class OS extends C { static { - String gtk3 = System.getProperty("SWT_GTK3"); - if (gtk3 == null) { - int /*long*/ ptr = OS.getenv(ascii("SWT_GTK3")); - if (ptr != 0) { - int length = OS.strlen(ptr); - byte[] buffer = new byte[length]; - OS.memmove(buffer, ptr, length); - char[] convertedChar = new char[buffer.length]; - for (int i = 0; i < buffer.length; i++) { - convertedChar[i]=(char)buffer[i]; - } - gtk3 = new String(convertedChar); - } - } + String scalingProperty = "GDK_SCALE"; + OS.setenv(ascii(scalingProperty), ascii("1"), 1); + String propertyName = "SWT_GTK3"; + String gtk3 = getEnvironmentalVariable (propertyName); if (gtk3 != null && gtk3.equals("0")) { Library.loadLibrary("swt-pi"); } @@ -46,6 +36,34 @@ } } + //Add ability to debug gtk warnings for SWT snippets via SWT_FATAL_WARNINGS=1 + // env variable. Please see Eclipse bug 471477 + static { + String propertyName = "SWT_FATAL_WARNINGS"; + String swt_fatal_warnings = getEnvironmentalVariable (propertyName); + + if (swt_fatal_warnings != null && swt_fatal_warnings.equals("1")) { + OS.swt_debug_on_fatal_warnings (); + } + } + + private static String getEnvironmentalVariable (String envVarName) { + String envVarValue = System.getProperty(envVarName); + if (envVarValue == null) { + int /*long*/ ptr = OS.getenv(ascii(envVarName)); + if (ptr != 0) { + int length = OS.strlen(ptr); + byte[] buffer = new byte[length]; + OS.memmove(buffer, ptr, length); + char[] convertedChar = new char[buffer.length]; + for (int i = 0; i < buffer.length; i++) { + convertedChar[i]=(char)buffer[i]; + } + envVarValue = new String(convertedChar); + } + } + return envVarValue; + } /** OS Constants */ public static final boolean IsAIX, IsSunOS, IsLinux, IsHPUX, BIG_ENDIAN; static { @@ -230,7 +248,10 @@ public static final int GDK_Meta_L = 0xFFE7; public static final int GDK_Meta_R = 0xFFE8; public static final int GDK_MAP = 14; - public static final int GDK_MOD1_MASK = 0x8; + public static final int GDK_MOD1_MASK = 0x8; //usually 'alt' modifier. + public static final int GDK_SUPER_MASK = 0x4000000; + public static final int GDK_HYPER_MASK = 0x8000000; + public static final int GDK_META_MASK = 0x10000000; public static final int GDK_MOTION_NOTIFY = 0x3; public static final int GDK_NO_EXPOSE = 30; public static final int GDK_NONE = 0; @@ -344,6 +365,7 @@ public static final int GTK_POLICY_ALWAYS = 0x0; public static final int GTK_POLICY_AUTOMATIC = 0x1; public static final int GTK_POLICY_NEVER = 0x2; + public static final int GTK_POLICY_EXTERNAL = 0x3; public static final int GTK_POS_TOP = 0x2; public static final int GTK_POS_BOTTOM = 0x3; public static final int GTK_PRINT_CAPABILITY_PAGE_SET = 1 << 0; @@ -630,6 +652,7 @@ public static final byte[] gtk_show_input_method_menu = ascii("gtk-show-input-method-menu"); public static final byte[] gtk_menu_bar_accel = ascii("gtk-menu-bar-accel"); public static final byte[] gtk_menu_images = ascii("gtk-menu-images"); + public static final byte[] gtk_theme_name = ascii("gtk-theme-name"); public static final byte[] inner_border = ascii("inner-border"); public static final byte[] has_backward_stepper = ascii("has-backward-stepper"); public static final byte[] has_secondary_backward_stepper = ascii("has-secondary-backward-stepper"); @@ -649,11 +672,14 @@ public static final byte[] text = ascii("text"); public static final byte[] xalign = ascii("xalign"); public static final byte[] ypad = ascii("ypad"); + public static final byte[] margin_bottom = ascii("margin-bottom"); + public static final byte[] margin_top = ascii("margin-top"); public static final byte[] GTK_PRINT_SETTINGS_OUTPUT_URI = ascii("output-uri"); - + public static final byte[] scrollbar_spacing = ascii("scrollbar-spacing"); + /* * Needed to tell GTK 3 to prefer a dark or light theme in the UI. - * Improves the look of the Eclipse Dark theme in GTK 3 systems. + * Improves the look of the Eclipse Dark theme in GTK 3 systems. */ public static final byte[] gtk_application_prefer_dark_theme = ascii("gtk-application-prefer-dark-theme"); @@ -669,6 +695,8 @@ public static final byte[] GTK_NAMED_ICON_GO_DOWN = ascii ("go-down-symbolic"); public static final byte[] GTK_NAMED_ICON_GO_NEXT = ascii ("go-next-symbolic"); public static final byte[] GTK_NAMED_ICON_GO_PREVIOUS = ascii ("go-previous-symbolic"); + public static final byte[] GTK_NAMED_LABEL_OK = ascii("_OK"); + public static final byte[] GTK_NAMED_LABEL_CANCEL = ascii("_Cancel"); /* GVariant Types */ public static final byte[] G_VARIANT_TYPE_BOOLEAN = ascii("b"); public static final byte[] G_VARIANT_TYPE_DOUBLE = ascii("d"); @@ -680,6 +708,28 @@ public static final int GLIB_VERSION = VERSION(glib_major_version(), glib_minor_version(), glib_micro_version()); public static final boolean GTK3 = GTK_VERSION >= VERSION(3, 0, 0); + + /* Feature in Gtk: with the switch to GtkMenuItems from GtkImageMenuItems + * in Gtk3 came a small Gtk shortfall: a small amount of padding on the left hand + * side of MenuItems was added. This padding is not accessible to the developer, + * causing vertical alignment issues in menus that have both image and text only + * MenuItems. As an option, the user can specify the SWT_PADDED_MENU_ITEMS environment + * variable, which (when enabled), double pads MenuItems so as to create consistent + * vertical alignment throughout that particular menu. + * + * For more information see: + * Bug 470298 + */ + public static final boolean SWT_PADDED_MENU_ITEMS; + static { + String paddedProperty = "SWT_PADDED_MENU_ITEMS"; + String paddedCheck = getEnvironmentalVariable(paddedProperty); + boolean usePadded = false; + if (paddedCheck != null && paddedCheck.equals("1")) { + usePadded = true; + } + SWT_PADDED_MENU_ITEMS = usePadded; + } public static final boolean USE_CAIRO, INIT_CAIRO; static { boolean useCairo = false; @@ -714,7 +764,7 @@ } public static boolean isX11 () { - return GDK_WINDOWING_X11() && GDK_IS_X11_DISPLAY(gdk_display_get_default()); + return GDK_WINDOWING_X11() && GDK_IS_X11_DISPLAY(gdk_display_get_default()); } /** 64 bit */ @@ -787,8 +837,6 @@ public static final native int GTK_RANGE_SLIDER_START(int /*long*/ widget); /** @param widget cast=(GtkRange *) */ public static final native int GTK_RANGE_SLIDER_END(int /*long*/ widget); -/** @param widget cast=(GtkScrolledWindow *) */ -public static final native int GTK_SCROLLED_WINDOW_SCROLLBAR_SPACING(int /*long*/ widget); /** * @param acce_label cast=(GtkAccelLabel *) * @param string cast=(gchar *) @@ -813,6 +861,9 @@ /** @param xevent cast=(XAnyEvent *) */ public static final native int /*long*/ X_EVENT_WINDOW(int /*long*/ xevent); +/** @param widget cast=(GtkWidget *) */ +public static final native int /*long*/ GTK_WIDGET_GET_CLASS(int /*long*/ widget); + /** X11 Native methods and constants */ public static final int Above = 0; public static final int Below = 1; @@ -1750,6 +1801,28 @@ lock.unlock(); } } +/** @method flags=dynamic */ +public static final native int /*long*/ _gtk_widget_get_name(int /*long*/ widget); +public static final int /*long*/ gtk_widget_get_name(int /*long*/ widget) { + lock.lock(); + try { + return _gtk_widget_get_name(widget); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic + * @param widget_class cast=(GtkWidgetClass *) + */ +public static final native int /*long*/ _gtk_widget_class_get_css_name(int /*long*/ widget_class); +public static final int /*long*/ gtk_widget_class_get_css_name(int /*long*/ widget_class) { + lock.lock(); + try { + return _gtk_widget_class_get_css_name(widget_class); + } finally { + lock.unlock(); + } +} public static final native void _GTK_WIDGET_SET_FLAGS(int /*long*/ wid, int flag); public static final void GTK_WIDGET_SET_FLAGS(int /*long*/ wid, int flag) { lock.lock(); @@ -4068,12 +4141,14 @@ lock.unlock(); } } -/** @param cursor_type cast=(GdkCursorType) */ -public static final native int /*long*/ _gdk_cursor_new(int /*long*/ cursor_type); -public static final int /*long*/ gdk_cursor_new(int /*long*/ cursor_type) { +/** @param display cast=(GdkDisplay *) + * @param cursor_type cast=(GdkCursorType) + */ +public static final native int /*long*/ _gdk_cursor_new_for_display(int /*long*/ display, int /*long*/ cursor_type); +public static final int /*long*/ gdk_cursor_new_for_display(int /*long*/ display, int /*long*/ cursor_type) { lock.lock(); try { - return _gdk_cursor_new(cursor_type); + return _gdk_cursor_new_for_display(display, cursor_type); } finally { lock.unlock(); } @@ -5444,6 +5519,33 @@ lock.unlock(); } } +/** + * @method flags=dynamic + * @param rgba cast=(GdkRGBA *) + */ +public static final native int /*long*/ _gdk_rgba_to_string(GdkRGBA rgba); +public static final int /*long*/ gdk_rgba_to_string(GdkRGBA rgba) { + lock.lock(); + try { + return _gdk_rgba_to_string(rgba); + } finally { + lock.unlock(); + } +} +/** + * @method flags=dynamic + * @param rgba cast=(GdkRGBA *) + * @param property cast=(const gchar *) + */ +public static final native int /*long*/ _gdk_rgba_parse(GdkRGBA rgba, byte[] property); +public static final int /*long*/ gdk_rgba_parse(GdkRGBA rgba, byte[] property) { + lock.lock(); + try { + return _gdk_rgba_parse(rgba, property); + } finally { + lock.unlock(); + } +} /** @method flags=dynamic */ public static final native int /*long*/ _gdk_screen_get_default(); public static final int /*long*/ gdk_screen_get_default() { @@ -5457,6 +5559,33 @@ /** * @method flags=dynamic * @param screen cast=(GdkScreen *) + */ +public static final native double _gdk_screen_get_resolution(int /*long*/ screen); +public static final double gdk_screen_get_resolution(int /*long*/ screen) { + lock.lock(); + try { + return _gdk_screen_get_resolution(screen); + } finally { + lock.unlock(); + } +} +/** + * @method flags=dynamic + * @param screen cast=(GdkScreen *) + * @param monitor_num cast=(gint) + */ +public static final native int _gdk_screen_get_monitor_scale_factor(int /*long*/ screen, int monitor_num); +public static final int gdk_screen_get_monitor_scale_factor(int /*long*/ screen, int monitor_num) { + lock.lock(); + try { + return _gdk_screen_get_monitor_scale_factor(screen, monitor_num); + } finally { + lock.unlock(); + } +} +/** + * @method flags=dynamic + * @param screen cast=(GdkScreen *) * @param x cast=(gint) * @param y cast=(gint) */ @@ -6243,6 +6372,16 @@ lock.unlock(); } } +/** @param label cast=(const gchar *) */ +public static final native int /*long*/ _gtk_accel_label_new(byte[] label); +public static final int /*long*/ gtk_accel_label_new(byte[] label) { + lock.lock(); + try { + return _gtk_accel_label_new(label); + } finally { + lock.unlock(); + } +} /** * @method flags=dynamic * @param accessible cast=(GtkAccessible *) @@ -6729,6 +6868,19 @@ } /** * @method flags=dynamic + * @param cell cast=(GtkCellRenderer *) + */ +public static final native void _gtk_cell_renderer_get_fixed_size(int /*long*/ cell, int[] width, int[] height); +public static final void gtk_cell_renderer_get_fixed_size (int /*long*/ cell, int[] width, int[] height) { + lock.lock(); + try { + _gtk_cell_renderer_get_fixed_size(cell, width, height); + } finally { + lock.unlock(); + } +} +/** + * @method flags=dynamic * @param widget cast=(GtkWidget *) * @param minimum_size cast=(GtkRequisition *) * @param natural_size cast=(GtkRequisition *) @@ -6812,6 +6964,19 @@ lock.unlock(); } } +/** + * @method flags=dynamic + * @param label cast=(const gchar *) + */ +public static final native int /*long*/ _gtk_image_menu_item_new_with_label(byte[] label); +public static final int /*long*/ gtk_image_menu_item_new_with_label(byte[] label) { + lock.lock(); + try { + return _gtk_image_menu_item_new_with_label(label); + } finally { + lock.unlock(); + } +} /** @param label cast=(const gchar *) */ public static final native int /*long*/ _gtk_check_menu_item_new_with_label(byte[] label); public static final int /*long*/ gtk_check_menu_item_new_with_label(byte[] label) { @@ -6822,6 +6987,15 @@ lock.unlock(); } } +public static final native int /*long*/ _gtk_check_menu_item_new(); +public static final int /*long*/ gtk_check_menu_item_new() { + lock.lock(); + try { + return _gtk_check_menu_item_new(); + } finally { + lock.unlock(); + } +} /** * @param wid cast=(GtkCheckMenuItem *) * @param active cast=(gboolean) @@ -6935,6 +7109,21 @@ } /** * @method flags=dynamic + * @param chooser cast=(GtkColorChooser *) + * @param orientation cast=(GtkOrientation) + * @param colors cast=(GdkRGBA *) + */ +public static final native int /*long*/ _gtk_color_chooser_add_palette(int /*long*/ chooser, int orientation, int colors_per_line, int n_colors, int /*long*/ colors); +public static final int /*long*/ gtk_color_chooser_add_palette(int /*long*/ chooser, int orientation, int colors_per_line, int n_colors, int /*long*/ colors) { + lock.lock(); + try { + return _gtk_color_chooser_add_palette(chooser, orientation, colors_per_line, n_colors, colors); + } finally { + lock.unlock(); + } +} +/** + * @method flags=dynamic * @param title cast=(const gchar *) * @param parent cast=(GtkWindow *) */ @@ -6961,6 +7150,18 @@ } /** * @method flags=dynamic + */ +public static final native boolean _gtk_color_chooser_get_use_alpha (int /*long*/ chooser); +public static final boolean gtk_color_chooser_get_use_alpha (int /*long*/ chooser) { + lock.lock(); + try { + return _gtk_color_chooser_get_use_alpha (chooser); + } finally { + lock.unlock(); + } +} +/** + * @method flags=dynamic * @param color_dialog cast=(GtkColorSelectionDialog *) */ public static final native int /*long*/ _gtk_color_selection_dialog_get_color_selection(int /*long*/ color_dialog); @@ -7043,9 +7244,10 @@ } } /** -* @param combo cast=(GtkComboBox *) -* @param val cast=(gboolean) -*/ + * @method flags=dynamic + * @param combo cast=(GtkComboBox *) + * @param val cast=(gboolean) + */ public static final native void _gtk_combo_box_set_focus_on_click(int /*long*/ combo, boolean val); public static final void gtk_combo_box_set_focus_on_click(int /*long*/ combo, boolean val) { lock.lock(); @@ -7232,6 +7434,10 @@ lock.unlock(); } } + +//Do not confuse this function with gtk_container_foreach(..). +//Make sure you know what you are doing when using this. Please be attentive to swt_fixed_forall(..) +// found in os_custom.c, which overrides this function for swtFixed container with custom behaviour. /** * @param container cast=(GtkContainer *) * @param callback cast=(GtkCallback) @@ -7279,16 +7485,6 @@ lock.unlock(); } } -/** @param container cast=(GtkContainer *) */ -public static final native void _gtk_container_resize_children(int /*long*/ container); -public static final void gtk_container_resize_children(int /*long*/ container) { - lock.lock(); - try { - _gtk_container_resize_children(container); - } finally { - lock.unlock(); - } -} /** * @param container cast=(GtkContainer *) * @param border_width cast=(guint) @@ -7912,7 +8108,27 @@ lock.unlock(); } } -/** @method flags=no_gen */ +/** + * @param title cast=(const gchar *),flags=no_out + * @param parent cast=(GtkWindow *) + * @param first_button_text cast=(const gchar *),flags=no_out + * @param terminator cast=(const gchar *),flags=sentinel + */ +public static final native int /*long*/ _gtk_file_chooser_dialog_new(byte[] title, int /*long*/ parent, int action, byte[] first_button_text, int first_button_id, byte[] second_button_text, int second_button_id, int /*long*/ terminator); +public static final int /*long*/ gtk_file_chooser_dialog_new(byte[] title, int /*long*/ parent, int action, byte[] first_button_text, int first_button_id, byte[] second_button_text, int second_button_id, int /*long*/ terminator) { + lock.lock(); + try { + return _gtk_file_chooser_dialog_new(title, parent, action, first_button_text, first_button_id, second_button_text, second_button_id, terminator); + } finally { + lock.unlock(); + } +} +/** + * @param title cast=(const gchar *),flags=no_out + * @param parent cast=(GtkWindow *) + * @param first_button_text cast=(const gchar *),flags=no_out + * @param terminator cast=(const gchar *),flags=sentinel + */ public static final native int /*long*/ _gtk_file_chooser_dialog_new(byte[] title, int /*long*/ parent, int action, int /*long*/ first_button_text, int first_button_id, int /*long*/ second_button_text, int second_button_id, int /*long*/ terminator); public static final int /*long*/ gtk_file_chooser_dialog_new(byte[] title, int /*long*/ parent, int action, int /*long*/ first_button_text, int first_button_id, int /*long*/ second_button_text, int second_button_id, int /*long*/ terminator) { lock.lock(); @@ -8429,6 +8645,38 @@ } } /** + * @param box cast=(GtkBox *) + * @param widget cast=(GtkWidget *) + * @param expand cast=(gboolean) + * @param fill cast=(gboolean) + * @param padding cast=(guint) + */ +public static final native void /*int*/ _gtk_box_pack_end(int /*long*/ box, int /*long*/ widget, + boolean expand, boolean fill, int padding); +public static final void /*int*/ gtk_box_pack_end(int /*long*/ box, int /*long*/ widget, + boolean expand, boolean fill, int padding) { + lock.lock(); + try { + _gtk_box_pack_end(box, widget, expand, fill, padding); + } finally { + lock.unlock(); + } +} +/** + * @param box cast=(GtkBox *) + * @param child cast=(GtkWidget *) + * @param position cast=(gint) + */ +public static final native void /*int*/ _gtk_box_reorder_child(int /*long*/ box, int /*long*/ child, int position); +public static final void /*int*/ gtk_box_reorder_child(int /*long*/ box, int /*long*/ child, int position) { + lock.lock(); + try { + _gtk_box_reorder_child(box, child, position); + } finally { + lock.unlock(); + } +} +/** * @method flags=dynamic * @param box cast=(GtkBox *) */ @@ -8769,19 +9017,8 @@ lock.unlock(); } } -/** @param label cast=(const gchar *) */ -public static final native int /*long*/ _gtk_image_menu_item_new_with_label(byte[] label); -public static final int /*long*/ gtk_image_menu_item_new_with_label(byte[] label) { - lock.lock(); - try { - return _gtk_image_menu_item_new_with_label(label); - } finally { - lock.unlock(); - } -} - - /** + * @method flags=dynamic * @param menu_item cast=(GtkImageMenuItem *) * @param image cast=(GtkWidget *) */ @@ -8803,6 +9040,19 @@ lock.unlock(); } } +/** + * @param image cast=(GtkImage *) + * @param pixel_size cast=(gint) + */ +public static final native void /*int*/ _gtk_image_set_pixel_size(int /*long*/ image, int pixel_size); +public static final void /*int*/ gtk_image_set_pixel_size(int /*long*/ image, int pixel_size) { + lock.lock(); + try { + _gtk_image_set_pixel_size(image, pixel_size); + } finally { + lock.unlock(); + } +} /** @param pixbuf cast=(GdkPixbuf *) */ public static final native int /*long*/ _gtk_image_new_from_pixbuf(int /*long*/ pixbuf); public static final int /*long*/ gtk_image_new_from_pixbuf(int /*long*/ pixbuf) { @@ -9086,6 +9336,29 @@ lock.unlock(); } } +/** @method flags=dynamic */ +public static final native int /*long*/ _gtk_css_provider_to_string(int /*long*/ provider); +public static final int /*long*/gtk_css_provider_to_string(int /*long*/ provider) { + lock.lock(); + try { + return _gtk_css_provider_to_string(provider); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic + * @param name cast=(const gchar *) + * @param variant cast=(const gchar *) + */ +public static final native int /*long*/ _gtk_css_provider_get_named (byte[] name, byte[] variant); +public static final int /*long*/gtk_css_provider_get_named(byte[] name, byte[] variant) { + lock.lock(); + try { + return _gtk_css_provider_get_named(name, variant); + } finally { + lock.unlock(); + } +} /** * @method flags=dynamic * @param screen cast=(GdkScreen *) @@ -9293,6 +9566,25 @@ lock.unlock(); } } +/** @param label cast=(const gchar *) */ +public static final native int /*long*/ _gtk_menu_item_new_with_label(byte[] label); +public static final int /*long*/ gtk_menu_item_new_with_label(byte[] label) { + lock.lock(); + try { + return _gtk_menu_item_new_with_label(label); + } finally { + lock.unlock(); + } +} +public static final native int /*long*/ _gtk_menu_item_new(); +public static final int /*long*/ gtk_menu_item_new() { + lock.lock(); + try { + return _gtk_menu_item_new(); + } finally { + lock.unlock(); + } +} /** * @param menu_item cast=(GtkMenuItem *) * @param submenu cast=(GtkWidget *) @@ -9397,12 +9689,13 @@ * @param type cast=(GtkMessageType) * @param buttons cast=(GtkButtonsType) * @param message_format cast=(const gchar *) + * @param arg cast=(const gchar *) */ -public static final native int /*long*/ _gtk_message_dialog_new(int /*long*/ parent, int flags, int type, int buttons, byte[] message_format); -public static final int /*long*/ gtk_message_dialog_new(int /*long*/ parent, int flags, int type, int buttons, byte[] message_format) { +public static final native int /*long*/ _gtk_message_dialog_new(int /*long*/ parent, int flags, int type, int buttons, byte[] message_format, byte[] arg); +public static final int /*long*/ gtk_message_dialog_new(int /*long*/ parent, int flags, int type, int buttons, byte[] message_format, byte[] arg) { lock.lock(); try { - return _gtk_message_dialog_new(parent, flags, type, buttons, message_format); + return _gtk_message_dialog_new(parent, flags, type, buttons, message_format, arg); } finally { lock.unlock(); } @@ -11042,6 +11335,19 @@ } } /** + * @method flags=dynamic + * @param scrollable cast=(GtkScrollable *) + */ +public static final native int /*long*/ _gtk_scrollable_get_vadjustment(int /*long*/ scrollable); +public static final int /*long*/ gtk_scrollable_get_vadjustment(int /*long*/ scrollable) { + lock.lock(); + try { + return _gtk_scrollable_get_vadjustment(scrollable); + } finally { + lock.unlock(); + } +} +/** * @param style cast=(GtkRcStyle *) * @param color flags=no_out */ @@ -11199,6 +11505,7 @@ } } /** + * @method flags=dynamic * @param settings cast=(GtkSettings *) * @param name cast=(const gchar *) * @param v_string cast=(const gchar *) @@ -11669,8 +11976,8 @@ /** @method flags=dynamic * @param self cast=(GtkWidget *) * */ -public static final native int /*long*/ _gtk_widget_get_state_flags(int /*long*/ self); -public static final int /*long*/ gtk_widget_get_state_flags(int /*long*/ self) { +public static final native int _gtk_widget_get_state_flags(int /*long*/ self); +public static final int gtk_widget_get_state_flags(int /*long*/ self) { lock.lock(); try { return _gtk_widget_get_state_flags(self); @@ -11963,6 +12270,21 @@ } /** * @param buffer cast=(GtkTextBuffer *) + * @param mark_name cast=(const gchar *) + * @param where cast=(GtkTextIter *) + * @param left_gravity cast=(gboolean) + */ +public static final native int /*long*/ _gtk_text_buffer_create_mark(int /*long*/ buffer, byte [] mark_name, byte [] where, boolean left_gravity); +public static final int /*long*/ gtk_text_buffer_create_mark(int /*long*/ buffer, byte [] mark_name, byte [] where, boolean left_gravity) { + lock.lock(); + try { + return _gtk_text_buffer_create_mark(buffer, mark_name, where, left_gravity); + } finally { + lock.unlock(); + } +} +/** + * @param buffer cast=(GtkTextBuffer *) * @param clipboard cast=(GtkClipboard *) * @param default_editable cast=(gboolean) */ @@ -12342,12 +12664,16 @@ /** * @param text_view cast=(GtkTextView *) * @param mark cast=(GtkTextMark *) + * @param within_margin cast=(gdouble) + * @param use_align cast=(gboolean) + * @param xalign cast=(gdouble) + * @param yalign cast=(gdouble) */ -public static final native void _gtk_text_view_scroll_mark_onscreen(int /*long*/ text_view, int /*long*/ mark); -public static final void gtk_text_view_scroll_mark_onscreen(int /*long*/ text_view, int /*long*/ mark) { +public static final native void _gtk_text_view_scroll_to_mark(int /*long*/ text_view, int /*long*/ mark, double within_margin, boolean use_align, double xalign, double yalign); +public static final void gtk_text_view_scroll_to_mark(int /*long*/ text_view, int /*long*/ mark, double within_margin, boolean use_align, double xalign, double yalign) { lock.lock(); try { - _gtk_text_view_scroll_mark_onscreen(text_view, mark); + _gtk_text_view_scroll_to_mark(text_view, mark, within_margin, use_align, xalign, yalign); } finally { lock.unlock(); } @@ -14580,6 +14906,16 @@ } } /** @method flags=dynamic */ +public static final native void _gtk_widget_queue_draw(int /*long*/ widget); +public static final void gtk_widget_queue_draw(int /*long*/ widget) { + lock.lock(); + try { + _gtk_widget_queue_draw(widget) ; + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ public static final native boolean _gtk_widget_set_can_focus(int /*long*/ widget, boolean can_focus); public static final boolean gtk_widget_set_can_focus(int /*long*/ widget, boolean can_focus) { lock.lock(); @@ -14646,6 +14982,20 @@ } } /** + * @method flags=dynamic + * @param widget cast=(GtkWidget *) + * @param val cast=(gboolean) + */ +public static final native void _gtk_widget_set_focus_on_click(int /*long*/ widget, boolean val); +public static final void gtk_widget_set_focus_on_click(int /*long*/ widget, boolean val) { + lock.lock(); + try { + _gtk_widget_set_focus_on_click(widget, val); + } finally { + lock.unlock(); + } +} +/** * @param widget cast=(GtkWidget *) * @param name cast=(const char *) */ @@ -15279,6 +15629,12 @@ * @param src cast=(const void *),flags=no_out * @param size cast=(size_t) */ +public static final native void memmove(int /*long*/ dest, GdkRGBA src, int /*long*/ size); +/** + * @param dest cast=(void *) + * @param src cast=(const void *),flags=no_out + * @param size cast=(size_t) + */ public static final native void memmove(int /*long*/ dest, GdkEventButton src, int /*long*/ size); /** * @param dest cast=(void *) @@ -16737,6 +17093,20 @@ */ public static final native int strcmp (int /*long*/ s1, byte [] s2); + +//Add ability to debug gtk warnings for SWT snippets via SWT_FATAL_WARNINGS=1 +// env variable. Please see Eclipse bug 471477 +// NOTE: this is a custom function in os_custom.h/c. +public static final native void _swt_debug_on_fatal_warnings(); +public static final void swt_debug_on_fatal_warnings() { + lock.lock(); + try { + _swt_debug_on_fatal_warnings (); + } finally { + lock.unlock(); + } +} + public static final native int /*long*/ _swt_fixed_get_type(); public static final int /*long*/ swt_fixed_get_type() { lock.lock(); @@ -16792,7 +17162,7 @@ * <p> * Note: This method gets called from the org.eclipse.e4.ui.swt.gtk fragment. * </p> - * + * * @since 3.104 */ public static final void setDarkThemePreferred(boolean preferred){ @@ -16803,4 +17173,139 @@ g_object_notify(gtk_settings_get_default(), gtk_application_prefer_dark_theme); } + +/** + * @method flags=dynamic + * @param schema_id cast=(const gchar *) + */ +public static final native int /*long*/ _g_settings_new (byte[] schema_id); +public static final int /*long*/ g_settings_new (byte[] schema_id) { + lock.lock(); + try { + return _g_settings_new (schema_id); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native void _g_settings_get (int /*long*/ settings, byte[] key, byte[] format, byte[] monitorId, int[] scalingfactor); +public static final void g_settings_get (int /*long*/ settings, byte[] key, byte[] format, byte[] monitorId, int[] scalingfactor) { + lock.lock(); + try { + _g_settings_get (settings, key, format, monitorId, scalingfactor); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_settings_get_value (int /*long*/ settings, byte[] key); +public static final int /*long*/ g_settings_get_value (int /*long*/ settings, byte[] key) { + lock.lock(); + try { + return _g_settings_get_value (settings, key); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_variant_dict_lookup_value (int /*long*/ variant, byte[] key, int /*long*/ expectedType); +public static final int /*long*/ g_variant_dict_lookup_value (int /*long*/ variant, byte[] key, int /*long*/ expectedType) { + lock.lock(); + try { + return _g_variant_dict_lookup_value (variant, key, expectedType); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_variant_iter_new (int /*long*/ variant); +public static final int /*long*/ g_variant_iter_new (int /*long*/ variant) { + lock.lock(); + try { + return _g_variant_iter_new (variant); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native void _g_variant_iter_free (int /*long*/ variant); +public static final void g_variant_iter_free (int /*long*/ variant) { + lock.lock(); + try { + _g_variant_iter_free (variant); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int _g_variant_iter_init (int /*long*/ iter, int /*long*/ variant); +public static final int g_variant_iter_init (int /*long*/ iter, int /*long*/ variant) { + lock.lock(); + try { + return _g_variant_iter_init (iter, variant); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native boolean _g_variant_iter_next (int /*long*/ iter, byte[] format, int /*long*/ key, int /*long*/ value); +public static final boolean g_variant_iter_next (int /*long*/ iter, byte[] format, int /*long*/ key, int /*long*/ value) { + lock.lock(); + try { + return _g_variant_iter_next (iter, format, key, value); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_variant_iter_next_value (int /*long*/ iter); +public static final int /*long*/ g_variant_iter_next_value (int /*long*/ iter) { + lock.lock(); + try { + return _g_variant_iter_next_value (iter); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_variant_print (int /*long*/ value); +public static final int /*long*/ g_variant_print (int /*long*/ value) { + lock.lock(); + try { + return _g_variant_print (value); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native void _g_variant_unref (int /*long*/ variant); +public static final void g_variant_unref (int /*long*/ variant) { + lock.lock(); + try { + _g_variant_unref (variant); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_settings_schema_source_get_default (); +public static final int /*long*/ g_settings_schema_source_get_default () { + lock.lock(); + try { + return _g_settings_schema_source_get_default (); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_settings_schema_source_lookup (int /*long*/ schemaSource, byte[] schema_id, boolean recursive); +public static final int /*long*/ g_settings_schema_source_lookup (int /*long*/ schemaSource, byte[] schema_id, boolean recursive) { + lock.lock(); + try { + return _g_settings_schema_source_lookup (schemaSource, schema_id, recursive); + } finally { + lock.unlock(); + } +} + } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/PangoAttrColor.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/PangoAttrColor.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/PangoAttrColor.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/PangoAttrColor.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/PangoAttribute.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/PangoAttribute.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/PangoAttribute.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/PangoAttribute.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/PangoAttrInt.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/PangoAttrInt.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/PangoAttrInt.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/PangoAttrInt.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/PangoItem.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/PangoItem.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/PangoItem.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/PangoItem.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/PangoLayoutLine.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/PangoLayoutLine.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/PangoLayoutLine.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/PangoLayoutLine.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/PangoLayoutRun.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/PangoLayoutRun.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/PangoLayoutRun.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/PangoLayoutRun.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/PangoLogAttr.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/PangoLogAttr.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/PangoLogAttr.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/PangoLogAttr.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/PangoRectangle.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/PangoRectangle.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/PangoRectangle.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/PangoRectangle.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/XAnyEvent.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/XAnyEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/XAnyEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/XAnyEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.swt.internal.gtk; - + public abstract class XAnyEvent extends XEvent { public int /*long*/ serial; public int send_event; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/XEvent.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/XEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/XEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/XEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.swt.internal.gtk; - + public class XEvent { public int type; public static final int sizeof = OS.XEvent_sizeof(); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/XExposeEvent.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/XExposeEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/XExposeEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/XExposeEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.swt.internal.gtk; - + public class XExposeEvent extends XAnyEvent { public int x; public int y; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/XFocusChangeEvent.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/XFocusChangeEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/XFocusChangeEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/XFocusChangeEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.swt.internal.gtk; - + public class XFocusChangeEvent extends XAnyEvent { public int mode; public int detail; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/XRenderPictureAttributes.java swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/XRenderPictureAttributes.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/gtk/XRenderPictureAttributes.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/gtk/XRenderPictureAttributes.java 2016-07-06 19:11:33.000000000 +0000 @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.swt.internal.gtk; - + public class XRenderPictureAttributes { public boolean repeat; public int /*long*/ alpha_map; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/FileFormat.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/FileFormat.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/FileFormat.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/FileFormat.java 2016-07-06 19:11:33.000000000 +0000 @@ -24,7 +24,7 @@ static final String FORMAT_PACKAGE = "org.eclipse.swt.internal.image"; //$NON-NLS-1$ static final String FORMAT_SUFFIX = "FileFormat"; //$NON-NLS-1$ static final String[] FORMATS = {"WinBMP", "WinBMP", "GIF", "WinICO", "JPEG", "PNG", "TIFF", "OS2BMP"}; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$//$NON-NLS-7$//$NON-NLS-8$ - + LEDataInputStream inputStream; LEDataOutputStream outputStream; ImageLoader loader; @@ -48,7 +48,7 @@ /** * Read the specified input stream, and return the * device independent image array represented by the stream. - */ + */ public ImageData[] loadFromStream(LEDataInputStream stream) { try { inputStream = stream; @@ -66,7 +66,7 @@ /** * Read the specified input stream using the specified loader, and * return the device independent image array represented by the stream. - */ + */ public static ImageData[] load(InputStream is, ImageLoader loader) { FileFormat fileFormat = null; LEDataInputStream stream = new LEDataInputStream(is); @@ -89,7 +89,7 @@ /** * Write the device independent image array stored in the specified loader * to the specified output stream using the specified file format. - */ + */ public static void save(OutputStream os, int format, ImageLoader loader) { if (format < 0 || format >= FORMATS.length) SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT); if (FORMATS[format] == null) SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT); @@ -117,7 +117,7 @@ /** * Write the device independent image array stored in the specified loader * to the specified output stream. - */ + */ public void unloadIntoStream(ImageLoader loader, LEDataOutputStream stream) { try { outputStream = stream; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/GIFFileFormat.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/GIFFileFormat.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/GIFFileFormat.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/GIFFileFormat.java 2016-07-06 19:11:33.000000000 +0000 @@ -22,7 +22,7 @@ int delayTime = 0; int transparentPixel = -1; int repeatCount = 1; - + static final int GIF_APPLICATION_EXTENSION_BLOCK_ID = 0xFF; static final int GIF_GRAPHICS_CONTROL_BLOCK_ID = 0xF9; static final int GIF_PLAIN_TEXT_BLOCK_ID = 0x01; @@ -32,7 +32,7 @@ static final int GIF_TRAILER_ID = 0x3B; static final byte [] GIF89a = new byte[] { (byte)'G', (byte)'I', (byte)'F', (byte)'8', (byte)'9', (byte)'a' }; static final byte [] NETSCAPE2_0 = new byte[] { (byte)'N', (byte)'E', (byte)'T', (byte)'S', (byte)'C', (byte)'A', (byte)'P', (byte)'E', (byte)'2', (byte)'.', (byte)'0' }; - + /** * Answer a palette containing numGrays * shades of gray, ranging from black to white. @@ -382,7 +382,7 @@ left, top, disposalMethod, - delayTime); + delayTime); LZWCodec codec = new LZWCodec(); codec.decode(inputStream, loader, image, interlaced, initialCodeSize); return image; @@ -401,14 +401,14 @@ } RGB[] colors = new RGB[numColors]; for (int i = 0; i < numColors; i++) - colors[i] = new RGB(bytes[i*3] & 0xFF, + colors[i] = new RGB(bytes[i*3] & 0xFF, bytes[i*3+1] & 0xFF, bytes[i*3+2] & 0xFF); return new PaletteData(colors); } @Override void unloadIntoByteStream(ImageLoader loader) { - + /* Step 1: Acquire GIF parameters. */ ImageData[] data = loader.data; int frameCount = data.length; @@ -421,7 +421,7 @@ PaletteData palette = firstImage.palette; RGB[] colors = palette.getRGBs(); short globalTable = 1; - + /* Step 2: Check for validity and global/local color map. */ if (!(depth == 1 || depth == 4 || depth == 8)) { SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH); @@ -438,7 +438,7 @@ RGB rgbs[] = data[i].palette.getRGBs(); if (rgbs.length != colors.length) { globalTable = 0; - } else { + } else { for (int j=0; j<colors.length; j++) { if (!(rgbs[j].red == colors[j].red && rgbs[j].green == colors[j].green && @@ -449,7 +449,7 @@ } } } - + try { /* Step 3: Write the GIF89a Header and Logical Screen Descriptor. */ outputStream.write(GIF89a); @@ -462,7 +462,7 @@ } catch (IOException e) { SWT.error(SWT.ERROR_IO, e); } - + /* Step 4: Write Global Color Table if applicable. */ if (globalTable == 1) { writePalette(palette, depth); @@ -484,14 +484,14 @@ SWT.error(SWT.ERROR_IO, e); } } - + for (int frame=0; frame<frameCount; frame++) { - + /* Step 6: Write Graphics Control Block for each frame if applicable. */ if (multi || data[frame].transparentPixel != -1) { writeGraphicsControlBlock(data[frame]); } - + /* Step 7: Write Image Header for each frame. */ int x = data[frame].x; int y = data[frame].y; @@ -507,18 +507,18 @@ block[4] = (byte)(width & 0xFF); block[5] = (byte)((width >> 8) & 0xFF); block[6] = (byte)(height & 0xFF); - block[7] = (byte)((height >> 8) & 0xFF); + block[7] = (byte)((height >> 8) & 0xFF); block[8] = (byte)(globalTable == 0 ? (depth-1) | 0x80 : 0x00); outputStream.write(block); } catch (IOException e) { SWT.error(SWT.ERROR_IO, e); } - + /* Step 8: Write Local Color Table for each frame if applicable. */ if (globalTable == 0) { writePalette(data[frame].palette, depth); } - + /* Step 9: Write the actual data for each frame. */ try { outputStream.write(depth); // Minimum LZW Code size diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGAppn.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGAppn.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGAppn.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGAppn.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,11 +16,11 @@ public JPEGAppn(byte[] reference) { super(reference); } - + public JPEGAppn(LEDataInputStream byteStream) { super(byteStream); } - + @Override public boolean verify() { int marker = getSegmentMarker(); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGArithmeticConditioningTable.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGArithmeticConditioningTable.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGArithmeticConditioningTable.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGArithmeticConditioningTable.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,7 +16,7 @@ public JPEGArithmeticConditioningTable(LEDataInputStream byteStream) { super(byteStream); } - + @Override public int signature() { return JPEGFileFormat.DAC; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGComment.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGComment.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGComment.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGComment.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,11 +16,11 @@ public JPEGComment(byte[] reference) { super(reference); } - + public JPEGComment(LEDataInputStream byteStream) { super(byteStream); } - + @Override public int signature() { return JPEGFileFormat.COM; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGDecoder.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGDecoder.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGDecoder.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGDecoder.java 2016-07-06 19:11:33.000000000 +0000 @@ -4,7 +4,7 @@ * 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 - * + * * This source file is based in part on the work of the Independent JPEG Group (IJG) * and is made available under the terms contained in the about_files/IJG_README * file accompanying this program. @@ -20,7 +20,7 @@ import org.eclipse.swt.graphics.*; public class JPEGDecoder { - + static final int DCTSIZE = 8; static final int DCTSIZE2 = 64; static final int NUM_QUANT_TBLS = 4; @@ -40,24 +40,24 @@ static final int SCALEBITS = 16; /* speediest right-shift on some machines */ static final int ONE_HALF = 1 << (SCALEBITS-1); - + static final int RGB_RED = 2; /* Offset of Red in an RGB scanline element */ static final int RGB_GREEN = 1; /* Offset of Green */ static final int RGB_BLUE = 0; /* Offset of Blue */ static final int RGB_PIXELSIZE = 3; - + static final int JBUF_PASS_THRU = 0; static final int JBUF_SAVE_SOURCE = 1; /* Run source subobject only, save output */ static final int JBUF_CRANK_DEST = 2; /* Run dest subobject only, using saved data */ - static final int JBUF_SAVE_AND_PASS = 3; - + static final int JBUF_SAVE_AND_PASS = 3; + static final int JPEG_MAX_DIMENSION = 65500; static final int BITS_IN_JSAMPLE = 8; - + static final int JDITHER_NONE = 0; /* no dithering */ static final int JDITHER_ORDERED = 1; /* simple ordered dither */ - static final int JDITHER_FS = 2; - + static final int JDITHER_FS = 2; + static final int JDCT_ISLOW = 0; /* slow but accurate integer algorithm */ static final int JDCT_IFAST = 1; /* faster, less accurate integer method */ static final int JDCT_FLOAT = 2; /* floating-point: accurate, fast on fast HW */ @@ -76,11 +76,11 @@ static final int Q20_POS = 16; static final int Q11_POS = 9; static final int Q02_POS = 2; - + static final int CTX_PREPARE_FOR_IMCU = 0; /* need to prepare for MCU row */ static final int CTX_PROCESS_IMCU = 1; /* feeding iMCU to postprocessor */ static final int CTX_POSTPONED_ROW = 2; /* feeding postponed row group */ - + static final int APP0_DATA_LEN = 14; /* Length of interesting data in APP0 */ static final int APP14_DATA_LEN = 12; /* Length of interesting data in APP14 */ static final int APPN_DATA_LEN = 14; /* Must be the largest of the above!! */ @@ -139,7 +139,7 @@ static final int M_COM = 0xfe; static final int M_TEM = 0x01; static final int M_ERROR = 0x100; - + /* Values of global_state field (jdapi.c has some dependencies on ordering!) */ static final int CSTATE_START = 100; /* after create_compress */ static final int CSTATE_SCANNING = 101; /* start_compress done, write_scanlines OK */ @@ -161,7 +161,7 @@ static final int JPEG_REACHED_EOI = 2; /* Reached end of image */ static final int JPEG_ROW_COMPLETED = 3; /* Completed one iMCU row */ static final int JPEG_SCAN_COMPLETED = 4; /* Completed last iMCU row of a scan */ - + static final int JPEG_SUSPENDED = 0; /* Suspended due to lack of input data */ static final int JPEG_HEADER_OK = 1; /* Found valid image datastream */ static final int JPEG_HEADER_TABLES_ONLY = 2; /* Found valid table-specs-only datastream */ @@ -170,23 +170,23 @@ static final int DECOMPRESS_DATA = 0; static final int DECOMPRESS_SMOOTH_DATA = 1; static final int DECOMPRESS_ONEPASS = 2; - + static final int CONSUME_DATA = 0; static final int DUMMY_CONSUME_DATA = 1; - + static final int PROCESS_DATA_SIMPLE_MAIN = 0; static final int PROCESS_DATA_CONTEXT_MAIN = 1; static final int PROCESS_DATA_CRANK_POST = 2; - + static final int POST_PROCESS_1PASS = 0; static final int POST_PROCESS_DATA_UPSAMPLE = 1; - + static final int NULL_CONVERT = 0; static final int GRAYSCALE_CONVERT = 1; static final int YCC_RGB_CONVERT = 2; static final int GRAY_RGB_CONVERT = 3; static final int YCCK_CMYK_CONVERT = 4; - + static final int NOOP_UPSAMPLE = 0; static final int FULLSIZE_UPSAMPLE = 1; static final int H2V1_FANCY_UPSAMPLE = 2; @@ -194,10 +194,10 @@ static final int H2V2_FANCY_UPSAMPLE = 4; static final int H2V2_UPSAMPLE = 5; static final int INT_UPSAMPLE = 6; - + static final int INPUT_CONSUME_INPUT = 0; static final int COEF_CONSUME_INPUT = 1; - + static int extend_test[] = /* entry n is 2**(n-1) */ { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, @@ -211,7 +211,7 @@ ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 }; - + static int jpeg_natural_order[] = { 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, @@ -224,7 +224,7 @@ 63, 63, 63, 63, 63, 63, 63, 63, /* extra entries for safety in decoder */ 63, 63, 63, 63, 63, 63, 63, 63 }; - + static final class JQUANT_TBL { /* This array gives the coefficient quantizers in natural array order * (not the zigzag order in which they are stored in a JPEG DQT marker). @@ -238,7 +238,7 @@ */ boolean sent_table; /* true when table has been output */ } - + static final class JHUFF_TBL { /* These two fields directly represent the contents of a JPEG DHT marker */ byte[] bits = new byte[17]; /* bits[k] = # of symbols with codes of */ @@ -251,12 +251,12 @@ */ boolean sent_table; /* true when table has been output */ } - + static final class bitread_perm_state { /* Bitreading state saved across MCUs */ int get_buffer; /* current bit-extraction buffer */ int bits_left; /* # of unused bits in it */ } - + static final class bitread_working_state { /* Bitreading working state within an MCU */ /* Current data source location */ /* We need a copy, rather than munging the original, in case of suspension */ @@ -270,13 +270,13 @@ int bits_left; /* # of unused bits in it */ /* Pointer needed by jpeg_fill_bit_buffer. */ jpeg_decompress_struct cinfo; /* back link to decompress master record */ - } - + } + static final class savable_state { int EOBRUN; //Note that this is only used in the progressive case int[] last_dc_val = new int[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ } - + static final class d_derived_tbl { /* Basic tables: (element [0] of each array is unused) */ int[] maxcode = new int[18]; /* largest code of length k (-1 if none) */ @@ -297,15 +297,15 @@ */ int[] look_nbits = new int[1<<HUFF_LOOKAHEAD]; /* # bits, or 0 if too long */ byte[] look_sym = new byte[1<<HUFF_LOOKAHEAD]; /* symbol, or unused */ - } - + } + static final class jpeg_d_coef_controller { int consume_data; int decompress_data; /* Pointer to array of coefficient virtual arrays, or null if none */ short[][][] coef_arrays; - + /* These variables keep track of the current location of the input side. */ /* cinfo.input_iMCU_row is also used for this. */ int MCU_ctr; /* counts MCUs processed in current row */ @@ -330,14 +330,14 @@ /* When doing block smoothing, we latch coefficient Al values here */ int[] coef_bits_latch; - + short[] workspace; void start_input_pass (jpeg_decompress_struct cinfo) { cinfo.input_iMCU_row = 0; start_iMCU_row(cinfo); } - + /* Reset within-iMCU-row counters for a new row (input side) */ void start_iMCU_row (jpeg_decompress_struct cinfo) { jpeg_d_coef_controller coef = cinfo.coef; @@ -358,9 +358,9 @@ coef.MCU_ctr = 0; coef.MCU_vert_offset = 0; } - + } - + static abstract class jpeg_entropy_decoder { abstract void start_pass (jpeg_decompress_struct cinfo); abstract boolean decode_mcu (jpeg_decompress_struct cinfo, short[][] MCU_data); @@ -368,10 +368,10 @@ /* This is here to share code between baseline and progressive decoders; */ /* other modules probably should not use it */ boolean insufficient_data; /* set true after emitting warning */ - + bitread_working_state br_state_local = new bitread_working_state(); savable_state state_local = new savable_state(); - } + } static final class huff_entropy_decoder extends jpeg_entropy_decoder { bitread_perm_state bitstate = new bitread_perm_state(); /* Bit buffer at start of MCU */ @@ -392,7 +392,7 @@ /* Whether we care about the DC and AC coefficient values for each block */ boolean[] dc_needed = new boolean[D_MAX_BLOCKS_IN_MCU]; boolean[] ac_needed = new boolean[D_MAX_BLOCKS_IN_MCU]; - + @Override void start_pass (jpeg_decompress_struct cinfo) { start_pass_huff_decoder(cinfo); @@ -425,12 +425,12 @@ /* Load up working state */ // BITREAD_LOAD_STATE(cinfo,entropy.bitstate); br_state.cinfo = cinfo; - br_state.buffer = cinfo.buffer; + br_state.buffer = cinfo.buffer; br_state.bytes_in_buffer = cinfo.bytes_in_buffer; br_state.bytes_offset = cinfo.bytes_offset; get_buffer = entropy.bitstate.get_buffer; bits_left = entropy.bitstate.bits_left; - + // ASSIGN_STATE(state, entropy.saved); state.last_dc_val[0] = entropy.saved.last_dc_val[0]; state.last_dc_val[1] = entropy.saved.last_dc_val[1]; @@ -513,7 +513,7 @@ /* Section F.2.2.2: decode the AC coefficients */ /* Since zeroes are skipped, output area must be cleared beforehand */ for (k = 1; k < DCTSIZE2; k++) { -// HUFF_DECODE(s, br_state, actbl, return FALSE, label2); +// HUFF_DECODE(s, br_state, actbl, return FALSE, label2); { int nb = 0, look; if (bits_left < HUFF_LOOKAHEAD) { @@ -522,7 +522,7 @@ } get_buffer = br_state.get_buffer; bits_left = br_state.bits_left; if (bits_left < HUFF_LOOKAHEAD) { - nb = 1; + nb = 1; // goto slowlabel; if ((s=jpeg_huff_decode(br_state,get_buffer,bits_left,actbl,nb)) < 0) { return false; @@ -546,10 +546,10 @@ get_buffer = br_state.get_buffer; bits_left = br_state.bits_left; } } - } + } r = s >> 4; s &= 15; - + if (s != 0) { k += r; // CHECK_BIT_BUFFER(br_state, s, return FALSE); @@ -619,10 +619,10 @@ get_buffer = br_state.get_buffer; bits_left = br_state.bits_left; } } - } + } r = s >> 4; s &= 15; - + if (s != 0) { k += r; // CHECK_BIT_BUFFER(br_state, s, return FALSE); @@ -716,7 +716,7 @@ /* Initialize restart counter */ entropy.restarts_to_go = cinfo.restart_interval; } - + boolean process_restart (jpeg_decompress_struct cinfo) { huff_entropy_decoder entropy = this; int ci; @@ -748,7 +748,7 @@ return true; } } - + static final class phuff_entropy_decoder extends jpeg_entropy_decoder { /* These fields are loaded into local variables at start of each MCU. @@ -764,14 +764,14 @@ d_derived_tbl[] derived_tbls = new d_derived_tbl[NUM_HUFF_TBLS]; d_derived_tbl ac_derived_tbl; /* active table during an AC scan */ - + int[] newnz_pos = new int[DCTSIZE2]; - + @Override void start_pass (jpeg_decompress_struct cinfo) { start_pass_phuff_decoder(cinfo); } - + @Override boolean decode_mcu (jpeg_decompress_struct cinfo, short[][] MCU_data) { boolean is_DC_band = (cinfo.Ss == 0); @@ -787,7 +787,7 @@ return decode_mcu_AC_refine(cinfo, MCU_data); } } - + boolean decode_mcu_DC_refine (jpeg_decompress_struct cinfo, short[][] MCU_data) { phuff_entropy_decoder entropy = this; int p1 = 1 << cinfo.Al; /* 1 in the bit position being coded */ @@ -798,7 +798,7 @@ int bits_left; // bitread_working_state br_state = new bitread_working_state(); bitread_working_state br_state = br_state_local; - + /* Process restart marker if needed; may have to suspend */ if (cinfo.restart_interval != 0) { if (entropy.restarts_to_go == 0) @@ -813,12 +813,12 @@ /* Load up working state */ // BITREAD_LOAD_STATE(cinfo,entropy.bitstate); br_state.cinfo = cinfo; - br_state.buffer = cinfo.buffer; + br_state.buffer = cinfo.buffer; br_state.bytes_in_buffer = cinfo.bytes_in_buffer; br_state.bytes_offset = cinfo.bytes_offset; get_buffer = entropy.bitstate.get_buffer; bits_left = entropy.bitstate.bits_left; - + /* Outer loop handles each block in the MCU */ for (blkn = 0; blkn < cinfo.blocks_in_MCU; blkn++) { @@ -847,14 +847,14 @@ cinfo.bytes_offset = br_state.bytes_offset; entropy.bitstate.get_buffer = get_buffer; entropy.bitstate.bits_left = bits_left; - + /* Account for restart interval (no-op if not using restarts) */ entropy.restarts_to_go--; return true; } - + boolean decode_mcu_AC_refine (jpeg_decompress_struct cinfo, short[][] MCU_data) { phuff_entropy_decoder entropy = this; int Se = cinfo.Se; @@ -869,7 +869,7 @@ int bits_left; // bitread_working_state br_state = new bitread_working_state(); bitread_working_state br_state = br_state_local; - + d_derived_tbl tbl; int num_newnz; int[] newnz_pos = entropy.newnz_pos; @@ -888,12 +888,12 @@ /* Load up working state */ // BITREAD_LOAD_STATE(cinfo,entropy.bitstate); br_state.cinfo = cinfo; - br_state.buffer = cinfo.buffer; + br_state.buffer = cinfo.buffer; br_state.bytes_in_buffer = cinfo.bytes_in_buffer; br_state.bytes_offset = cinfo.bytes_offset; get_buffer = entropy.bitstate.get_buffer; bits_left = entropy.bitstate.bits_left; - + EOBRUN = entropy.saved.EOBRUN; /* only part of saved state we need */ /* There is always only one block per MCU */ @@ -926,7 +926,7 @@ } get_buffer = br_state.get_buffer; bits_left = br_state.bits_left; if (bits_left < HUFF_LOOKAHEAD) { - nb = 1; + nb = 1; // goto slowlabel; if ((s=jpeg_huff_decode(br_state,get_buffer,bits_left,tbl,nb)) < 0) { // failaction; @@ -948,7 +948,7 @@ } else { nb = HUFF_LOOKAHEAD+1; // slowlabel: - if ((s=jpeg_huff_decode(br_state,get_buffer,bits_left,tbl,nb)) < 0) { + if ((s=jpeg_huff_decode(br_state,get_buffer,bits_left,tbl,nb)) < 0) { // failaction; while (num_newnz > 0) block[newnz_pos[--num_newnz]] = 0; @@ -1071,7 +1071,7 @@ // failaction; while (num_newnz > 0) block[newnz_pos[--num_newnz]] = 0; - + return false; } get_buffer = (br_state).get_buffer; bits_left = (br_state).bits_left; @@ -1099,7 +1099,7 @@ cinfo.bytes_offset = br_state.bytes_offset; entropy.bitstate.get_buffer = get_buffer; entropy.bitstate.bits_left = bits_left; - + entropy.saved.EOBRUN = EOBRUN; /* only part of saved state we need */ } @@ -1115,8 +1115,8 @@ // // return false; - } - + } + boolean decode_mcu_AC_first (jpeg_decompress_struct cinfo, short[][] MCU_data) { phuff_entropy_decoder entropy = this; int Se = cinfo.Se; @@ -1129,7 +1129,7 @@ int bits_left; // bitread_working_state br_state = new bitread_working_state(); bitread_working_state br_state = br_state_local; - + d_derived_tbl tbl; /* Process restart marker if needed; may have to suspend */ @@ -1156,12 +1156,12 @@ else { // BITREAD_LOAD_STATE(cinfo,entropy.bitstate); br_state.cinfo = cinfo; - br_state.buffer = cinfo.buffer; + br_state.buffer = cinfo.buffer; br_state.bytes_in_buffer = cinfo.bytes_in_buffer; br_state.bytes_offset = cinfo.bytes_offset; get_buffer = entropy.bitstate.get_buffer; bits_left = entropy.bitstate.bits_left; - + block = MCU_data[0]; tbl = entropy.ac_derived_tbl; @@ -1262,8 +1262,8 @@ return true; } - - boolean decode_mcu_DC_first (jpeg_decompress_struct cinfo, short[][] MCU_data) { + + boolean decode_mcu_DC_first (jpeg_decompress_struct cinfo, short[][] MCU_data) { phuff_entropy_decoder entropy = this; int Al = cinfo.Al; int s = 0, r; @@ -1274,7 +1274,7 @@ int bits_left; // bitread_working_state br_state = new bitread_working_state(); bitread_working_state br_state = br_state_local; - + // savable_state state = new savable_state(); savable_state state = state_local; d_derived_tbl tbl; @@ -1295,19 +1295,19 @@ /* Load up working state */ // BITREAD_LOAD_STATE(cinfo,entropy.bitstate); br_state.cinfo = cinfo; - br_state.buffer = cinfo.buffer; + br_state.buffer = cinfo.buffer; br_state.bytes_in_buffer = cinfo.bytes_in_buffer; br_state.bytes_offset = cinfo.bytes_offset; get_buffer = entropy.bitstate.get_buffer; bits_left = entropy.bitstate.bits_left; - + // ASSIGN_STATE(state, entropy.saved); state.EOBRUN = entropy.saved.EOBRUN; state.last_dc_val[0] = entropy.saved.last_dc_val[0]; state.last_dc_val[1] = entropy.saved.last_dc_val[1]; state.last_dc_val[2] = entropy.saved.last_dc_val[2]; state.last_dc_val[3] = entropy.saved.last_dc_val[3]; - + /* Outer loop handles each block in the MCU */ for (blkn = 0; blkn < cinfo.blocks_in_MCU; blkn++) { @@ -1397,7 +1397,7 @@ return true; } - + boolean process_restart (jpeg_decompress_struct cinfo) { phuff_entropy_decoder entropy = this; int ci; @@ -1534,7 +1534,7 @@ } } - + static final class jpeg_component_info { /* These values are fixed over the whole image. */ /* For compression, they must be supplied by parameter setup; */ @@ -1550,9 +1550,9 @@ /* The decompressor output side may not use these variables. */ int dc_tbl_no; /* DC entropy table selector (0..3) */ int ac_tbl_no; /* AC entropy table selector (0..3) */ - + /* Remaining fields should be treated as private by applications. */ - + /* These values are computed during compression or decompression startup: */ /* Component's size in DCT blocks. * Any dummy blocks added to complete an MCU are not counted; therefore @@ -1599,7 +1599,7 @@ /* Private per-component storage for DCT or IDCT subsystem. */ int[] dct_table; } - + static final class jpeg_color_quantizer { // JMETHOD(void, start_pass, (j_decompress_ptr cinfo, boolean is_pre_scan)); // JMETHOD(void, color_quantize, (j_decompress_ptr cinfo, @@ -1607,7 +1607,7 @@ // int num_rows)); // JMETHOD(void, finish_pass, (j_decompress_ptr cinfo)); // JMETHOD(void, new_color_map, (j_decompress_ptr cinfo)); - + /* Initially allocated colormap is saved here */ int[][] sv_colormap; /* The color map as a 2-D pixel array */ int sv_actual; /* number of entries in use */ @@ -1627,13 +1627,13 @@ /* Variables for Floyd-Steinberg dithering */ // FSERRPTR fserrors[MAX_Q_COMPS]; /* accumulated errors */ - boolean on_odd_row; - + boolean on_odd_row; + void start_pass (jpeg_decompress_struct cinfo, boolean is_pre_scan) { error(); } } - + static final class jpeg_upsampler { // JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); // JMETHOD(void, upsample, (j_decompress_ptr cinfo, @@ -1645,7 +1645,7 @@ // JDIMENSION out_rows_avail)); boolean need_context_rows; /* TRUE if need rows above & below */ - + /* Color conversion buffer. When using separate upsampling and color * conversion steps, this buffer holds one upsampled row group until it * has been color converted and output. @@ -1670,7 +1670,7 @@ */ byte[] h_expand = new byte[MAX_COMPONENTS]; byte[] v_expand = new byte[MAX_COMPONENTS]; - + void start_pass (jpeg_decompress_struct cinfo) { jpeg_upsampler upsample = cinfo.upsample; @@ -1679,9 +1679,9 @@ /* Initialize total-height counter for detecting bottom of image */ upsample.rows_to_go = cinfo.output_height; } - + } - + static final class jpeg_marker_reader { /* Read a restart marker --- exported for use by entropy decoder only */ // jpeg_marker_parser_method read_restart_marker; @@ -1693,7 +1693,7 @@ boolean saw_SOF; /* found SOF? */ int next_restart_num; /* next restart number expected (0-7) */ int discarded_bytes; /* # of bytes skipped looking for a marker */ - + /* Application-overridable marker processing methods */ // jpeg_marker_parser_method process_COM; // jpeg_marker_parser_method process_APPn[16]; @@ -1707,12 +1707,12 @@ // int bytes_read; /* data bytes read so far in marker */ /* Note: cur_marker is not linked into marker_list until it's all read. */ } - - + + static final class jpeg_d_main_controller { // JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)); int process_data; - + /* Pointer to allocated workspace (M or M+2 row groups). */ byte[][][] buffer = new byte[MAX_COMPONENTS][][]; int[] buffer_offset = new int[MAX_COMPONENTS]; @@ -1730,7 +1730,7 @@ int context_state; /* process_data state machine status */ int rowgroups_avail; /* row groups available to postprocessor */ int iMCU_row_ctr; /* counts iMCU rows to detect image top/bot */ - + void start_pass (jpeg_decompress_struct cinfo, int pass_mode) { jpeg_d_main_controller main = cinfo.main; @@ -1761,7 +1761,7 @@ break; } } - + } static final class jpeg_decomp_master { @@ -1781,13 +1781,13 @@ jpeg_color_quantizer quantizer_1pass; jpeg_color_quantizer quantizer_2pass; } - + static final class jpeg_inverse_dct { // JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); // /* It is useful to allow each component to have a separate IDCT method. */ // inverse_DCT_method_ptr inverse_DCT[MAX_COMPONENTS]; int[] cur_method = new int[MAX_COMPONENTS]; - + void start_pass (jpeg_decompress_struct cinfo) { jpeg_inverse_dct idct = cinfo.idct; int ci, i; @@ -1896,7 +1896,7 @@ // 4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247 // }; // SHIFT_TEMPS -// +// // for (i = 0; i < DCTSIZE2; i++) { // ifmtbl[i] = DESCALE(MULTIPLY16V16( qtbl.quantval[i], aanscales[i]), CONST_BITS-IFAST_SCALE_BITS); // } @@ -1938,7 +1938,7 @@ } } } - + static final class jpeg_input_controller { int consume_input; boolean has_multiple_scans; /* True if file has multiple scans */ @@ -1946,27 +1946,27 @@ boolean inheaders; /* true until first SOS is reached */ } - + static final class jpeg_color_deconverter { // JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); int color_convert; - + /* Private state for YCC.RGB conversion */ int[] Cr_r_tab; /* => table for Cr to R conversion */ int[] Cb_b_tab; /* => table for Cb to B conversion */ int[] Cr_g_tab; /* => table for Cr to G conversion */ int[] Cb_g_tab; /* => table for Cb to G conversion */ - + void start_pass (jpeg_decompress_struct cinfo) { /* no work needed */ } } - + static final class jpeg_d_post_controller { // JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)); int post_process_data; - + /* Color quantization source buffer: this holds output data from * the upsample/color conversion step to be passed to the quantizer. * For two-pass color quantization, we need a full-image buffer; @@ -1978,7 +1978,7 @@ /* for two-pass mode only: */ int starting_row; /* row # of first row in current strip */ int next_row; /* index of next row to fill/empty in strip */ - + void start_pass (jpeg_decompress_struct cinfo, int pass_mode) { jpeg_d_post_controller post = cinfo.post; @@ -2027,7 +2027,7 @@ } } - + static final class jpeg_decompress_struct { // jpeg_error_mgr * err; /* Error handler module */\ // struct jpeg_memory_mgr * mem; /* Memory manager module */\ @@ -2243,7 +2243,7 @@ * read from the data source, but has not yet been processed. */ int unread_marker; - + int[] workspace = new int[DCTSIZE2]; int[] row_ctr = new int[1]; @@ -2319,7 +2319,7 @@ //if (cinfo.progressive_mode) //access_rows *= 3; //#endif - coef.whole_image[ci] = + coef.whole_image[ci] = new short [(int)jround_up( compptr.height_in_blocks, compptr.v_samp_factor)] [(int)jround_up( compptr.width_in_blocks, compptr.h_samp_factor)] @@ -2707,7 +2707,7 @@ int M = cinfo.min_DCT_scaled_size; jpeg_component_info compptr; byte[][] buf, xbuf0, xbuf1; - + for (ci = 0; ci < cinfo.num_components; ci++) { compptr = cinfo.comp_info[ci]; rgroup = (compptr.v_samp_factor * compptr.DCT_scaled_size) / @@ -2895,7 +2895,7 @@ /* Create progression status table */ cinfo.coef_bits = new int[cinfo.num_components][DCTSIZE2]; coef_bit_ptr = cinfo.coef_bits; - for (ci = 0; ci < cinfo.num_components; ci++) + for (ci = 0; ci < cinfo.num_components; ci++) for (i = 0; i < DCTSIZE2; i++) coef_bit_ptr[ci][i] = -1; } @@ -2944,11 +2944,11 @@ int ctr; int[] workspace = cinfo.workspace; /* buffers data between passes */ // SHIFT_TEMPS - + /* Pass 1: process columns from input, store into work array. */ /* Note results are scaled up by sqrt(8) compared to a true IDCT; */ /* furthermore, we scale the results by 2**PASS1_BITS. */ - + inptr = coef_block; quantptr = compptr.dct_table; wsptr = workspace; @@ -2962,7 +2962,7 @@ * With typical images and quantization tables, half or more of the * column DCT calculations can be simplified this way. */ - + if (inptr[DCTSIZE*1+inptr_offset] == 0 && inptr[DCTSIZE*2+inptr_offset] == 0 && inptr[DCTSIZE*3+inptr_offset] == 0 && inptr[DCTSIZE*4+inptr_offset] == 0 && inptr[DCTSIZE*5+inptr_offset] == 0 && inptr[DCTSIZE*6+inptr_offset] == 0 && @@ -2970,7 +2970,7 @@ { /* AC terms all zero */ int dcval = ((inptr[DCTSIZE*0+inptr_offset]) * quantptr[DCTSIZE*0+quantptr_offset]) << PASS1_BITS; - + wsptr[DCTSIZE*0+wsptr_offset] = dcval; wsptr[DCTSIZE*1+wsptr_offset] = dcval; wsptr[DCTSIZE*2+wsptr_offset] = dcval; @@ -2979,49 +2979,49 @@ wsptr[DCTSIZE*5+wsptr_offset] = dcval; wsptr[DCTSIZE*6+wsptr_offset] = dcval; wsptr[DCTSIZE*7+wsptr_offset] = dcval; - + inptr_offset++; /* advance pointers to next column */ quantptr_offset++; wsptr_offset++; continue; } - + /* Even part: reverse the even part of the forward DCT. */ /* The rotator is sqrt(2)*c(-6). */ - + z2 = ((inptr[DCTSIZE*2+inptr_offset]) * quantptr[DCTSIZE*2+quantptr_offset]); z3 = ((inptr[DCTSIZE*6+inptr_offset]) * quantptr[DCTSIZE*6+quantptr_offset]); - + z1 = ((z2 + z3) * 4433/*FIX_0_541196100*/); tmp2 = z1 + (z3 * - 15137/*FIX_1_847759065*/); tmp3 = z1 + (z2 * 6270/*FIX_0_765366865*/); - + z2 = ((inptr[DCTSIZE*0+inptr_offset]) * quantptr[DCTSIZE*0+quantptr_offset]); z3 = ((inptr[DCTSIZE*4+inptr_offset]) * quantptr[DCTSIZE*4+quantptr_offset]); tmp0 = (z2 + z3) << CONST_BITS; tmp1 = (z2 - z3) << CONST_BITS; - + tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; - + /* Odd part per figure 8; the matrix is unitary and hence its * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. */ - + tmp0 = ((inptr[DCTSIZE*7+inptr_offset]) * quantptr[DCTSIZE*7+quantptr_offset]); tmp1 = ((inptr[DCTSIZE*5+inptr_offset]) * quantptr[DCTSIZE*5+quantptr_offset]); tmp2 = ((inptr[DCTSIZE*3+inptr_offset]) * quantptr[DCTSIZE*3+quantptr_offset]); tmp3 = ((inptr[DCTSIZE*1+inptr_offset]) * quantptr[DCTSIZE*1+quantptr_offset]); - + z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; z3 = tmp0 + tmp2; z4 = tmp1 + tmp3; z5 = ((z3 + z4) * 9633/*FIX_1_175875602*/); /* sqrt(2) * c3 */ - + tmp0 = (tmp0 * 2446/*FIX_0_298631336*/); /* sqrt(2) * (-c1+c3+c5-c7) */ tmp1 = (tmp1 * 16819/*FIX_2_053119869*/); /* sqrt(2) * ( c1+c3-c5+c7) */ tmp2 = (tmp2 * 25172/*FIX_3_072711026*/); /* sqrt(2) * ( c1+c3+c5-c7) */ @@ -3030,17 +3030,17 @@ z2 = (z2 * - 20995/*FIX_2_562915447*/); /* sqrt(2) * (-c1-c3) */ z3 = (z3 * - 16069/*FIX_1_961570560*/); /* sqrt(2) * (-c3-c5) */ z4 = (z4 * - 3196/*FIX_0_390180644*/); /* sqrt(2) * (c5-c3) */ - + z3 += z5; z4 += z5; - + tmp0 += z1 + z3; tmp1 += z2 + z4; tmp2 += z2 + z3; tmp3 += z1 + z4; - + /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ - + // #define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n) wsptr[DCTSIZE*0+wsptr_offset] = (((tmp10 + tmp3) + (1 << ((CONST_BITS-PASS1_BITS)-1))) >> (CONST_BITS-PASS1_BITS)); wsptr[DCTSIZE*7+wsptr_offset] = (((tmp10 - tmp3) + (1 << ((CONST_BITS-PASS1_BITS)-1))) >> (CONST_BITS-PASS1_BITS)); @@ -3050,13 +3050,13 @@ wsptr[DCTSIZE*5+wsptr_offset] = (((tmp12 - tmp1) + (1 << ((CONST_BITS-PASS1_BITS)-1))) >> (CONST_BITS-PASS1_BITS)); wsptr[DCTSIZE*3+wsptr_offset] = (((tmp13 + tmp0) + (1 << ((CONST_BITS-PASS1_BITS)-1))) >> (CONST_BITS-PASS1_BITS)); wsptr[DCTSIZE*4+wsptr_offset] = (((tmp13 - tmp0) + (1 << ((CONST_BITS-PASS1_BITS)-1))) >> (CONST_BITS-PASS1_BITS)); - + inptr_offset++; /* advance pointers to next column */ quantptr_offset++; wsptr_offset++; } - + /* Pass 2: process rows from work array, store into output array. */ /* Note that we must descale the results by a factor of 8 == 2**3, */ /* and also undo the PASS1_BITS scaling. */ @@ -3074,7 +3074,7 @@ * test takes more time than it's worth. In that case this section * may be commented out. */ - + //#ifndef NO_ZERO_ROW_TEST if (wsptr[1+wsptr_offset] == 0 && wsptr[2+wsptr_offset] == 0 && wsptr[3+wsptr_offset] == 0 && wsptr[4+wsptr_offset] == 0 && wsptr[5+wsptr_offset] == 0 && wsptr[6+wsptr_offset] == 0 && wsptr[7+wsptr_offset] == 0) @@ -3083,7 +3083,7 @@ // #define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n) byte dcval = range_limit[range_limit_offset + ((((wsptr[0+wsptr_offset]) + (1 << ((PASS1_BITS+3)-1))) >> PASS1_BITS+3) & RANGE_MASK)]; - + outptr[0+outptr_offset] = dcval; outptr[1+outptr_offset] = dcval; outptr[2+outptr_offset] = dcval; @@ -3097,40 +3097,40 @@ continue; } //#endif - + /* Even part: reverse the even part of the forward DCT. */ /* The rotator is sqrt(2)*c(-6). */ - + z2 = wsptr[2+wsptr_offset]; z3 = wsptr[6+wsptr_offset]; - + z1 = ((z2 + z3) * 4433/*FIX_0_541196100*/); tmp2 = z1 + (z3 * - 15137/*FIX_1_847759065*/); tmp3 = z1 + (z2 * 6270/*FIX_0_765366865*/); - + tmp0 = (wsptr[0+wsptr_offset] + wsptr[4+wsptr_offset]) << CONST_BITS; tmp1 = (wsptr[0+wsptr_offset] - wsptr[4+wsptr_offset]) << CONST_BITS; - + tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; - + /* Odd part per figure 8; the matrix is unitary and hence its * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. */ - + tmp0 = wsptr[7+wsptr_offset]; tmp1 = wsptr[5+wsptr_offset]; tmp2 = wsptr[3+wsptr_offset]; tmp3 = wsptr[1+wsptr_offset]; - + z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; z3 = tmp0 + tmp2; z4 = tmp1 + tmp3; z5 = ((z3 + z4) * 9633/*FIX_1_175875602*/); /* sqrt(2) * c3 */ - + tmp0 = (tmp0 * 2446/*FIX_0_298631336*/); /* sqrt(2) * (-c1+c3+c5-c7) */ tmp1 = (tmp1 * 16819/*FIX_2_053119869*/); /* sqrt(2) * ( c1+c3-c5+c7) */ tmp2 = (tmp2 * 25172/*FIX_3_072711026*/); /* sqrt(2) * ( c1+c3+c5-c7) */ @@ -3139,17 +3139,17 @@ z2 = (z2 * - 20995/*FIX_2_562915447*/); /* sqrt(2) * (-c1-c3) */ z3 = (z3 * - 16069/*FIX_1_961570560*/); /* sqrt(2) * (-c3-c5) */ z4 = (z4 * - 3196/*FIX_0_390180644*/); /* sqrt(2) * (c5-c3) */ - + z3 += z5; z4 += z5; - + tmp0 += z1 + z3; tmp1 += z2 + z4; tmp2 += z2 + z3; tmp3 += z1 + z4; - + /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ - + // #define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n) outptr[0+outptr_offset] = range_limit[range_limit_offset + ((((tmp10 + tmp3) + (1 << ((CONST_BITS+PASS1_BITS+3)-1))) >> @@ -3490,7 +3490,7 @@ if (! master.using_merged_upsample) cinfo.cconvert.start_pass (cinfo); cinfo.upsample.start_pass (cinfo); - if (cinfo.quantize_colors) + if (cinfo.quantize_colors) cinfo.cquantize.start_pass (cinfo, master.is_dummy_pass); cinfo.post.start_pass (cinfo, (master.is_dummy_pass ? JBUF_SAVE_AND_PASS : JBUF_PASS_THRU)); cinfo.main.start_pass (cinfo, JBUF_PASS_THRU); @@ -3515,10 +3515,10 @@ static boolean jpeg_resync_to_restart (jpeg_decompress_struct cinfo, int desired) { int marker = cinfo.unread_marker; int action = 1; - + /* Always put up a warning. */ // WARNMS2(cinfo, JWRN_MUST_RESYNC, marker, desired); - + /* Outer loop handles repeated decision after scanning forward. */ for (;;) { if (marker < M_SOF0) @@ -3661,7 +3661,7 @@ state.bits_left = bits_left; return true; - + } } @@ -3711,7 +3711,7 @@ // CHECK_BIT_BUFFER(*state, l, return -1); { if (bits_left < (l)) { - if (! jpeg_fill_bit_buffer(state,get_buffer,bits_left,l)) { + if (! jpeg_fill_bit_buffer(state,get_buffer,bits_left,l)) { return -1; } get_buffer = (state).get_buffer; bits_left = (state).bits_left; @@ -3728,7 +3728,7 @@ // CHECK_BIT_BUFFER(*state, 1, return -1); { if (bits_left < (1)) { - if (! jpeg_fill_bit_buffer(state,get_buffer,bits_left,1)) { + if (! jpeg_fill_bit_buffer(state,get_buffer,bits_left,1)) { return -1; } get_buffer = (state).get_buffer; bits_left = (state).bits_left; @@ -4264,7 +4264,7 @@ case DECOMPRESS_SMOOTH_DATA: result = decompress_smooth_data(cinfo, main.buffer, main.buffer_offset); break; - case DECOMPRESS_ONEPASS: + case DECOMPRESS_ONEPASS: result = decompress_onepass(cinfo, main.buffer, main.buffer_offset); break; default: result = 0; @@ -4383,13 +4383,13 @@ if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); length |= cinfo.buffer[cinfo.bytes_offset++] & 0xFF; length -= 2; - + while (length > 16) { if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); index = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; // TRACEMS1(cinfo, 1, JTRC_DHT, index); - + bits[0] = 0; count = 0; for (i = 1; i <= 16; i++) { @@ -4469,7 +4469,7 @@ if (n >= NUM_QUANT_TBLS) error(); // ERREXIT1(cinfo, JERR_DQT_INDEX, n); - + if (cinfo.quant_tbl_ptrs[n] == null) cinfo.quant_tbl_ptrs[n] = new JQUANT_TBL(); quant_ptr = cinfo.quant_tbl_ptrs[n]; @@ -4519,7 +4519,7 @@ length = (cinfo.buffer[cinfo.bytes_offset++] & 0xFF) << 8; if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); length |= cinfo.buffer[cinfo.bytes_offset++] & 0xFF; - + if (length != 4) error(); // ERREXIT(cinfo, JERR_BAD_LENGTH); @@ -4546,7 +4546,7 @@ if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); length |= cinfo.buffer[cinfo.bytes_offset++] & 0xFF; length -= 2; - + while (length > 0) { if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); index = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; @@ -4614,7 +4614,7 @@ cc = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); c = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; - + for (ci = 0; ci < cinfo.num_components; ci++) { compptr = cinfo.comp_info[ci]; if (cc == compptr.component_id) @@ -4628,7 +4628,7 @@ cinfo.cur_comp_info[i] = compptr; compptr.dc_tbl_no = (c >> 4) & 15; compptr.ac_tbl_no = (c ) & 15; - + // TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc, compptr.dc_tbl_no, compptr.ac_tbl_no); } @@ -4679,7 +4679,7 @@ cinfo.image_width = (cinfo.buffer[cinfo.bytes_offset++] & 0xFF) << 8; if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); cinfo.image_width |= cinfo.buffer[cinfo.bytes_offset++] & 0xFF; - + if (cinfo.bytes_offset == cinfo.bytes_in_buffer) fill_input_buffer(cinfo); cinfo.num_components = cinfo.buffer[cinfo.bytes_offset++] & 0xFF; @@ -4706,7 +4706,7 @@ if (cinfo.comp_info == null) /* do only once, even if suspend */ cinfo.comp_info = new jpeg_component_info[cinfo.num_components]; - + for (ci = 0; ci < cinfo.num_components; ci++) { jpeg_component_info compptr = cinfo.comp_info[ci] = new jpeg_component_info(); compptr.component_index = ci; @@ -4766,7 +4766,7 @@ /* Not more than the distance to the end of the image. Need this test * in case the image height is not a multiple of max_v_samp_factor: */ - if (num_rows > upsample.rows_to_go) + if (num_rows > upsample.rows_to_go) num_rows = upsample.rows_to_go; /* And not more than what the client can accept: */ out_rows_avail -= out_row_ctr[0]; @@ -4790,20 +4790,20 @@ in_row_group_ctr[0]++; } } - + static void noop_upsample (jpeg_decompress_struct cinfo, jpeg_component_info compptr, byte[][] input_data, int input_data_offset, byte[][][] output_data_ptr, int[] output_data_offset, int output_data_index) { output_data_ptr[output_data_index] = null; /* safety check */ } - + static void fullsize_upsample (jpeg_decompress_struct cinfo, jpeg_component_info compptr, byte[][] input_data, int input_data_offset, byte[][][] output_data_ptr, int[] output_data_offset, int output_data_index) { output_data_ptr[output_data_index] = input_data; output_data_offset[output_data_index] = input_data_offset; } - + static void h2v1_upsample (jpeg_decompress_struct cinfo, jpeg_component_info compptr, byte[][] input_data, int input_data_offset, byte[][][] output_data_ptr, int[] output_data_offset, int output_data_index) { @@ -4826,7 +4826,7 @@ } } } - + static void h2v2_upsample (jpeg_decompress_struct cinfo, jpeg_component_info compptr, byte[][] input_data, int input_data_offset, byte[][][] output_data_ptr, int[] output_data_offset, int output_data_index) { @@ -4853,7 +4853,7 @@ outrow += 2; } } - + static void h2v1_fancy_upsample (jpeg_decompress_struct cinfo, jpeg_component_info compptr, byte[][] input_data, int input_data_offset, byte[][][] output_data_ptr, int[] output_data_offset, int output_data_index) { @@ -4861,7 +4861,7 @@ byte[] inptr, outptr; int invalue; int colctr; - int inrow; + int inrow; output_data_offset[output_data_index] = 0; for (inrow = 0; inrow < cinfo.max_v_samp_factor; inrow++) { @@ -4886,7 +4886,7 @@ outptr[outptr_offset++] = (byte) invalue; } } - + static void h2v2_fancy_upsample (jpeg_decompress_struct cinfo, jpeg_component_info compptr, byte[][] input_data, int input_data_offset, byte[][][] output_data_ptr, int[] output_data_offset, int output_data_index) { @@ -4907,7 +4907,7 @@ else /* next nearest is row below */ inptr1 = input_data[inrow+1+input_data_offset]; outptr = output_data[outrow++]; - + int inptr0_offset = 0, inptr1_offset = 0, outptr_offset = 0; /* Special case for first column */ @@ -4933,7 +4933,7 @@ inrow++; } } - + static void int_upsample (jpeg_decompress_struct cinfo, jpeg_component_info compptr, byte[][] input_data, int input_data_offset, byte[][][] output_data_ptr, int[] output_data_offset, int output_data_index) { @@ -4946,7 +4946,7 @@ int h_expand, v_expand; int inrow, outrow; output_data_offset[output_data_index] = 0; - + h_expand = upsample.h_expand[compptr.component_index]; v_expand = upsample.v_expand[compptr.component_index]; @@ -5004,7 +5004,7 @@ output_buf_offset++; } } - + static void grayscale_convert (jpeg_decompress_struct cinfo, byte[][][] input_buf, int[] input_buf_offset, int input_row, byte[][] output_buf, int output_buf_offset, int num_rows) @@ -5032,7 +5032,7 @@ } } } - + static void ycc_rgb_convert (jpeg_decompress_struct cinfo, byte[][][] input_buf, int[] input_buf_offset, int input_row, byte[][] output_buf, int output_buf_offset, int num_rows) @@ -5107,13 +5107,13 @@ length |= cinfo.buffer[cinfo.bytes_offset++] & 0xFF; length -= 2; - + // TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo.unread_marker, (int) length); if (length > 0) { skip_input_data (cinfo, length); } - + return true; } @@ -5272,7 +5272,7 @@ static boolean get_soi (jpeg_decompress_struct cinfo) /* Process an SOI marker */ { int i; - + // TRACEMS(cinfo, 1, JTRC_SOI); if (cinfo.marker.saw_SOI) @@ -5543,7 +5543,7 @@ default: error(); } - return 0; + return 0; } static boolean fill_input_buffer(jpeg_decompress_struct cinfo) { @@ -5699,32 +5699,32 @@ return JPEG_SUSPENDED; cinfo.unread_marker = 0; /* processed the marker */ return JPEG_REACHED_SOS; - + case M_EOI: // TRACEMS(cinfo, 1, JTRC_EOI); cinfo.unread_marker = 0; /* processed the marker */ return JPEG_REACHED_EOI; - + case M_DAC: if (! get_dac(cinfo)) return JPEG_SUSPENDED; break; - + case M_DHT: if (! get_dht(cinfo)) return JPEG_SUSPENDED; break; - + case M_DQT: if (! get_dqt(cinfo)) return JPEG_SUSPENDED; break; - + case M_DRI: if (! get_dri(cinfo)) return JPEG_SUSPENDED; break; - + case M_APP0: case M_APP1: case M_APP2: @@ -5744,7 +5744,7 @@ if (! process_APPn(cinfo.unread_marker - M_APP0, cinfo)) return JPEG_SUSPENDED; break; - + case M_COM: if (! process_COM(cinfo)) return JPEG_SUSPENDED; @@ -5865,16 +5865,16 @@ { int ci, mcublks, tmp = 0; jpeg_component_info compptr; - + if (cinfo.comps_in_scan == 1) { - + /* Noninterleaved (single-component) scan */ compptr = cinfo.cur_comp_info[0]; - + /* Overall image size in MCUs */ cinfo.MCUs_per_row = compptr.width_in_blocks; cinfo.MCU_rows_in_scan = compptr.height_in_blocks; - + /* For noninterleaved scan, always one block per MCU */ compptr.MCU_width = 1; compptr.MCU_height = 1; @@ -5887,24 +5887,24 @@ tmp = (compptr.height_in_blocks % compptr.v_samp_factor); if (tmp == 0) tmp = compptr.v_samp_factor; compptr.last_row_height = tmp; - + /* Prepare array describing MCU composition */ cinfo.blocks_in_MCU = 1; cinfo.MCU_membership[0] = 0; - + } else { - + /* Interleaved (multi-component) scan */ if (cinfo.comps_in_scan <= 0 || cinfo.comps_in_scan > MAX_COMPS_IN_SCAN) error(); // ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo.comps_in_scan, MAX_COMPS_IN_SCAN); - + /* Overall image size in MCUs */ cinfo.MCUs_per_row = (int)jdiv_round_up( cinfo.image_width, (cinfo.max_h_samp_factor*DCTSIZE)); cinfo.MCU_rows_in_scan = (int)jdiv_round_up( cinfo.image_height, (cinfo.max_v_samp_factor*DCTSIZE)); - + cinfo.blocks_in_MCU = 0; - + for (ci = 0; ci < cinfo.comps_in_scan; ci++) { compptr = cinfo.cur_comp_info[ci]; /* Sampling factors give # of blocks of component in each MCU */ @@ -5928,7 +5928,7 @@ cinfo.MCU_membership[cinfo.blocks_in_MCU++] = ci; } } - + } } @@ -5978,7 +5978,7 @@ /* Allocate a workspace if we haven't already done so. */ dtbl.pub = htbl; /* fill in back link */ - + /* Figure C.1: make table of Huffman code length for each symbol */ p = 0; @@ -5992,10 +5992,10 @@ } huffsize[p] = 0; numsymbols = p; - + /* Figure C.2: generate the codes themselves */ /* We also validate that the counts represent a legal Huffman code tree. */ - + code = 0; si = huffsize[0]; p = 0; @@ -6139,7 +6139,7 @@ cinfo.jpeg_color_space = JCS_GRAYSCALE; cinfo.out_color_space = JCS_GRAYSCALE; break; - + case 3: if (cinfo.saw_JFIF_marker) { cinfo.jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */ @@ -6151,7 +6151,7 @@ case 1: cinfo.jpeg_color_space = JCS_YCbCr; break; - default: + default: // WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo.Adobe_transform); cinfo.jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */ break; @@ -6161,7 +6161,7 @@ int cid0 = cinfo.comp_info[0].component_id; int cid1 = cinfo.comp_info[1].component_id; int cid2 = cinfo.comp_info[2].component_id; - + if (cid0 == 1 && cid1 == 2 && cid2 == 3) cinfo.jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */ else if (cid0 == 82 && cid1 == 71 && cid2 == 66) @@ -6174,7 +6174,7 @@ /* Always guess RGB is proper output colorspace. */ cinfo.out_color_space = JCS_RGB; break; - + case 4: if (cinfo.saw_Adobe_marker) { switch (cinfo.Adobe_transform) { @@ -6195,7 +6195,7 @@ } cinfo.out_color_space = JCS_CMYK; break; - + default: cinfo.jpeg_color_space = JCS_UNKNOWN; cinfo.out_color_space = JCS_UNKNOWN; @@ -6305,7 +6305,7 @@ return false; } } - + static ImageData[] loadFromByteStream(InputStream inputStream, ImageLoader loader) { jpeg_decompress_struct cinfo = new jpeg_decompress_struct(); cinfo.inputStream = inputStream; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGEndOfImage.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGEndOfImage.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGEndOfImage.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGEndOfImage.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,16 +16,16 @@ public JPEGEndOfImage() { super(); } - + public JPEGEndOfImage(byte[] reference) { super(reference); } - + @Override public int signature() { return JPEGFileFormat.EOI; } - + @Override public int fixedSize() { return 2; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGFileFormat.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGFileFormat.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGFileFormat.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGFileFormat.java 2016-07-06 19:11:33.000000000 +0000 @@ -4,7 +4,7 @@ * 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 - * + * * This source file is based in part on the work of the Independent JPEG Group (IJG) * and is made available under the terms contained in the about_files/IJG_README * file accompanying this program. @@ -133,11 +133,11 @@ new RGB(0xFF,0xFF,0xFF), }; public static final int[] ExtendTest = { - 0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, + 0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144 }; public static final int[] ExtendOffset = new int[] { - 0, -1, -3, -7, -15, -31, -63, -127, -255, -511, -1023, -2047, + 0, -1, -3, -7, -15, -31, -63, -127, -255, -511, -1023, -2047, -4095, -8191, -16383, -32767, -65535, -131071, -262143 }; public static final int[] ZigZag8x8 = { @@ -427,7 +427,7 @@ int g = pixel & greenMask; g = (greenShift < 0) ? g >>> -greenShift : g << greenShift; int b = pixel & blueMask; - b = (blueShift < 0) ? b >>> -blueShift : b << blueShift; + b = (blueShift < 0) ? b >>> -blueShift : b << blueShift; dataYComp[dstDataIndex] = (byte)((RYTable[r] + GYTable[g] + BYTable[b]) >> 16); dataCbComp[dstDataIndex] = (byte)((RCbTable[r] + GCbTable[g] + BCbTable[b]) >> 16); dataCrComp[dstDataIndex] = (byte)((RCrTable[r] + GCrTable[g] + BCrTable[b]) >> 16); @@ -488,13 +488,13 @@ * B = Y + 1.77200 * Cb * where Cb and Cr represent the incoming values less MAXJSAMPLE/2. * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.) - * + * * To avoid floating-point arithmetic, we represent the fractional constants * as integers scaled up by 2^16 (about 4 digits precision); we have to divide * the products by 2^16, with appropriate rounding, to get the correct answer. * Notice that Y, being an integral input, does not contribute any fraction * so it need not participate in the rounding. - * + * * For even more speed, we avoid doing any multiplications in the inner loop * by precalculating the constants times Cb and Cr for all possible values. * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table); @@ -825,7 +825,7 @@ SWT.error(SWT.ERROR_INVALID_IMAGE); } int[] power2m1 = new int[] { - 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, + 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131125 }; int code = (huffCode & power2m1[nBits - 1]) << (24 - nBits - currentBitCount); @@ -1006,7 +1006,7 @@ int tmp4 = dataUnit[rIndex + 3] - dataUnit[rIndex + 4]; /** - * Even part per LL&M figure 1 --- note that published figure + * Even part per LL&M figure 1 --- note that published figure * is faulty; rotator 'sqrt(2)*c1' should be 'sqrt(2)*c6'. */ int tmp10 = tmp0 + tmp3; @@ -1086,7 +1086,7 @@ int tmp4 = dataUnit[c3] - dataUnit[c4]; /** - * Even part per LL&M figure 1 --- note that published figure + * Even part per LL&M figure 1 --- note that published figure * is faulty; rotator 'sqrt(2)*c1' should be 'sqrt(2)*c6'. */ int tmp10 = tmp0 + tmp3; @@ -1249,7 +1249,7 @@ z3 = tmp0 + tmp2; int z4 = tmp1 + tmp3; int z5 = (z3 + z4) * FIX_1_175875602; /* sqrt(2) * c3 */ - + tmp0 *= FIX_0_298631336; /* sqrt(2) * (-c1+c3+c5-c7) */ tmp1 *= FIX_2_053119869; /* sqrt(2) * ( c1+c3-c5+c7) */ tmp2 *= FIX_3_072711026; /* sqrt(2) * ( c1+c3+c5-c7) */ @@ -1331,7 +1331,7 @@ z3 = tmp0 + tmp2; z4 = tmp1 + tmp3; z0 = (z3 + z4) * FIX_1_175875602; /* sqrt(2) * c3 */ - + tmp0 *= FIX_0_298631336; /* sqrt(2) * (-c1+c3+c5-c7) */ tmp1 *= FIX_2_053119869; /* sqrt(2) * ( c1+c3-c5+c7) */ tmp2 *= FIX_3_072711026; /* sqrt(2) * ( c1+c3+c5-c7) */ @@ -1340,10 +1340,10 @@ z2 *= 0 - FIX_2_562915447; /* sqrt(2) * (-c1-c3) */ z3 *= 0 - FIX_1_961570560; /* sqrt(2) * (-c3-c5) */ z4 *= 0 - FIX_0_390180644; /* sqrt(2) * (c5-c3) */ - + z3 += z0; z4 += z0; - + tmp0 += z1 + z3; tmp1 += z2 + z4; tmp2 += z2 + z3; @@ -1395,7 +1395,7 @@ /* Process the tables preceding the frame header. */ processTables(); - + /* Start of Frame. */ frameHeader = new JPEGFrameHeader(inputStream); if (!frameHeader.verify()) SWT.error(SWT.ERROR_INVALID_IMAGE); @@ -1431,11 +1431,11 @@ /* Process the tables preceding the scan header. */ processTables(); - + /* Start of Scan. */ scanHeader = new JPEGScanHeader(inputStream); if (!scanHeader.verify()) SWT.error(SWT.ERROR_INVALID_IMAGE); - + /* Process scan(s) and further tables until EOI. */ int progressiveScanCount = 0; boolean done = false; @@ -1460,7 +1460,7 @@ SWT.error(SWT.ERROR_IO, e); } } - + /* Process the tables preceding the next scan header. */ JPEGSegment jpegSegment = processTables(); if (jpegSegment == null || jpegSegment.getSegmentMarker() == EOI) { @@ -1470,7 +1470,7 @@ if (!scanHeader.verify()) SWT.error(SWT.ERROR_INVALID_IMAGE); } } - + if (progressive) { for (int ymcu = 0; ymcu < interleavedMcuRows; ymcu++) { for (int xmcu = 0; xmcu < interleavedMcuCols; xmcu++) { @@ -1502,7 +1502,7 @@ ImageData createImageData() { return ImageData.internal_new( imageWidth, - imageHeight, + imageHeight, nComponents * samplePrecision, setUpPalette(), nComponents == 1 ? 4 : 1, @@ -1643,7 +1643,7 @@ break; default: skipSegmentFrom(inputStream); - + } } } @@ -1731,7 +1731,7 @@ try { byte[] byteArray = new byte[4]; JPEGSegment jpegSegment = new JPEGSegment(byteArray); - + if (byteStream.read(byteArray) != byteArray.length) { SWT.error(SWT.ERROR_INVALID_IMAGE); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGFixedSizeSegment.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGFixedSizeSegment.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGFixedSizeSegment.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGFixedSizeSegment.java 2016-07-06 19:11:33.000000000 +0000 @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.swt.internal.image; - + import org.eclipse.swt.*; abstract class JPEGFixedSizeSegment extends JPEGSegment { @@ -19,27 +19,27 @@ reference = new byte[fixedSize()]; setSegmentMarker(signature()); } - + public JPEGFixedSizeSegment(byte[] reference) { super(reference); } - + public JPEGFixedSizeSegment(LEDataInputStream byteStream) { reference = new byte[fixedSize()]; try { byteStream.read(reference); - } catch (Exception e) { + } catch (Exception e) { SWT.error(SWT.ERROR_IO, e); } } - + abstract public int fixedSize(); @Override public int getSegmentLength() { return fixedSize() - 2; } - + @Override public void setSegmentLength(int length) { } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGFrameHeader.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGFrameHeader.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGFrameHeader.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGFrameHeader.java 2016-07-06 19:11:33.000000000 +0000 @@ -22,62 +22,62 @@ public JPEGFrameHeader(byte[] reference) { super(reference); } - + public JPEGFrameHeader(LEDataInputStream byteStream) { super(byteStream); initializeComponentParameters(); } - + public int getSamplePrecision() { return reference[4] & 0xFF; } - + public int getNumberOfLines() { return (reference[5] & 0xFF) << 8 | (reference[6] & 0xFF); } - + public int getSamplesPerLine() { return (reference[7] & 0xFF) << 8 | (reference[8] & 0xFF); } - + public int getNumberOfImageComponents() { return reference[9] & 0xFF; } - + public void setSamplePrecision(int precision) { reference[4] = (byte)(precision & 0xFF); } - + public void setNumberOfLines(int anInteger) { reference[5] = (byte)((anInteger & 0xFF00) >> 8); reference[6] = (byte)(anInteger & 0xFF); } - + public void setSamplesPerLine(int samples) { reference[7] = (byte)((samples & 0xFF00) >> 8); reference[8] = (byte)(samples & 0xFF); } - + public void setNumberOfImageComponents(int anInteger) { reference[9] = (byte)(anInteger & 0xFF); } - + public int getMaxHFactor() { return maxHFactor; } - + public int getMaxVFactor() { return maxVFactor; } - + public void setMaxHFactor(int anInteger) { maxHFactor = anInteger; } - + public void setMaxVFactor(int anInteger) { maxVFactor = anInteger; } - + /* Used when decoding. */ void initializeComponentParameters() { int nf = getNumberOfImageComponents(); @@ -127,7 +127,7 @@ setMaxVFactor(vmax); componentParameters = compSpecParams; } - + /* Used when encoding. */ public void initializeContents() { int nf = getNumberOfImageComponents(); @@ -168,12 +168,12 @@ setMaxHFactor(hmax); setMaxVFactor(vmax); } - + int roundUpToMultiple(int anInteger, int mInteger) { int a = anInteger + mInteger - 1; return a - (a % mInteger); } - + /* * Verify the information contained in the receiver is correct. * Answer true if the header contains a valid marker. Otherwise, @@ -208,7 +208,7 @@ || marker == JPEGFileFormat.SOF10 || marker == JPEGFileFormat.SOF14; } - + public boolean isArithmeticCoding() { return getSegmentMarker() >= JPEGFileFormat.SOF9; } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGHuffmanTable.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGHuffmanTable.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGHuffmanTable.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGHuffmanTable.java 2016-07-06 19:11:33.000000000 +0000 @@ -40,40 +40,40 @@ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; static byte[] ACLuminanceTable = { - (byte)255, (byte)196, 0, (byte)181, 16, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125, - 1, 2, 3, 0, 4, 17, 5, 18, 33, 49, 65, 6, 19, 81, 97, 7, 34, 113, 20, - 50, (byte)129, (byte)145, (byte)161, 8, 35, 66, (byte)177, (byte)193, 21, 82, (byte)209, (byte)240, 36, 51, 98, - 114, (byte)130, 9, 10, 22, 23, 24, 25, 26, 37, 38, 39, 40, 41, 42, 52, 53, - 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, - 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, - 119, 120, 121, 122, (byte)131, (byte)132, (byte)133, (byte)134, (byte)135, (byte)136, (byte)137, (byte)138, (byte)146, (byte)147, (byte)148, - (byte)149, (byte)150, (byte)151, (byte)152, (byte)153, (byte)154, (byte)162, (byte)163, (byte)164, (byte)165, (byte)166, (byte)167, (byte)168, (byte)169, (byte)170, - (byte)178, (byte)179, (byte)180, (byte)181, (byte)182, (byte)183, (byte)184, (byte)185, (byte)186, (byte)194, (byte)195, (byte)196, (byte)197, (byte)198, (byte)199, - (byte)200, (byte)201, (byte)202, (byte)210, (byte)211, (byte)212, (byte)213, (byte)214, (byte)215, (byte)216, (byte)217, (byte)218, (byte)225, (byte)226, (byte)227, - (byte)228, (byte)229, (byte)230, (byte)231, (byte)232, (byte)233, (byte)234, (byte)241, (byte)242, (byte)243, (byte)244, (byte)245, (byte)246, (byte)247, (byte)248, + (byte)255, (byte)196, 0, (byte)181, 16, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125, + 1, 2, 3, 0, 4, 17, 5, 18, 33, 49, 65, 6, 19, 81, 97, 7, 34, 113, 20, + 50, (byte)129, (byte)145, (byte)161, 8, 35, 66, (byte)177, (byte)193, 21, 82, (byte)209, (byte)240, 36, 51, 98, + 114, (byte)130, 9, 10, 22, 23, 24, 25, 26, 37, 38, 39, 40, 41, 42, 52, 53, + 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, + 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, + 119, 120, 121, 122, (byte)131, (byte)132, (byte)133, (byte)134, (byte)135, (byte)136, (byte)137, (byte)138, (byte)146, (byte)147, (byte)148, + (byte)149, (byte)150, (byte)151, (byte)152, (byte)153, (byte)154, (byte)162, (byte)163, (byte)164, (byte)165, (byte)166, (byte)167, (byte)168, (byte)169, (byte)170, + (byte)178, (byte)179, (byte)180, (byte)181, (byte)182, (byte)183, (byte)184, (byte)185, (byte)186, (byte)194, (byte)195, (byte)196, (byte)197, (byte)198, (byte)199, + (byte)200, (byte)201, (byte)202, (byte)210, (byte)211, (byte)212, (byte)213, (byte)214, (byte)215, (byte)216, (byte)217, (byte)218, (byte)225, (byte)226, (byte)227, + (byte)228, (byte)229, (byte)230, (byte)231, (byte)232, (byte)233, (byte)234, (byte)241, (byte)242, (byte)243, (byte)244, (byte)245, (byte)246, (byte)247, (byte)248, (byte)249, (byte)250 }; static byte[] ACChrominanceTable = { - (byte)255, (byte)196, 0, (byte)181, 17, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, - 1, 2, 119, 0, 1, 2, 3, 17, 4, 5, 33, 49, 6, 18, 65, 81, 7, 97, 113, 19, 34, - 50, (byte)129, 8, 20, 66, (byte)145, (byte)161, (byte)177, (byte)193, 9, 35, - 51, 82, (byte)240, 21, 98, 114, (byte)209, 10, 22, 36, 52, (byte)225, 37, - (byte)241, 23, 24, 25, 26, 38, 39, 40, 41, 42, 53, 54, 55, 56, 57, 58, 67, - 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, - 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, (byte)130, - (byte)131, (byte)132, (byte)133, (byte)134, (byte)135, (byte)136, (byte)137, - (byte)138, (byte)146, (byte)147, (byte)148, (byte)149, (byte)150, (byte)151, - (byte)152, (byte)153, (byte)154, (byte)162, (byte)163, (byte)164, (byte)165, - (byte)166, (byte)167, (byte)168, (byte)169, (byte)170, (byte)178, (byte)179, - (byte)180, (byte)181, (byte)182, (byte)183, (byte)184, (byte)185, (byte)186, - (byte)194, (byte)195, (byte)196, (byte)197, (byte)198, (byte)199, (byte)200, - (byte)201, (byte)202, (byte)210, (byte)211, (byte)212, (byte)213, (byte)214, - (byte)215, (byte)216, (byte)217, (byte)218, (byte)226, (byte)227, (byte)228, - (byte)229, (byte)230, (byte)231, (byte)232, (byte)233, (byte)234, (byte)242, - (byte)243, (byte)244, (byte)245, (byte)246, (byte)247, (byte)248, (byte)249, + (byte)255, (byte)196, 0, (byte)181, 17, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, + 1, 2, 119, 0, 1, 2, 3, 17, 4, 5, 33, 49, 6, 18, 65, 81, 7, 97, 113, 19, 34, + 50, (byte)129, 8, 20, 66, (byte)145, (byte)161, (byte)177, (byte)193, 9, 35, + 51, 82, (byte)240, 21, 98, 114, (byte)209, 10, 22, 36, 52, (byte)225, 37, + (byte)241, 23, 24, 25, 26, 38, 39, 40, 41, 42, 53, 54, 55, 56, 57, 58, 67, + 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, + 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, (byte)130, + (byte)131, (byte)132, (byte)133, (byte)134, (byte)135, (byte)136, (byte)137, + (byte)138, (byte)146, (byte)147, (byte)148, (byte)149, (byte)150, (byte)151, + (byte)152, (byte)153, (byte)154, (byte)162, (byte)163, (byte)164, (byte)165, + (byte)166, (byte)167, (byte)168, (byte)169, (byte)170, (byte)178, (byte)179, + (byte)180, (byte)181, (byte)182, (byte)183, (byte)184, (byte)185, (byte)186, + (byte)194, (byte)195, (byte)196, (byte)197, (byte)198, (byte)199, (byte)200, + (byte)201, (byte)202, (byte)210, (byte)211, (byte)212, (byte)213, (byte)214, + (byte)215, (byte)216, (byte)217, (byte)218, (byte)226, (byte)227, (byte)228, + (byte)229, (byte)230, (byte)231, (byte)232, (byte)233, (byte)234, (byte)242, + (byte)243, (byte)244, (byte)245, (byte)246, (byte)247, (byte)248, (byte)249, (byte)250 }; - + public JPEGHuffmanTable(byte[] reference) { super(reference); } @@ -145,7 +145,7 @@ int tc = (reference[ofs] & 0xFF) >> 4; // table class: AC (1) or DC (0) int tid = reference[ofs] & 0xF; // table id: 0-1 baseline, 0-3 prog/ext ofs++; - + /* Read the 16 count bytes and add them together to get the table size. */ int count = 0; for (int i = 0; i < bits.length; i++) { @@ -155,7 +155,7 @@ } ofs += 16; totalLength -= 17; - + /* Read the table. */ int[] huffVals = new int[count]; for (int i = 0; i < count; i++) { @@ -163,7 +163,7 @@ } ofs += count; totalLength -= count; - + /* Calculate the lengths. */ int[] huffCodeLengths = new int[50]; // start with 50 and increment as needed int huffCodeLengthsIndex = 0; @@ -178,14 +178,14 @@ huffCodeLengthsIndex++; } } - + /* Truncate huffCodeLengths to the correct size. */ if (huffCodeLengthsIndex < huffCodeLengths.length) { int[] newHuffCodeLengths = new int[huffCodeLengthsIndex]; System.arraycopy(huffCodeLengths, 0, newHuffCodeLengths, 0, huffCodeLengthsIndex); huffCodeLengths = newHuffCodeLengths; } - + /* Calculate the Huffman codes. */ int[] huffCodes = new int[50]; // start with 50 and increment as needed int huffCodesIndex = 0; @@ -208,14 +208,14 @@ code *= 2; si++; } - + /* Truncate huffCodes to the correct size. */ if (huffCodesIndex < huffCodes.length) { int[] newHuffCodes = new int[huffCodesIndex]; System.arraycopy(huffCodes, 0, newHuffCodes, 0, huffCodesIndex); huffCodes = newHuffCodes; } - + /* Calculate the maximum and minimum codes */ k = 0; int[] maxCodes = new int[16]; @@ -232,7 +232,7 @@ maxCodes[i] = huffCodes[k - 1]; } } - + /* Calculate the eHuffman codes and lengths. */ int[] eHuffCodes = new int[256]; byte[] eHuffSize = new byte[256]; @@ -240,7 +240,7 @@ eHuffCodes[huffVals[i]] = huffCodes[i]; eHuffSize[huffVals[i]] = (byte)huffCodeLengths[i]; } - + /* Create the new JPEGHuffmanTable and add it to the allTables array. */ JPEGHuffmanTable dhtTable = new JPEGHuffmanTable(reference); dhtTable.tableClass = tc; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGQuantizationTable.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGQuantizationTable.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGQuantizationTable.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGQuantizationTable.java 2016-07-06 19:11:33.000000000 +0000 @@ -34,7 +34,7 @@ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }; - + public JPEGQuantizationTable(byte[] reference) { super(reference); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGRestartInterval.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGRestartInterval.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGRestartInterval.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGRestartInterval.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,12 +16,12 @@ public JPEGRestartInterval(LEDataInputStream byteStream) { super(byteStream); } - + @Override public int signature() { return JPEGFileFormat.DRI; } - + public int getRestartInterval() { return ((reference[4] & 0xFF) << 8 | (reference[5] & 0xFF)); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGSegment.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGSegment.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGSegment.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGSegment.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,37 +16,37 @@ JPEGSegment() { } - + public JPEGSegment(byte[] reference) { this.reference = reference; } - + public int signature() { return 0; } - + public boolean verify() { return getSegmentMarker() == signature(); } - + public int getSegmentMarker() { return ((reference[0] & 0xFF) << 8 | (reference[1] & 0xFF)); } - + public void setSegmentMarker(int marker) { reference[0] = (byte)((marker & 0xFF00) >> 8); reference[1] = (byte)(marker & 0xFF); } - + public int getSegmentLength() { return ((reference[2] & 0xFF) << 8 | (reference[3] & 0xFF)); } - + public void setSegmentLength(int length) { reference[2] = (byte)((length & 0xFF00) >> 8); reference[3] = (byte)(length & 0xFF); } - + public boolean writeToStream(LEDataOutputStream byteStream) { try { byteStream.write(reference); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGStartOfImage.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGStartOfImage.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGStartOfImage.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGStartOfImage.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,20 +16,20 @@ public JPEGStartOfImage() { super(); } - + public JPEGStartOfImage(byte[] reference) { super(reference); } - + public JPEGStartOfImage(LEDataInputStream byteStream) { super(byteStream); } - + @Override public int signature() { return JPEGFileFormat.SOI; } - + @Override public int fixedSize() { return 2; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGVariableSizeSegment.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGVariableSizeSegment.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/JPEGVariableSizeSegment.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/JPEGVariableSizeSegment.java 2016-07-06 19:11:33.000000000 +0000 @@ -18,7 +18,7 @@ public JPEGVariableSizeSegment(byte[] reference) { super(reference); } - + public JPEGVariableSizeSegment(LEDataInputStream byteStream) { try { byte[] header = new byte[4]; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/LEDataInputStream.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/LEDataInputStream.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/LEDataInputStream.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/LEDataInputStream.java 2016-07-06 19:11:33.000000000 +0000 @@ -21,28 +21,28 @@ * The byte array containing the bytes to read. */ protected byte[] buf; - + /** * The current position within the byte array <code>buf</code>. A value * equal to buf.length indicates no bytes available. A value of * 0 indicates the buffer is full. */ protected int pos; - + public LEDataInputStream(InputStream input) { this(input, 512); } - + public LEDataInputStream(InputStream input, int bufferSize) { this.in = input; if (bufferSize > 0) { buf = new byte[bufferSize]; pos = bufferSize; - } + } else throw new IllegalArgumentException(); } - + @Override public void close() throws IOException { buf = null; @@ -51,14 +51,14 @@ in = null; } } - + /** * Answer how many bytes were read. */ public int getPosition() { return position; } - + /** * Answers how many bytes are available for reading without blocking */ @@ -67,7 +67,7 @@ if (buf == null) throw new IOException(); return (buf.length - pos) + in.available(); } - + /** * Answer the next byte of the input stream. */ @@ -82,7 +82,7 @@ if (c != -1) position++; return c; } - + /** * Don't imitate the JDK behaviour of reading a random number * of bytes when you can actually read them all. @@ -98,13 +98,13 @@ if (read == 0 && read != len) return -1; return read; } - + /** - * Reads at most <code>length</code> bytes from this LEDataInputStream and + * Reads at most <code>length</code> bytes from this LEDataInputStream and * stores them in byte array <code>buffer</code> starting at <code>offset</code>. * <p> - * Answer the number of bytes actually read or -1 if no bytes were read and - * end of stream was encountered. This implementation reads bytes from + * Answer the number of bytes actually read or -1 if no bytes were read and + * end of stream was encountered. This implementation reads bytes from * the pushback buffer first, then the target stream if more bytes are required * to satisfy <code>count</code>. * </p> @@ -122,10 +122,10 @@ length < 0 || (length > buffer.length - offset)) { throw new ArrayIndexOutOfBoundsException(); } - + int cacheCopied = 0; int newOffset = offset; - + // Are there pushback bytes available? int available = buf.length - pos; if (available > 0) { @@ -134,7 +134,7 @@ newOffset += cacheCopied; pos += cacheCopied; } - + // Have we copied enough? if (cacheCopied == length) return length; @@ -144,7 +144,7 @@ if (cacheCopied == 0) return inCopied; return cacheCopied; } - + /** * Answer an integer comprised of the next * four bytes of the input stream. @@ -152,12 +152,12 @@ public int readInt() throws IOException { byte[] buf = new byte[4]; read(buf); - return ((buf[3] & 0xFF) << 24) | - ((buf[2] & 0xFF) << 16) | - ((buf[1] & 0xFF) << 8) | + return ((buf[3] & 0xFF) << 24) | + ((buf[2] & 0xFF) << 16) | + ((buf[1] & 0xFF) << 8) | (buf[0] & 0xFF); } - + /** * Answer a short comprised of the next * two bytes of the input stream. @@ -167,15 +167,15 @@ read(buf); return (short)(((buf[1] & 0xFF) << 8) | (buf[0] & 0xFF)); } - + /** * Push back the entire content of the given buffer <code>b</code>. * <p> - * The bytes are pushed so that they would be read back b[0], b[1], etc. - * If the push back buffer cannot handle the bytes copied from <code>b</code>, + * The bytes are pushed so that they would be read back b[0], b[1], etc. + * If the push back buffer cannot handle the bytes copied from <code>b</code>, * an IOException will be thrown and no byte will be pushed back. * </p> - * + * * @param b the byte array containing bytes to push back into the stream * * @exception java.io.IOException if the pushback buffer is too small diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/OS2BMPFileFormat.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/OS2BMPFileFormat.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/OS2BMPFileFormat.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/OS2BMPFileFormat.java 2016-07-06 19:11:33.000000000 +0000 @@ -153,7 +153,7 @@ return bytes; } /** - * Unload the given image's data into the given byte stream. + * Unload the given image's data into the given byte stream. * Answer the number of bytes written. */ int unloadData(ImageData image, OutputStream out) { @@ -240,7 +240,7 @@ ByteArrayOutputStream out = new ByteArrayOutputStream(); unloadData(image, out); byte[] data = out.toByteArray(); - + // Calculate file size fileHeader[1] = fileHeader[4] + data.length; @@ -263,7 +263,7 @@ } catch (IOException e) { SWT.error(SWT.ERROR_IO, e); } - + // Unload palette if (numCols > 0) { try { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngChunk.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngChunk.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngChunk.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngChunk.java 2016-07-06 19:11:33.000000000 +0000 @@ -33,13 +33,13 @@ static final int CHUNK_IEND = 3; // Non-critical chunks. static final int CHUNK_tRNS = 5; - + static final byte[] TYPE_IHDR = {(byte) 'I', (byte) 'H', (byte) 'D', (byte) 'R'}; static final byte[] TYPE_PLTE = {(byte) 'P', (byte) 'L', (byte) 'T', (byte) 'E'}; static final byte[] TYPE_IDAT = {(byte) 'I', (byte) 'D', (byte) 'A', (byte) 'T'}; static final byte[] TYPE_IEND = {(byte) 'I', (byte) 'E', (byte) 'N', (byte) 'D'}; static final byte[] TYPE_tRNS = {(byte) 't', (byte) 'R', (byte) 'N', (byte) 'S'}; - + static final int[] CRC_TABLE; static { CRC_TABLE = new int[256]; @@ -52,15 +52,15 @@ CRC_TABLE[i] = 0xEDB88320 ^ ((CRC_TABLE[i] >> 1) & 0x7FFFFFFF); } } - } + } } - + int length; - + /** * Construct a PngChunk using the reference bytes * given. - */ + */ PngChunk(byte[] reference) { super(); setReference(reference); @@ -71,7 +71,7 @@ /** * Construct a PngChunk with the specified number of * data bytes. - */ + */ PngChunk(int dataLength) { this(new byte[MIN_LENGTH + dataLength]); setLength(dataLength); @@ -79,14 +79,14 @@ /** * Get the PngChunk's reference byteArray; - */ + */ byte[] getReference() { return reference; } /** * Set the PngChunk's reference byteArray; - */ + */ void setReference(byte[] reference) { this.reference = reference; } @@ -94,18 +94,18 @@ /** * Get the 16-bit integer from the reference byte * array at the given offset. - */ + */ int getInt16(int offset) { int answer = 0; answer |= (reference[offset] & 0xFF) << 8; answer |= (reference[offset + 1] & 0xFF); - return answer; + return answer; } /** * Set the 16-bit integer in the reference byte * array at the given offset. - */ + */ void setInt16(int offset, int value) { reference[offset] = (byte) ((value >> 8) & 0xFF); reference[offset + 1] = (byte) (value & 0xFF); @@ -114,20 +114,20 @@ /** * Get the 32-bit integer from the reference byte * array at the given offset. - */ + */ int getInt32(int offset) { int answer = 0; answer |= (reference[offset] & 0xFF) << 24; answer |= (reference[offset + 1] & 0xFF) << 16; answer |= (reference[offset + 2] & 0xFF) << 8; answer |= (reference[offset + 3] & 0xFF); - return answer; + return answer; } /** * Set the 32-bit integer in the reference byte * array at the given offset. - */ + */ void setInt32(int offset, int value) { reference[offset] = (byte) ((value >> 24) & 0xFF); reference[offset + 1] = (byte) ((value >> 16) & 0xFF); @@ -138,7 +138,7 @@ /** * Get the length of the data component of this chunk. * This is not the length of the entire chunk. - */ + */ int getLength() { return length; } @@ -146,7 +146,7 @@ /** * Set the length of the data component of this chunk. * This is not the length of the entire chunk. - */ + */ void setLength(int value) { setInt32(LENGTH_OFFSET, value); length = value; @@ -158,14 +158,14 @@ * The first byte is upper case if the chunk is critical. * The second byte is upper case if the chunk is publicly defined. * The third byte must be upper case. - * The fourth byte is upper case if the chunk is unsafe to copy. + * The fourth byte is upper case if the chunk is unsafe to copy. * Public chunk types are defined by the PNG Development Group. - */ + */ byte[] getTypeBytes() { byte[] type = new byte[4]; System.arraycopy(reference, TYPE_OFFSET, type, 0, TYPE_FIELD_LENGTH); return type; -} +} /** * Set the chunk type. This is a four byte value. @@ -173,9 +173,9 @@ * The first byte is upper case if the chunk is critical. * The second byte is upper case if the chunk is publicly defined. * The third byte must be upper case. - * The fourth byte is upper case if the chunk is unsafe to copy. + * The fourth byte is upper case if the chunk is unsafe to copy. * Public chunk types are defined by the PNG Development Group. - */ + */ void setType(byte[] value) { if (value.length != TYPE_FIELD_LENGTH) { SWT.error (SWT.ERROR_INVALID_ARGUMENT); @@ -267,12 +267,12 @@ if (reference[TYPE_OFFSET + i] != array[i]){ return false; } - } + } return true; } boolean isCritical() { - char c = (char) getTypeBytes()[0]; + char c = (char) getTypeBytes()[0]; return 'A' <= c && c <= 'Z'; } @@ -281,7 +281,7 @@ if (typeMatchesArray(TYPE_PLTE)) return CHUNK_PLTE; if (typeMatchesArray(TYPE_IDAT)) return CHUNK_IDAT; if (typeMatchesArray(TYPE_IEND)) return CHUNK_IEND; - if (typeMatchesArray(TYPE_tRNS)) return CHUNK_tRNS; + if (typeMatchesArray(TYPE_tRNS)) return CHUNK_tRNS; return CHUNK_UNKNOWN; } @@ -296,14 +296,14 @@ int result = stream.read(headerBytes, 0, headerLength); stream.unread(headerBytes); if (result != headerLength) return null; - + PngChunk tempChunk = new PngChunk(headerBytes); - + int chunkLength = tempChunk.getSize(); byte[] chunk = new byte[chunkLength]; result = stream.read(chunk, 0, chunkLength); if (result != chunkLength) return null; - + switch (tempChunk.getChunkType()) { case CHUNK_IHDR: return new PngIhdrChunk(chunk); @@ -317,7 +317,7 @@ return new PngTrnsChunk(chunk); default: return new PngChunk(chunk); - } + } } catch (IOException e) { return null; } @@ -328,13 +328,13 @@ */ void validate(PngFileReadState readState, PngIhdrChunk headerChunk) { if (reference.length < MIN_LENGTH) SWT.error(SWT.ERROR_INVALID_IMAGE); - + byte[] type = getTypeBytes(); - + // The third character MUST be upper case. char c = (char) type[2]; if (!('A' <= c && c <= 'Z')) SWT.error(SWT.ERROR_INVALID_IMAGE); - + // All characters must be letters. for (int i = 0; i < TYPE_FIELD_LENGTH; i++) { c = (char) type[i]; @@ -342,7 +342,7 @@ SWT.error(SWT.ERROR_INVALID_IMAGE); } } - + // The stored CRC must match the data's computed CRC. if (!checkCRC()) SWT.error(SWT.ERROR_INVALID_IMAGE); } @@ -370,9 +370,9 @@ for(int i = 0; i < type.length; i++) { buffer.append((char) type[i]); } - + contributeToString(buffer); - + buffer.append("\n\tCRC: "); buffer.append(Integer.toHexString(getCRC())); buffer.append("\n}"); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngChunkReader.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngChunkReader.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngChunkReader.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngChunkReader.java 2016-07-06 19:11:33.000000000 +0000 @@ -18,7 +18,7 @@ PngFileReadState readState; PngIhdrChunk headerChunk; PngPlteChunk paletteChunk; - + PngChunkReader(LEDataInputStream inputStream) { this.inputStream = inputStream; readState = new PngFileReadState(); @@ -27,7 +27,7 @@ PngIhdrChunk getIhdrChunk() { if (headerChunk == null) { - try { + try { PngChunk chunk = PngChunk.readNextFromStream(inputStream); if (chunk == null) SWT.error(SWT.ERROR_INVALID_IMAGE); headerChunk = (PngIhdrChunk) chunk; @@ -41,7 +41,7 @@ PngChunk readNextChunk() { if (headerChunk == null) return getIhdrChunk(); - + PngChunk chunk = PngChunk.readNextFromStream(inputStream); if (chunk == null) SWT.error(SWT.ERROR_INVALID_IMAGE); switch (chunk.getChunkType()) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngDecodingDataStream.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngDecodingDataStream.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngDecodingDataStream.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngDecodingDataStream.java 2016-07-06 19:11:33.000000000 +0000 @@ -19,13 +19,13 @@ InputStream stream; byte currentByte; int nextBitIndex; - + PngLzBlockReader lzBlockReader; int adlerValue; - + static final int PRIME = 65521; - static final int MAX_BIT = 7; - + static final int MAX_BIT = 7; + PngDecodingDataStream(InputStream stream) throws IOException { super(); this.stream = stream; @@ -39,7 +39,7 @@ /** * This method should be called when the image decoder thinks * that all of the compressed image data has been read. This - * method will ensure that the next data value is an end of + * method will ensure that the next data value is an end of * block marker. If there are more blocks after this one, * the method will read them and ensure that they are empty. */ @@ -69,7 +69,7 @@ return (currentByte & (1 << nextBitIndex)) >> nextBitIndex++; } -byte getNextIdatByte() throws IOException { +byte getNextIdatByte() throws IOException { byte nextByte = (byte)stream.read(); nextBitIndex = MAX_BIT + 1; return nextByte; @@ -108,21 +108,21 @@ private void readCompressedDataHeader() throws IOException { byte headerByte1 = getNextIdatByte(); byte headerByte2 = getNextIdatByte(); - + int number = ((headerByte1 & 0xFF) << 8) | (headerByte2 & 0xFF); if (number % 31 != 0) error(); - + int compressionMethod = headerByte1 & 0x0F; if (compressionMethod != 8) error(); - + int windowSizeHint = (headerByte1 & 0xF0) >> 4; if (windowSizeHint > 7) error(); int windowSize = (1 << (windowSizeHint + 8)); lzBlockReader.setWindowSize(windowSize); - + int dictionary = (headerByte2 & (1 << 5)); if (dictionary != 0) error(); - + // int compressionLevel = (headerByte2 & 0xC0) >> 6; } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngDeflater.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngDeflater.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngDeflater.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngDeflater.java 2016-07-06 19:11:33.000000000 +0000 @@ -19,16 +19,16 @@ static final int MIN_LENGTH = 3; static final int MAX_MATCHES = 32; static final int HASH = 8209; - + byte[] in; int inLength; - + ByteArrayOutputStream bytes = new ByteArrayOutputStream(1024); - + int adler32 = 1; - + int buffer, bitCount; - + Link[] hashtable = new Link[HASH]; Link[] window = new Link[WINDOW]; int nextWindow; @@ -37,14 +37,14 @@ int hash, value; Link previous, next; - + Link() { - + this.hash = 0; this.value = 0; this.previous = null; this.next = null; - + } } @@ -52,12 +52,12 @@ static class Match { int length, distance; - + Match(int length, int distance) { - + this.length = length; this.distance = distance; - + } } @@ -102,14 +102,14 @@ static class Code { int code, extraBits, min, max; - + Code(int code, int extraBits, int min, int max) { - + this.code = code; this.extraBits = extraBits; this.min = min; this.max = max; - + } } @@ -251,7 +251,7 @@ void outputLiteral(byte literal) { int i = literal & 0xff; - + if (i <= 143) { // 0 through 143 are 8 bits long starting at 00110000 writeBits(mirrorBytes[0x30 + i], 8); @@ -266,7 +266,7 @@ Code findCode(int value, Code[] codes) { int i, j, k; - + i = -1; j = codes.length; while (true) { @@ -288,13 +288,13 @@ Code d, l; int thisLength; - + while (length > 0) { // we can transmit matches of lengths 3 through 258 inclusive // so if length exceeds 258, we must transmit in several steps, // with 258 or less in each step - + if (length > 260) { thisLength = 258; } @@ -304,12 +304,12 @@ else { thisLength = length - 3; } - + length = length - thisLength; - + // find length code l = findCode(thisLength, lengthCodes); - + // transmit the length code // 256 through 279 are 7 bits long starting at 0000000 // 280 through 287 are 8 bits long starting at 11000000 @@ -319,24 +319,24 @@ else { writeBits(mirrorBytes[0xc0 - 280 + l.code], 8); } - + // transmit the extra bits if (l.extraBits != 0) { writeBits(thisLength - l.min, l.extraBits); } - + // find distance code d = findCode(distance, distanceCodes); - + // transmit the distance code // 5 bits long starting at 00000 writeBits(mirrorBytes[d.code * 8], 5); - + // transmit the extra bits if (d.extraBits != 0) { writeBits(distance - d.min, d.extraBits); } - + } } @@ -346,50 +346,50 @@ Link link = firstPosition; int numberOfMatches = 0; Match bestMatch = new Match(-1, -1); - + while (true) { - + int matchPosition = link.value; - + if (position - matchPosition < WINDOW && matchPosition != 0) { int i; - + for (i = 1; position + i < inLength; i++) { if (in[position + i] != in[matchPosition + i]) { break; } } - + if (i >= MIN_LENGTH) { - + if (i > bestMatch.length) { bestMatch.length = i; bestMatch.distance = position - matchPosition; } - + numberOfMatches = numberOfMatches + 1; - + if (numberOfMatches == MAX_MATCHES) { break; } - + } - + } - + link = link.next; if (link == null) { break; } - + } - + if (bestMatch.length < MIN_LENGTH || bestMatch.distance < 1 || bestMatch.distance > WINDOW) { return null; } - - return bestMatch; + + return bestMatch; } @@ -398,26 +398,26 @@ byte[] data = new byte[3]; int hash; Link temp; - + for (int i = to; i < from; i++) { - + if (i + MIN_LENGTH > inLength) { break; } - + data[0] = in[i]; data[1] = in[i + 1]; data[2] = in[i + 2]; - + hash = hash(data); - + if (window[nextWindow].previous != null) { window[nextWindow].previous.next = null; } else if (window[nextWindow].hash != 0) { hashtable[window[nextWindow].hash].next = null; } - + window[nextWindow].hash = hash; window[nextWindow].value = i; window[nextWindow].previous = null; @@ -426,12 +426,12 @@ if (temp != null) { temp.previous = window[nextWindow]; } - + nextWindow = nextWindow + 1; if (nextWindow == WINDOW) { nextWindow = 0; } - + } } @@ -452,35 +452,35 @@ Match match; int deferredPosition = -1; Match deferredMatch = null; - + writeBits(0x01, 1); // BFINAL = 0x01 (final block) writeBits(0x01, 2); // BTYPE = 0x01 (compression with fixed Huffman codes) - + // just output first byte so we never match at zero outputLiteral(in[0]); position = 1; - + while (position < inLength) { - + if (inLength - position < MIN_LENGTH) { outputLiteral(in[position]); position = position + 1; continue; } - + data[0] = in[position]; data[1] = in[position + 1]; data[2] = in[position + 2]; - + hash = hash(data); firstPosition = hashtable[hash]; - + match = findLongestMatch(position, firstPosition); - + updateHashtable(position, position + 1); - + if (match != null) { - + if (deferredMatch != null) { if (match.length > deferredMatch.length + 1) { // output literal at deferredPosition @@ -506,11 +506,11 @@ deferredMatch = match; position = position + 1; } - + } - + else { - + // no match found if (deferredMatch != null) { outputMatch(deferredMatch.length, deferredMatch.distance); @@ -524,11 +524,11 @@ outputLiteral(in[position]); position = position + 1; } - + } - + } - + writeBits(0, 7); // end of block code alignToByte(); @@ -537,17 +537,17 @@ void compressHuffmanOnly() { int position; - + writeBits(0x01, 1); // BFINAL = 0x01 (final block) writeBits(0x01, 2); // BTYPE = 0x01 (compression with fixed Huffman codes) - + for (position = 0; position < inLength;) { - + outputLiteral(in[position]); position = position + 1; - + } - + writeBits(0, 7); // end of block code alignToByte(); @@ -556,14 +556,14 @@ void store() { // stored blocks are limited to 0xffff bytes - + int start = 0; int length = inLength; int blockLength; int BFINAL = 0x00; // BFINAL = 0x00 or 0x01 (if final block), BTYPE = 0x00 (no compression) - + while (length > 0) { - + if (length < 65535) { blockLength = length; BFINAL = 0x01; @@ -572,18 +572,18 @@ blockLength = 65535; BFINAL = 0x00; } - + // write data header bytes.write((byte) BFINAL); writeShortLSB(bytes, blockLength); // LEN writeShortLSB(bytes, blockLength ^ 0xffff); // NLEN (one's complement of LEN) - + // write actual data bytes.write(in, start, blockLength); - + length = length - blockLength; start = start + blockLength; - + } } @@ -592,25 +592,25 @@ in = input; inLength = input.length; - + // write zlib header bytes.write((byte) 0x78); // window size = 0x70 (32768), compression method = 0x08 bytes.write((byte) 0x9C); // compression level = 0x80 (default), check bits = 0x1C - + // compute checksum for (int i = 0; i < inLength; i++) { updateAdler(in[i]); } - + //store(); - + //compressHuffmanOnly(); - + compress(); - + // write checksum writeInt(bytes, adler32); - + return bytes.toByteArray(); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngEncoder.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngEncoder.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngEncoder.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngEncoder.java 2016-07-06 19:11:33.000000000 +0000 @@ -10,15 +10,11 @@ *******************************************************************************/ package org.eclipse.swt.internal.image; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStream; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.ImageData; -import org.eclipse.swt.graphics.ImageLoader; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.internal.Compatibility; +import java.io.*; +import java.util.zip.*; + +import org.eclipse.swt.*; +import org.eclipse.swt.graphics.*; final class PngEncoder extends Object { @@ -28,38 +24,38 @@ static final byte TAG_TRNS[] = {(byte) 't', (byte) 'R', (byte) 'N', (byte) 'S'}; static final byte TAG_IDAT[] = {(byte) 'I', (byte) 'D', (byte) 'A', (byte) 'T'}; static final byte TAG_IEND[] = {(byte) 'I', (byte) 'E', (byte) 'N', (byte) 'D'}; - + static final int NO_COMPRESSION = 0; static final int BEST_SPEED = 1; static final int BEST_COMPRESSION = 9; static final int DEFAULT_COMPRESSION = -1; - + ByteArrayOutputStream bytes = new ByteArrayOutputStream(1024); PngChunk chunk; - + ImageLoader loader; ImageData data; int transparencyType; - + int width, height, bitDepth, colorType; - + int compressionMethod = 0; int filterMethod = 0; int interlaceMethod = 0; - + public PngEncoder(ImageLoader loader) { this.loader = loader; this.data = loader.data[0]; this.transparencyType = data.getTransparencyType(); - + this.width = data.width; this.height = data.height; - + this.bitDepth = 8; - + this.colorType = 2; - + if (data.palette.isDirect) { if (transparencyType == SWT.TRANSPARENCY_ALPHA) { this.colorType = 6; @@ -68,7 +64,7 @@ else { this.colorType = 3; } - + if (!(colorType == 2 || colorType == 3 || colorType == 6)) SWT.error(SWT.ERROR_INVALID_IMAGE); } @@ -96,9 +92,9 @@ void writeChunk(byte[] tag, byte[] buffer) { int bufferLength = (buffer != null) ? buffer.length : 0; - + chunk = new PngChunk(bufferLength); - + writeInt(bytes, bufferLength); bytes.write(tag, 0, 4); chunk.setType(tag); @@ -122,7 +118,7 @@ void writeHeader() { ByteArrayOutputStream baos = new ByteArrayOutputStream(13); - + writeInt(baos, width); writeInt(baos, height); baos.write(bitDepth); @@ -130,7 +126,7 @@ baos.write(compressionMethod); baos.write(filterMethod); baos.write(interlaceMethod); - + writeChunk(TAG_IHDR, baos.toByteArray()); } @@ -138,19 +134,19 @@ void writePalette() { RGB[] RGBs = data.palette.getRGBs(); - + if (RGBs.length > 256) SWT.error(SWT.ERROR_INVALID_IMAGE); - + ByteArrayOutputStream baos = new ByteArrayOutputStream(RGBs.length); - + for (int i = 0; i < RGBs.length; i++) { - + baos.write((byte) RGBs[i].red); baos.write((byte) RGBs[i].green); baos.write((byte) RGBs[i].blue); - + } - + writeChunk(TAG_PLTE, baos.toByteArray()); } @@ -158,78 +154,78 @@ void writeTransparency() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); - + switch (transparencyType) { - + case SWT.TRANSPARENCY_ALPHA: - + int pixelValue, alphaValue; - + byte[] alphas = new byte[data.palette.getRGBs().length]; - + for (int y = 0; y < height; y++) { - + for (int x = 0; x < width; x++) { - + pixelValue = data.getPixel(x, y); alphaValue = data.getAlpha(x, y); - + alphas[pixelValue] = (byte) alphaValue; - + } - + } - + baos.write(alphas, 0, alphas.length); - + break; - + case SWT.TRANSPARENCY_PIXEL: - + int pixel = data.transparentPixel; - + if (colorType == 2) { - + int redMask = data.palette.redMask; int redShift = data.palette.redShift; int greenMask = data.palette.greenMask; int greenShift = data.palette.greenShift; int blueShift = data.palette.blueShift; int blueMask = data.palette.blueMask; - + int r = pixel & redMask; r = (redShift < 0) ? r >>> -redShift : r << redShift; int g = pixel & greenMask; g = (greenShift < 0) ? g >>> -greenShift : g << greenShift; int b = pixel & blueMask; b = (blueShift < 0) ? b >>> -blueShift : b << blueShift; - + writeShort(baos, r); writeShort(baos, g); writeShort(baos, b); - + } - + if (colorType == 3) { - + byte[] padding = new byte[pixel + 1]; - + for (int i = 0; i < pixel; i++) { - + padding[i] = (byte) 255; - + } - + padding[pixel] = (byte) 0; - + baos.write(padding, 0, padding.length); - + } - + break; - + } - + writeChunk(TAG_TRNS, baos.toByteArray()); } @@ -240,70 +236,69 @@ OutputStream os = null; switch (loader.compression) { case 0: - os = Compatibility.newDeflaterOutputStream(baos, NO_COMPRESSION); + os = new DeflaterOutputStream(baos, new Deflater(NO_COMPRESSION)); break; case 1: - os = Compatibility.newDeflaterOutputStream(baos, BEST_SPEED); + os = new DeflaterOutputStream(baos, new Deflater(BEST_SPEED)); break; case 3: - os = Compatibility.newDeflaterOutputStream(baos, BEST_COMPRESSION); + os = new DeflaterOutputStream(baos, new Deflater(BEST_COMPRESSION)); break; default: - os = Compatibility.newDeflaterOutputStream(baos, DEFAULT_COMPRESSION); + os = new DeflaterOutputStream(baos, new Deflater(DEFAULT_COMPRESSION)); break; } - if (os == null) os = baos; // returns null for J2ME - + if (colorType == 3) { - + byte[] lineData = new byte[width]; - + for (int y = 0; y < height; y++) { - + int filter = 0; os.write(filter); - + data.getPixels(0, y, width, lineData, 0); - + os.write(lineData); - + } - + } - + else { - + int[] lineData = new int[width]; byte[] alphaData = null; if (colorType == 6) { alphaData = new byte[width]; } - + int redMask = data.palette.redMask; int redShift = data.palette.redShift; int greenMask = data.palette.greenMask; int greenShift = data.palette.greenShift; int blueShift = data.palette.blueShift; int blueMask = data.palette.blueMask; - + byte[] lineBytes = new byte[width * (colorType == 6 ? 4 : 3)]; - + for (int y = 0; y < height; y++) { - + int filter = 0; os.write(filter); - + data.getPixels(0, y, width, lineData, 0); - + if (colorType == 6) { data.getAlphas(0, y, width, alphaData, 0); } - + int offset = 0; for (int x = 0; x < lineData.length; x++) { - + int pixel = lineData[x]; - + int r = pixel & redMask; lineBytes[offset++] = (byte) ((redShift < 0) ? r >>> -redShift : r << redShift); @@ -313,29 +308,29 @@ int b = pixel & blueMask; lineBytes[offset++] = (byte) ((blueShift < 0) ? b >>> -blueShift : b << blueShift); - + if (colorType == 6) { lineBytes[offset++] = alphaData[x]; } - + } - + os.write(lineBytes); - + } - + } - + os.flush(); os.close(); - + byte[] compressed = baos.toByteArray(); if (os == baos) { /* Use PngDeflater for J2ME. */ PngDeflater deflater = new PngDeflater(); compressed = deflater.deflate(compressed); } - + writeChunk(TAG_IDAT, compressed); } @@ -349,34 +344,34 @@ public void encode(LEDataOutputStream outputStream) { try { - + writeSignature(); writeHeader(); - + if (colorType == 3) { writePalette(); } - + boolean transparencyAlpha = (transparencyType == SWT.TRANSPARENCY_ALPHA); boolean transparencyPixel = (transparencyType == SWT.TRANSPARENCY_PIXEL); boolean type2Transparency = (colorType == 2 && transparencyPixel); boolean type3Transparency = (colorType == 3 && (transparencyAlpha || transparencyPixel)); - + if (type2Transparency || type3Transparency) { writeTransparency(); } - + writeImageData(); writeEnd(); - + outputStream.write(bytes.toByteArray()); - + } - + catch (IOException e) { - + SWT.error(SWT.ERROR_IO, e); - + } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PNGFileFormat.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PNGFileFormat.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PNGFileFormat.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PNGFileFormat.java 2016-07-06 19:11:33.000000000 +0000 @@ -12,9 +12,10 @@ import java.io.*; +import java.util.zip.*; + import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; -import org.eclipse.swt.internal.*; public final class PNGFileFormat extends FileFormat { static final int SIGNATURE_LENGTH = 8; @@ -30,7 +31,7 @@ /** * Skip over signature data. This has already been - * verified in isFileFormat(). + * verified in isFileFormat(). */ void readSignature() throws IOException { byte[] signature = new byte[SIGNATURE_LENGTH]; @@ -48,7 +49,7 @@ int width = headerChunk.getWidth(), height = headerChunk.getHeight(); if (width <= 0 || height <= 0) SWT.error(SWT.ERROR_INVALID_IMAGE); int imageSize = getAlignedBytesPerRow() * height; - data = new byte[imageSize]; + data = new byte[imageSize]; imageData = ImageData.internal_new( width, height, @@ -65,17 +66,17 @@ 0, 0, 0, - 0); - + 0); + if (headerChunk.usesDirectColor()) { imageData.palette = headerChunk.getPaletteData(); } - + // Read and process chunks until the IEND chunk is encountered. while (chunkReader.hasMoreChunks()) { readNextChunk(chunkReader); } - + return new ImageData[] {imageData}; } catch (IOException e) { SWT.error(SWT.ERROR_INVALID_IMAGE); @@ -83,7 +84,7 @@ } } /** - * Read and handle the next chunk of data from the + * Read and handle the next chunk of data from the * PNG file. */ void readNextChunk(PngChunkReader chunkReader) throws IOException { @@ -94,15 +95,15 @@ case PngChunk.CHUNK_PLTE: if (!headerChunk.usesDirectColor()) { paletteChunk = (PngPlteChunk) chunk; - imageData.palette = paletteChunk.getPaletteData(); - } + imageData.palette = paletteChunk.getPaletteData(); + } break; case PngChunk.CHUNK_tRNS: PngTrnsChunk trnsChunk = (PngTrnsChunk) chunk; - if (trnsChunk.getTransparencyType(headerChunk) == - PngTrnsChunk.TRANSPARENCY_TYPE_PIXEL) + if (trnsChunk.getTransparencyType(headerChunk) == + PngTrnsChunk.TRANSPARENCY_TYPE_PIXEL) { - imageData.transparentPixel = + imageData.transparentPixel = trnsChunk.getSwtTransparentPixel(headerChunk); } else { alphaPalette = trnsChunk.getAlphaValues(headerChunk, paletteChunk); @@ -130,9 +131,9 @@ SWT.error(SWT.ERROR_INVALID_IMAGE); } else { // Read in the pixel data for the image. This should - // go through all the image's IDAT chunks. + // go through all the image's IDAT chunks. PngIdatChunk dataChunk = (PngIdatChunk) chunk; - readPixelData(dataChunk, chunkReader); + readPixelData(dataChunk, chunkReader); } break; default: @@ -160,7 +161,7 @@ if ((signature[4] & 0xFF) != 13) return false; //<RETURN> if ((signature[5] & 0xFF) != 10) return false; //<LINEFEED> if ((signature[6] & 0xFF) != 26) return false; //<CTRL/Z> - if ((signature[7] & 0xFF) != 10) return false; //<LINEFEED> + if ((signature[7] & 0xFF) != 10) return false; //<LINEFEED> return true; } catch (Exception e) { return false; @@ -254,7 +255,7 @@ imageData.data = rgbData; imageData.alphaData = alphaData; break; - } + } case PngIhdrChunk.COLOR_TYPE_PALETTE: imageData.data = data; if (alphaPalette != null) { @@ -289,7 +290,7 @@ } } /** - * PNG supports some color types and bit depths that are + * PNG supports some color types and bit depths that are * unsupported by SWT. If the image uses an unsupported * color type (either of the gray scale types) or bit * depth (16), convert the data to an SWT-supported @@ -303,11 +304,12 @@ * Read the image data from the data stream. This must handle * decoding the data, filtering, and interlacing. */ +@SuppressWarnings("resource") void readPixelData(PngIdatChunk chunk, PngChunkReader chunkReader) throws IOException { InputStream stream = new PngInputStream(chunk, chunkReader); //TEMPORARY CODE boolean use3_2 = System.getProperty("org.eclipse.swt.internal.image.PNGFileFormat_3.2") != null; - InputStream inflaterStream = use3_2 ? null : Compatibility.newInflaterInputStream(stream); + InputStream inflaterStream = use3_2 ? null : new BufferedInputStream(new InflaterInputStream(stream)); if (inflaterStream != null) { stream = inflaterStream; } else { @@ -345,13 +347,13 @@ /** * Answer the number of bytes needed to represent a pixel. * This value depends on the image's color type and bit - * depth. + * depth. * Note that this method rounds up if an image's pixel size * isn't byte-aligned. */ int getBytesPerPixel() { int bitsPerPixel = headerChunk.getBitsPerPixel(); - return (bitsPerPixel + 7) / 8; + return (bitsPerPixel + 7) / 8; } /** * Answer the number of bytes in a row of the given pixel @@ -376,19 +378,19 @@ int columnInterval, int startRow, int startColumn, - int frameCount) throws IOException + int frameCount) throws IOException { int width = headerChunk.getWidth(); int alignedBytesPerRow = getAlignedBytesPerRow(); int height = headerChunk.getHeight(); if (startRow >= height || startColumn >= width) return; - + int pixelsPerRow = (width - startColumn + columnInterval - 1) / columnInterval; int bytesPerRow = getBytesPerRow(pixelsPerRow); byte[] row1 = new byte[bytesPerRow]; byte[] row2 = new byte[bytesPerRow]; - byte[] currentRow = row1; - byte[] lastRow = row2; + byte[] currentRow = row1; + byte[] lastRow = row2; for (int row = startRow; row < height; row += rowInterval) { byte filterType = (byte)inputStream.read(); int read = 0; @@ -419,7 +421,7 @@ for (int byteOffset = 0; byteOffset < currentRow.length; byteOffset++) { for (int bitOffset = maxShift; bitOffset >= 0; bitOffset -= bitsPerPixel) { if (column < width) { - int dataOffset = rowBase + (column * bitsPerPixel / 8); + int dataOffset = rowBase + (column * bitsPerPixel / 8); int value = (currentRow[byteOffset] >> bitOffset) & valueMask; int dataShift = maxShift - (bitsPerPixel * (column % pixelsPerByte)); data[dataOffset] |= value << dataShift; @@ -440,11 +442,11 @@ */ void readInterlacedImage(InputStream inputStream) throws IOException { readInterlaceFrame(inputStream, 8, 8, 0, 0, 0); - readInterlaceFrame(inputStream, 8, 8, 0, 4, 1); - readInterlaceFrame(inputStream, 8, 4, 4, 0, 2); + readInterlaceFrame(inputStream, 8, 8, 0, 4, 1); + readInterlaceFrame(inputStream, 8, 4, 4, 0, 2); readInterlaceFrame(inputStream, 4, 4, 0, 2, 3); readInterlaceFrame(inputStream, 4, 2, 2, 0, 4); - readInterlaceFrame(inputStream, 2, 2, 0, 1, 5); + readInterlaceFrame(inputStream, 2, 2, 0, 1, 5); readInterlaceFrame(inputStream, 2, 1, 1, 0, 6); } /** @@ -471,7 +473,7 @@ int bytesPerRow = getBytesPerRow(); byte[] row1 = new byte[bytesPerRow]; byte[] row2 = new byte[bytesPerRow]; - byte[] currentRow = row1; + byte[] currentRow = row1; byte[] lastRow = row2; int height = headerChunk.getHeight(); for (int row = 0; row < height; row++) { @@ -500,9 +502,9 @@ static void compress16BitDepthTo8BitDepth( byte[] source, int sourceOffset, - byte[] destination, + byte[] destination, int destinationOffset, - int numberOfValues) + int numberOfValues) { //double multiplier = (Compatibility.pow2(8) - 1) / (Compatibility.pow2(16) - 1); for (int i = 0; i < numberOfValues; i++) { @@ -548,7 +550,7 @@ case PngIhdrChunk.FILTER_UP: for (int i = 0; i < row.length; i++) { int current = row[i] & 0xFF; - int above = previousRow[i] & 0xFF; + int above = previousRow[i] & 0xFF; row[i] = (byte)((current + above) & 0xFF); } break; @@ -565,11 +567,11 @@ int left = (i < byteOffset) ? 0 : row[i - byteOffset] & 0xFF; int aboveLeft = (i < byteOffset) ? 0 : previousRow[i - byteOffset] & 0xFF; int above = previousRow[i] & 0xFF; - + int a = Math.abs(above - aboveLeft); int b = Math.abs(left - aboveLeft); int c = Math.abs(left - aboveLeft + above - aboveLeft); - + int preductor = 0; if (a <= b && a <= c) { preductor = left; @@ -578,7 +580,7 @@ } else { preductor = aboveLeft; } - + int currentValue = row[i] & 0xFF; row[i] = (byte) ((currentValue + preductor) & 0xFF); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngFileReadState.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngFileReadState.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngFileReadState.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngFileReadState.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,10 +16,10 @@ boolean readPLTE; boolean readIDAT; boolean readIEND; - + // Non - critical chunks boolean readTRNS; - + // Set to true after IDATs have been read. boolean readPixelData; } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngHuffmanTable.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngHuffmanTable.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngHuffmanTable.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngHuffmanTable.java 2016-07-06 19:11:33.000000000 +0000 @@ -15,7 +15,7 @@ public class PngHuffmanTable { CodeLengthInfo[] codeLengthInfo; int[] codeValues; - + static final int MAX_CODE_LENGTH = 15; static final int BAD_CODE = 0xFFFFFFF; static final int incs[] = {1391376, 463792, 198768, 86961, 33936, 13776, 4592, 1968, 861, 336, 112, 48, 21, 7, 3, 1}; @@ -31,7 +31,7 @@ for (int i = 0; i < codeValues.length; i++) { codeValues[i] = i; } - + // minCodesByLength[n] : The smallest Huffman code of length n + 1. // maxCodesByLength[n] : The largest Huffman code of length n + 1. // indexesByLength[n] : Index into the values array. First value with a code of length n + 1. @@ -44,7 +44,7 @@ codeLengthInfo[i].max = -1; } } - + private void generateTable(int[] lengths) { // Sort the values using shellsort. Primary key is code size. Secondary key is value. int codeValuesTemp; @@ -79,7 +79,7 @@ code++; } } - + int last = 0; for (int i = 0; i < lengths.length; i++) { if (last != lengths[i]) { @@ -113,8 +113,8 @@ // so now we can look up the value for the Huffman code in the table. int index = codeLengthInfo[codelength].baseIndex + offset; return codeValues[index]; -} - +} + static class CodeLengthInfo { int length; int max; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngHuffmanTables.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngHuffmanTables.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngHuffmanTables.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngHuffmanTables.java 2016-07-06 19:11:33.000000000 +0000 @@ -15,10 +15,10 @@ public class PngHuffmanTables { PngHuffmanTable literalTable; PngHuffmanTable distanceTable; - + static PngHuffmanTable FixedLiteralTable; static PngHuffmanTable FixedDistanceTable; - + static final int LiteralTableSize = 288; static final int[] FixedLiteralLengths = { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, @@ -40,13 +40,13 @@ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, }; - + static final int LengthCodeTableSize = 19; static final int[] LengthCodeOrder = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 }; - + static PngHuffmanTables getDynamicTables(PngDecodingDataStream stream) throws IOException { return new PngHuffmanTables(stream); } @@ -74,47 +74,47 @@ } private PngHuffmanTables (PngDecodingDataStream stream) throws IOException { - int literals = PngLzBlockReader.FIRST_LENGTH_CODE + int literals = PngLzBlockReader.FIRST_LENGTH_CODE + stream.getNextIdatBits(5); - int distances = PngLzBlockReader.FIRST_DISTANCE_CODE + int distances = PngLzBlockReader.FIRST_DISTANCE_CODE + stream.getNextIdatBits(5); - int codeLengthCodes = PngLzBlockReader.FIRST_CODE_LENGTH_CODE + int codeLengthCodes = PngLzBlockReader.FIRST_CODE_LENGTH_CODE + stream.getNextIdatBits(4); if (codeLengthCodes > PngLzBlockReader.LAST_CODE_LENGTH_CODE) { stream.error(); } - + /* Tricky, tricky, tricky. The length codes are stored in * a very odd order. (For the order, see the definition of - * the static field lengthCodeOrder.) Also, the data may - * not contain values for all the codes. It may just contain + * the static field lengthCodeOrder.) Also, the data may + * not contain values for all the codes. It may just contain * values for the first X number of codes. The table should * be of size <LengthCodeTableSize> regardless of the number * of values actually given in the table. - */ + */ int[] lengthCodes = new int[LengthCodeTableSize]; for (int i = 0; i < codeLengthCodes; i++) { lengthCodes[LengthCodeOrder[i]] = stream.getNextIdatBits(3); } PngHuffmanTable codeLengthsTable = new PngHuffmanTable(lengthCodes); - + int[] literalLengths = readLengths( stream, literals, codeLengthsTable, LiteralTableSize); int[] distanceLengths = readLengths( stream, distances, codeLengthsTable, DistanceTableSize); - + literalTable = new PngHuffmanTable(literalLengths); distanceTable = new PngHuffmanTable(distanceLengths); } -private int [] readLengths (PngDecodingDataStream stream, - int numLengths, +private int [] readLengths (PngDecodingDataStream stream, + int numLengths, PngHuffmanTable lengthsTable, int tableSize) throws IOException { int[] lengths = new int[tableSize]; - + for (int index = 0; index < numLengths;) { int value = lengthsTable.getNextValue(stream); if (value < 16) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngIdatChunk.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngIdatChunk.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngIdatChunk.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngIdatChunk.java 2016-07-06 19:11:33.000000000 +0000 @@ -30,7 +30,7 @@ setInt32(ADLER_DATA_OFFSET, adler); setCRC(computeCRC()); } - + PngIdatChunk(byte[] reference) { super(reference); } @@ -47,13 +47,13 @@ void validate(PngFileReadState readState, PngIhdrChunk headerChunk) { if (!readState.readIHDR || (headerChunk.getMustHavePalette() && !readState.readPLTE) - || readState.readIEND) + || readState.readIEND) { SWT.error(SWT.ERROR_INVALID_IMAGE); } else { readState.readIDAT = true; } - + super.validate(readState, headerChunk); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngIendChunk.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngIendChunk.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngIendChunk.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngIendChunk.java 2016-07-06 19:11:33.000000000 +0000 @@ -41,15 +41,15 @@ if (!readState.readIHDR || (headerChunk.getMustHavePalette() && !readState.readPLTE) || !readState.readIDAT - || readState.readIEND) + || readState.readIEND) { SWT.error(SWT.ERROR_INVALID_IMAGE); } else { readState.readIEND = true; } - + super.validate(readState, headerChunk); - + // IEND chunks are not allowed to have any data. if (getLength() > 0) SWT.error(SWT.ERROR_INVALID_IMAGE); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngIhdrChunk.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngIhdrChunk.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngIhdrChunk.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngIhdrChunk.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,7 +16,7 @@ class PngIhdrChunk extends PngChunk { static final int IHDR_DATA_LENGTH = 13; - + static final int WIDTH_DATA_OFFSET = DATA_OFFSET + 0; static final int HEIGHT_DATA_OFFSET = DATA_OFFSET + 4; static final int BIT_DEPTH_OFFSET = DATA_OFFSET + 8; @@ -24,28 +24,28 @@ static final int COMPRESSION_METHOD_OFFSET = DATA_OFFSET + 10; static final int FILTER_METHOD_OFFSET = DATA_OFFSET + 11; static final int INTERLACE_METHOD_OFFSET = DATA_OFFSET + 12; - + static final byte COLOR_TYPE_GRAYSCALE = 0; static final byte COLOR_TYPE_RGB = 2; static final byte COLOR_TYPE_PALETTE = 3; static final byte COLOR_TYPE_GRAYSCALE_WITH_ALPHA = 4; static final byte COLOR_TYPE_RGB_WITH_ALPHA = 6; - + static final int INTERLACE_METHOD_NONE = 0; static final int INTERLACE_METHOD_ADAM7 = 1; - + static final int FILTER_NONE = 0; static final int FILTER_SUB = 1; static final int FILTER_UP = 2; static final int FILTER_AVERAGE = 3; static final int FILTER_PAETH = 4; - + static final byte[] ValidBitDepths = {1, 2, 4, 8, 16}; static final byte[] ValidColorTypes = {0, 2, 3, 4, 6}; - + int width, height; byte bitDepth, colorType, compressionMethod, filterMethod, interlaceMethod; - + PngIhdrChunk(int width, int height, byte bitDepth, byte colorType, byte compressionMethod, byte filterMethod, byte interlaceMethod) { super(IHDR_DATA_LENGTH); setType(TYPE_IHDR); @@ -62,7 +62,7 @@ /** * Construct a PNGChunk using the reference bytes * given. - */ + */ PngIhdrChunk(byte[] reference) { super(reference); if (reference.length <= IHDR_DATA_LENGTH) SWT.error(SWT.ERROR_INVALID_IMAGE); @@ -216,25 +216,25 @@ void validate(PngFileReadState readState, PngIhdrChunk headerChunk) { // An IHDR chunk is invalid if any other chunk has // been read. - if (readState.readIHDR + if (readState.readIHDR || readState.readPLTE || readState.readIDAT - || readState.readIEND) + || readState.readIEND) { SWT.error(SWT.ERROR_INVALID_IMAGE); } else { readState.readIHDR = true; } - + super.validate(readState, headerChunk); - + if (length != IHDR_DATA_LENGTH) SWT.error(SWT.ERROR_INVALID_IMAGE); if (compressionMethod != 0) SWT.error(SWT.ERROR_INVALID_IMAGE); if (interlaceMethod != INTERLACE_METHOD_NONE && interlaceMethod != INTERLACE_METHOD_ADAM7) { SWT.error(SWT.ERROR_INVALID_IMAGE); } - + boolean colorTypeIsValid = false; for (int i = 0; i < ValidColorTypes.length; i++) { if (ValidColorTypes[i] == colorType) { @@ -252,15 +252,15 @@ } } if (!bitDepthIsValid) SWT.error(SWT.ERROR_INVALID_IMAGE); - - if ((colorType == COLOR_TYPE_RGB + + if ((colorType == COLOR_TYPE_RGB || colorType == COLOR_TYPE_RGB_WITH_ALPHA || colorType == COLOR_TYPE_GRAYSCALE_WITH_ALPHA) - && bitDepth < 8) + && bitDepth < 8) { SWT.error(SWT.ERROR_INVALID_IMAGE); } - + if (colorType == COLOR_TYPE_PALETTE && bitDepth > 8) { SWT.error(SWT.ERROR_INVALID_IMAGE); } @@ -269,7 +269,7 @@ String getColorTypeString() { switch (colorType) { case COLOR_TYPE_GRAYSCALE: return "Grayscale"; - case COLOR_TYPE_RGB: return "RGB"; + case COLOR_TYPE_RGB: return "RGB"; case COLOR_TYPE_PALETTE: return "Palette"; case COLOR_TYPE_GRAYSCALE_WITH_ALPHA: return "Grayscale with Alpha"; case COLOR_TYPE_RGB_WITH_ALPHA: return "RGB with Alpha"; @@ -319,7 +319,7 @@ } boolean getCanHavePalette() { - return colorType != COLOR_TYPE_GRAYSCALE && + return colorType != COLOR_TYPE_GRAYSCALE && colorType != COLOR_TYPE_GRAYSCALE_WITH_ALPHA; } @@ -385,7 +385,7 @@ int max = (1 << depth) - 1; int delta = 255 / max; int gray = 0; - RGB[] rgbs = new RGB[max + 1]; + RGB[] rgbs = new RGB[max + 1]; for (int i = 0; i <= max; i++) { rgbs[i] = new RGB(gray, gray, gray); gray += delta; @@ -403,7 +403,7 @@ return new PaletteData(0xFF0000, 0xFF00, 0xFF); default: return null; - } + } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngInputStream.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngInputStream.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngInputStream.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngInputStream.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,9 +16,9 @@ PngChunkReader reader; PngChunk chunk; int offset, length; - - final static int DATA_OFFSET = 8; - + + final static int DATA_OFFSET = 8; + public PngInputStream(PngIdatChunk chunk, PngChunkReader reader) { this.chunk = chunk; this.reader = reader; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngLzBlockReader.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngLzBlockReader.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngLzBlockReader.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngLzBlockReader.java 2016-07-06 19:11:33.000000000 +0000 @@ -18,12 +18,12 @@ int uncompressedBytesRemaining; PngDecodingDataStream stream; PngHuffmanTables huffmanTables; - + byte[] window; int windowIndex; int copyIndex; int copyBytesRemaining; - + static final int UNCOMPRESSED = 0; static final int COMPRESSED_FIXED = 1; static final int COMPRESSED_DYNAMIC = 2; @@ -37,11 +37,11 @@ static final int LAST_CODE_LENGTH_CODE = 19; static final int[] lengthBases = { - 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258 - } ; + } ; static final int[] extraLengthBits = { - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, }; static final int[] distanceBases = { @@ -52,7 +52,7 @@ static final int[] extraDistanceBits = { 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, - }; + }; PngLzBlockReader(PngDecodingDataStream stream) { @@ -62,13 +62,13 @@ void setWindowSize(int windowSize) { window = new byte[windowSize]; -} +} void readNextBlockHeader() throws IOException { isLastBlock = stream.getNextIdatBit() != 0; compressionType = (byte) stream.getNextIdatBits(2); - if (compressionType > 2) stream.error(); - + if (compressionType > 2) stream.error(); + if (compressionType == UNCOMPRESSED) { byte b1 = stream.getNextIdatByte(); byte b2 = stream.getNextIdatByte(); @@ -100,17 +100,17 @@ if (compressionType == UNCOMPRESSED) { if (uncompressedBytesRemaining > 0) stream.error(); } else if (copyBytesRemaining > 0 || - (huffmanTables.getNextLiteralValue(stream) != END_OF_COMPRESSED_BLOCK)) + (huffmanTables.getNextLiteralValue(stream) != END_OF_COMPRESSED_BLOCK)) { - stream.error(); + stream.error(); } } void assertCompressedDataAtEnd() throws IOException { - assertBlockAtEnd(); + assertBlockAtEnd(); while (!isLastBlock) { readNextBlockHeader(); assertBlockAtEnd(); - } + } } private byte getNextCompressedByte() throws IOException { @@ -118,21 +118,21 @@ byte value = window[copyIndex]; window[windowIndex] = value; copyBytesRemaining--; - + copyIndex++; - windowIndex++; + windowIndex++; if (copyIndex == window.length) copyIndex = 0; if (windowIndex == window.length) windowIndex = 0; - return value; + return value; } - + int value = huffmanTables.getNextLiteralValue(stream); if (value < END_OF_COMPRESSED_BLOCK) { window[windowIndex] = (byte) value; windowIndex++; if (windowIndex >= window.length) windowIndex = 0; - return (byte) value; + return (byte) value; } else if (value == END_OF_COMPRESSED_BLOCK) { readNextBlockHeader(); return getNextByte(); @@ -142,7 +142,7 @@ if (extraBits > 0) { length += stream.getNextIdatBits(extraBits); } - + value = huffmanTables.getNextDistanceValue(stream); if (value > LAST_DISTANCE_CODE) stream.error(); extraBits = extraDistanceBits[value]; @@ -150,7 +150,7 @@ if (extraBits > 0) { distance += stream.getNextIdatBits(extraBits); } - + copyIndex = windowIndex - distance; if (copyIndex < 0) copyIndex += window.length; @@ -161,5 +161,5 @@ return 0; } } - + } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngPlteChunk.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngPlteChunk.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngPlteChunk.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngPlteChunk.java 2016-07-06 19:11:33.000000000 +0000 @@ -15,7 +15,7 @@ import org.eclipse.swt.graphics.*; class PngPlteChunk extends PngChunk { - + int paletteSize; PngPlteChunk(PaletteData palette) { @@ -24,7 +24,7 @@ setType(TYPE_PLTE); setPaletteData(palette); setCRC(computeCRC()); -} +} PngPlteChunk(byte[] reference){ super(reference); @@ -58,7 +58,7 @@ int red = reference[offset] & 0xFF; int green = reference[offset + 1] & 0xFF; int blue = reference[offset + 2] & 0xFF; - rgbs[i] = new RGB(red, green, blue); + rgbs[i] = new RGB(red, green, blue); } return new PaletteData(rgbs); } @@ -88,31 +88,31 @@ || readState.readPLTE || readState.readTRNS || readState.readIDAT - || readState.readIEND) + || readState.readIEND) { SWT.error(SWT.ERROR_INVALID_IMAGE); } else { readState.readPLTE = true; } - + super.validate(readState, headerChunk); - + // Palettes cannot be included in grayscale images. - // + // // Note: just ignore the palette. // if (!headerChunk.getCanHavePalette()) SWT.error(SWT.ERROR_INVALID_IMAGE); - + // Palette chunks' data fields must be event multiples // of 3. Each 3-byte group represents an RGB value. - if (getLength() % 3 != 0) SWT.error(SWT.ERROR_INVALID_IMAGE); - + if (getLength() % 3 != 0) SWT.error(SWT.ERROR_INVALID_IMAGE); + // Palettes cannot have more entries than 2^bitDepth // where bitDepth is the bit depth of the image given // in the IHDR chunk. if (1 << headerChunk.getBitDepth() < paletteSize) { SWT.error(SWT.ERROR_INVALID_IMAGE); } - + // Palettes cannot have more than 256 entries. if (256 < paletteSize) SWT.error(SWT.ERROR_INVALID_IMAGE); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngTrnsChunk.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngTrnsChunk.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/PngTrnsChunk.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/PngTrnsChunk.java 2016-07-06 19:11:33.000000000 +0000 @@ -18,13 +18,13 @@ static final int TRANSPARENCY_TYPE_PIXEL = 0; static final int TRANSPARENCY_TYPE_ALPHAS = 1; static final int RGB_DATA_LENGTH = 6; - + PngTrnsChunk(RGB rgb) { super(RGB_DATA_LENGTH); setType(TYPE_tRNS); setInt16(DATA_OFFSET, rgb.red); setInt16(DATA_OFFSET + 2, rgb.green); - setInt16(DATA_OFFSET + 4, rgb.blue); + setInt16(DATA_OFFSET + 4, rgb.blue); setCRC(computeCRC()); } @@ -70,15 +70,15 @@ if (!readState.readIHDR || (headerChunk.getMustHavePalette() && !readState.readPLTE) || readState.readIDAT - || readState.readIEND) + || readState.readIEND) { SWT.error(SWT.ERROR_INVALID_IMAGE); } else { readState.readTRNS = true; } - + validateLength(headerChunk, paletteChunk); - + super.validate(readState, headerChunk); } @@ -114,13 +114,13 @@ int green = ((reference[DATA_OFFSET + 2] & 0xFF) << 8) | (reference[DATA_OFFSET + 3] & 0xFF); int blue = ((reference[DATA_OFFSET + 4] & 0xFF) << 8) - | (reference[DATA_OFFSET + 5] & 0xFF); + | (reference[DATA_OFFSET + 5] & 0xFF); if (header.getBitDepth() > 8) { red = PNGFileFormat.compress16BitDepthTo8BitDepth(red); green = PNGFileFormat.compress16BitDepthTo8BitDepth(green); - blue = PNGFileFormat.compress16BitDepthTo8BitDepth(blue); + blue = PNGFileFormat.compress16BitDepthTo8BitDepth(blue); } - return (red << 16) | (green << 8) | blue; + return (red << 16) | (green << 8) | blue; default: SWT.error(SWT.ERROR_INVALID_IMAGE); return -1; @@ -128,7 +128,7 @@ } /** - * Answer an array of Alpha values that correspond to the + * Answer an array of Alpha values that correspond to the * colors in the palette. * This is only valid for the COLOR_TYPE_PALETTE color type. */ @@ -144,7 +144,7 @@ } /** * Any palette entries which do not have a corresponding - * alpha value in the tRNS chunk are spec'd to have an + * alpha value in the tRNS chunk are spec'd to have an * alpha of 255. */ for (int j = i; j < alphas.length; j++) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/TIFFDirectory.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/TIFFDirectory.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/TIFFDirectory.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/TIFFDirectory.java 2016-07-06 19:11:33.000000000 +0000 @@ -21,7 +21,7 @@ boolean isLittleEndian; ImageLoader loader; int depth; - + /* Directory fields */ int subfileType; int imageWidth; @@ -35,13 +35,13 @@ int[] stripByteCounts; int t4Options; int colorMapOffset; - + /* Encoder fields */ ImageData image; LEDataOutputStream out; - + static final int NO_VALUE = -1; - + static final short TAG_NewSubfileType = 254; static final short TAG_SubfileType = 255; static final short TAG_ImageWidth = 256; @@ -64,27 +64,27 @@ static final short TAG_Software = 305; static final short TAG_DateTime = 306; static final short TAG_ColorMap = 320; - + static final int TYPE_BYTE = 1; static final int TYPE_ASCII = 2; static final int TYPE_SHORT = 3; static final int TYPE_LONG = 4; static final int TYPE_RATIONAL = 5; - + static final int FILETYPE_REDUCEDIMAGE = 1; static final int FILETYPE_PAGE = 2; static final int FILETYPE_MASK = 4; static final int OFILETYPE_IMAGE = 1; static final int OFILETYPE_REDUCEDIMAGE = 2; static final int OFILETYPE_PAGE = 3; - + /* Different compression schemes */ static final int COMPRESSION_NONE = 1; static final int COMPRESSION_CCITT_3_1 = 2; static final int COMPRESSION_PACKBITS = 32773; - + static final int IFD_ENTRY_SIZE = 12; - + public TIFFDirectory(TIFFRandomFileAccess file, boolean isLittleEndian, ImageLoader loader) { this.file = file; this.isLittleEndian = isLittleEndian; @@ -104,8 +104,8 @@ if (n >= 0) { /* Copy next n+1 bytes literally */ System.arraycopy(src, ++srcIndex, dest, destIndex, n + 1); - srcIndex += n + 1; - destIndex += n + 1; + srcIndex += n + 1; + destIndex += n + 1; } else if (n >= -127) { /* Copy next byte -n+1 times */ byte value = src[++srcIndex]; @@ -132,14 +132,14 @@ int offset = toInt(buffer, start, TYPE_LONG); switch (type) { case TYPE_SHORT: size = 2; break; - case TYPE_LONG: size = 4; break; + case TYPE_LONG: size = 4; break; case TYPE_RATIONAL: size = 8; break; case TYPE_ASCII: case TYPE_BYTE: size = 1; break; default: SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT); return; } if (values.length * size > 4) { - buffer = new byte[values.length * size]; + buffer = new byte[values.length * size]; file.seek(offset); file.read(buffer); start = 0; @@ -150,7 +150,7 @@ } void decodePixels(ImageData image) throws IOException { - /* Each row is byte aligned */ + /* Each row is byte aligned */ byte[] imageData = new byte[(imageWidth * depth + 7) / 8 * imageLength]; image.data = imageData; int destIndex = 0; @@ -221,7 +221,7 @@ return new PaletteData(rgbs); } -PaletteData getRGBPalette(int bitsR, int bitsG, int bitsB) { +PaletteData getRGBPalette(int bitsR, int bitsG, int bitsB) { int blueMask = 0; for (int i = 0; i < bitsB; i++) { blueMask |= 1 << i; @@ -233,16 +233,16 @@ int redMask = 0; for (int i = bitsB + bitsG; i < bitsB + bitsG + bitsR; i++) { redMask |= 1 << i; - } + } return new PaletteData(redMask, greenMask, blueMask); } int formatStrips(int rowByteSize, int nbrRows, byte[] data, int maxStripByteSize, int offsetPostIFD, int extraBytes, int[][] strips) { - /* - * Calculate the nbr of required strips given the following requirements: + /* + * Calculate the nbr of required strips given the following requirements: * - each strip should, if possible, not be greater than maxStripByteSize * - each strip should contain 1 or more entire rows - * + * * Format the strip fields arrays so that the image data is stored in one * contiguous block. This block is stored after the IFD and after any tag * info described in the IFD. @@ -255,13 +255,13 @@ } else { int nbr = (data.length + maxStripByteSize - 1) / maxStripByteSize; nbrRowsPerStrip = nbrRows / nbr; - n = (nbrRows + nbrRowsPerStrip - 1) / nbrRowsPerStrip; + n = (nbrRows + nbrRowsPerStrip - 1) / nbrRowsPerStrip; } int stripByteSize = rowByteSize * nbrRowsPerStrip; int[] offsets = new int[n]; int[] counts = new int[n]; - /* + /* * Nbr of bytes between the end of the IFD directory and the start of * the image data. Keep space for at least the offsets and counts * data, each field being TYPE_LONG (4 bytes). If other tags require @@ -272,10 +272,10 @@ */ int postIFDData = n == 1 ? 0 : n * 2 * 4; int startOffset = offsetPostIFD + extraBytes + postIFDData; /* offset of image data */ - + int offset = startOffset; for (int i = 0; i < n; i++) { - /* + /* * Store all strips sequentially to allow us * to copy all pixels in one contiguous area. */ @@ -286,17 +286,17 @@ /* The last strip may contain fewer rows */ int mod = data.length % stripByteSize; if (mod != 0) counts[counts.length - 1] = mod; - + strips[0] = offsets; strips[1] = counts; return nbrRowsPerStrip; } int[] formatColorMap(RGB[] rgbs) { - /* + /* * In a TIFF ColorMap, all red come first, followed by * green and blue. All values must be converted from - * 8 bit to 16 bit. + * 8 bit to 16 bit. */ int[] colorMap = new int[rgbs.length * 3]; int offsetGreen = rgbs.length; @@ -435,7 +435,7 @@ samplesPerPixel = 1; stripByteCounts = null; stripOffsets = null; - + byte[] buffer = new byte[2]; file.read(buffer); int numberEntries = toInt(buffer, 0, TYPE_SHORT); @@ -445,7 +445,7 @@ file.read(buffer2); nextIFDOffset[0] = toInt(buffer2, 0, TYPE_LONG); parseEntries(buffer); - + PaletteData palette = null; depth = 0; switch (photometricInterpretation) { @@ -462,7 +462,7 @@ /* SamplesPerPixel 3 is the only value supported */ palette = getRGBPalette(bitsPerSample[0], bitsPerSample[1], bitsPerSample[2]); depth = bitsPerSample[0] + bitsPerSample[1] + bitsPerSample[2]; - break; + break; } case 3: { /* Palette Color image */ @@ -478,7 +478,7 @@ ImageData image = ImageData.internal_new( imageWidth, - imageLength, + imageLength, depth, palette, 1, @@ -499,14 +499,14 @@ int toInt(byte[] buffer, int i, int type) { if (type == TYPE_LONG) { - return isLittleEndian ? + return isLittleEndian ? (buffer[i] & 0xFF) | ((buffer[i + 1] & 0xFF) << 8) | ((buffer[i + 2] & 0xFF) << 16) | ((buffer[i + 3] & 0xFF) << 24) : (buffer[i + 3] & 0xFF) | ((buffer[i + 2] & 0xFF) << 8) | ((buffer[i + 1] & 0xFF) << 16) | ((buffer[i] & 0xFF) << 24); } if (type == TYPE_SHORT) { - return isLittleEndian ? + return isLittleEndian ? (buffer[i] & 0xFF) | ((buffer[i + 1] & 0xFF) << 8) : - (buffer[i + 1] & 0xFF) | ((buffer[i] & 0xFF) << 8); + (buffer[i + 1] & 0xFF) | ((buffer[i] & 0xFF) << 8); } /* Invalid type */ SWT.error(SWT.ERROR_INVALID_IMAGE); @@ -521,7 +521,7 @@ int imageWidth = image.width; int imageLength = image.height; int rowByteSize = image.bytesPerLine; - + int numberEntries = isBiLevel ? 9 : 11; int lengthDirectory = 2 + 12 * numberEntries + 4; /* Offset following the header and the directory */ @@ -531,7 +531,7 @@ int extraBytes = 16; int[] colorMap = null; - if (isColorMap) { + if (isColorMap) { PaletteData palette = image.palette; RGB[] rgbs = palette.getRGBs(); colorMap = formatColorMap(rgbs); @@ -543,7 +543,7 @@ if (isRGB) { /* Extra space used by BitsPerSample values */ extraBytes += 6; - } + } /* TIFF recommends storing the data in strips of no more than 8 Ko */ byte[] data = image.data; int[][] strips = new int[2][]; @@ -575,10 +575,10 @@ } /* TIFF header */ writeHeader(); - + /* Image File Directory */ - out.writeShort(numberEntries); - writeEntry(TAG_ImageWidth, TYPE_LONG, 1, imageWidth); + out.writeShort(numberEntries); + writeEntry(TAG_ImageWidth, TYPE_LONG, 1, imageWidth); writeEntry(TAG_ImageLength, TYPE_LONG, 1, imageLength); if (isColorMap) writeEntry(TAG_BitsPerSample, TYPE_SHORT, 1, image.depth); if (isRGB) writeEntry(TAG_BitsPerSample, TYPE_SHORT, 3, bitsPerSampleOffset); @@ -593,9 +593,9 @@ if (isColorMap) writeEntry(TAG_ColorMap, TYPE_SHORT, colorMap.length, colorMapOffset); /* Offset of next IFD (0 for last IFD) */ out.writeInt(0); - + /* Values longer than 4 bytes Section */ - + /* BitsPerSample 8,8,8 */ if (isRGB) for (int i = 0; i < 3; i++) out.writeShort(8); if (cnt > 1) { @@ -609,7 +609,7 @@ } /* ColorMap */ if (isColorMap) for (int i = 0; i < colorMap.length; i++) out.writeShort(colorMap[i]); - + /* Image Data */ out.write(data); } @@ -628,7 +628,7 @@ /* TIFF identifier */ out.writeShort(42); - /* + /* * Offset of the first IFD is chosen to be 8. * It is word aligned and immediately after this header. */ @@ -638,7 +638,7 @@ void writeToStream(LEDataOutputStream byteStream) throws IOException { out = byteStream; int photometricInterpretation = -1; - + /* Scanline pad must be 1 */ if (image.scanlinePad != 1) SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT); switch (image.depth) { @@ -652,7 +652,7 @@ if (!(rgb0.red == rgb0.green && rgb0.green == rgb0.blue && rgb1.red == rgb1.green && rgb1.green == rgb1.blue && ((rgb0.red == 0x0 && rgb1.red == 0xFF) || (rgb0.red == 0xFF && rgb1.red == 0x0)))) { - SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT); + SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT); } /* 0 means a color index of 0 is imaged as white */ photometricInterpretation = image.palette.colors[0].red == 0xFF ? 0 : 1; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/TIFFFileFormat.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/TIFFFileFormat.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/TIFFFileFormat.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/TIFFFileFormat.java 2016-07-06 19:11:33.000000000 +0000 @@ -31,7 +31,7 @@ if (!(header[0] == 0x49 && header[2] == 42 && header[3] == 0) && !(header[0] == 0x4d && header[2] == 0 && header[3] == 42)) { return false; - } + } return true; } catch (Exception e) { return false; @@ -39,7 +39,7 @@ } @Override -ImageData[] loadFromByteStream() { +ImageData[] loadFromByteStream() { byte[] header = new byte[8]; boolean isLittleEndian; ImageData[] images = new ImageData[0]; @@ -50,9 +50,9 @@ if (!(header[0] == 0x49 && header[2] == 42 && header[3] == 0) && !(header[0] == 0x4d && header[2] == 0 && header[3] == 42)) { SWT.error(SWT.ERROR_INVALID_IMAGE); - } - isLittleEndian = header[0] == 0x49; - int offset = isLittleEndian ? + } + isLittleEndian = header[0] == 0x49; + int offset = isLittleEndian ? (header[4] & 0xFF) | ((header[5] & 0xFF) << 8) | ((header[6] & 0xFF) << 16) | ((header[7] & 0xFF) << 24) : (header[7] & 0xFF) | ((header[6] & 0xFF) << 8) | ((header[5] & 0xFF) << 16) | ((header[4] & 0xFF) << 24); while (offset != 0) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/TIFFModifiedHuffmanCodec.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/TIFFModifiedHuffmanCodec.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/TIFFModifiedHuffmanCodec.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/TIFFModifiedHuffmanCodec.java 2016-07-06 19:11:33.000000000 +0000 @@ -13,11 +13,11 @@ import org.eclipse.swt.*; /* -* Decoder for +* Decoder for * - CCITT Group 3 1-Dimensional Modified Huffman run length encoding * (TIFF compression type 2) * - CCITT T.4 bi-level encoding 1D -* (TIFF compression type 3 option 1D) +* (TIFF compression type 3 option 1D) */ final class TIFFModifiedHuffmanCodec { static final short[][][] BLACK_CODE = { @@ -88,7 +88,7 @@ {/* EOL */{1, -1}, {18, 1984}, {19, 2048}, {20, 2112}, {21, 2176}, {22, 2240}, {23, 2304}, {28, 2368}, {29, 2432}, {30, 2496}, {31, 2560}} }; - + static final int BLACK_MIN_BITS = 2; static final int WHITE_MIN_BITS = 4; @@ -120,7 +120,7 @@ /* byte aligned */ if (bitOffsetDest > 0) { byteOffsetDest++; - bitOffsetDest = 0; + bitOffsetDest = 0; } } return byteOffsetDest - offsetDest; @@ -166,7 +166,7 @@ if (found) break; code = code << 1 | getNextBit(); } - if (!found) SWT.error(SWT.ERROR_INVALID_IMAGE); + if (!found) SWT.error(SWT.ERROR_INVALID_IMAGE); } } @@ -195,7 +195,7 @@ (byte)(dest[byteOffsetDest] | (1 << (7 - bitOffsetDest))) : (byte)(dest[byteOffsetDest] & ~(1 << (7 - bitOffsetDest))); n--; - bitOffsetDest++; + bitOffsetDest++; } if (bitOffsetDest == 8) { byteOffsetDest++; @@ -210,8 +210,8 @@ (byte)(dest[byteOffsetDest] | (1 << (7 - bitOffsetDest))) : (byte)(dest[byteOffsetDest] & ~(1 << (7 - bitOffsetDest))); n--; - bitOffsetDest++; - } + bitOffsetDest++; + } } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/TIFFRandomFileAccess.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/TIFFRandomFileAccess.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/TIFFRandomFileAccess.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/TIFFRandomFileAccess.java 2016-07-06 19:11:33.000000000 +0000 @@ -30,7 +30,7 @@ void seek(int pos) throws IOException { if (pos == current) return; if (pos < start) throw new IOException(); - current = pos; + current = pos; if (current > next) { int n = current - next; /* store required bytes */ @@ -60,11 +60,11 @@ if (nCached > 0) { /* Get cached bytes */ int index = current / CHUNK_SIZE; - int offset = current % CHUNK_SIZE; + int offset = current % CHUNK_SIZE; while (nCached > 0) { int cnt = Math.min(nCached, CHUNK_SIZE - offset); System.arraycopy(buffers[index], offset, b, destNext, cnt); - nCached -= cnt; + nCached -= cnt; destNext += cnt; index++; offset = 0; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/WinBMPFileFormat.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/WinBMPFileFormat.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/WinBMPFileFormat.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/WinBMPFileFormat.java 2016-07-06 19:11:33.000000000 +0000 @@ -103,7 +103,7 @@ dest[dp] = 0; dp++; } size += 2; - + return size; } int compressRLE8Data(byte[] src, int srcOffset, int numBytes, byte[] dest, boolean last) { @@ -178,7 +178,7 @@ dest[dp] = 0; dp++; } size += 2; - + return size; } void convertPixelsToBGR(ImageData image, byte[] dest) { @@ -186,8 +186,8 @@ * For direct palette, uncompressed image, BMP encoders expect the * pixels to be in BGR format for 24 & 32 bit and RGB 1555 for 16 bit * On Linux and MacOS, the pixels are in RGB format. Also, in - * MacOS, the alpha byte may be first. - * Hence, we use the palette information of the image and convert + * MacOS, the alpha byte may be first. + * Hence, we use the palette information of the image and convert * the pixels to the required format. Converted pixels are stored * in dest byte array. */ @@ -602,7 +602,7 @@ } /** * Unload the given image's data into the given byte stream - * using the given compression strategy. + * using the given compression strategy. * Answer the number of bytes written. * Method modified to use the passed data if it is not null. */ @@ -735,13 +735,13 @@ iData = new byte[image.data.length]; convertPixelsToBGR(image, iData); } - + // Prepare data. This is done first so we don't have to try to rewind // the stream and fill in the details later. ByteArrayOutputStream out = new ByteArrayOutputStream(); unloadData(image, iData, out, comp); byte[] data = out.toByteArray(); - + // Calculate file size fileHeader[1] = fileHeader[4] + data.length; @@ -770,7 +770,7 @@ } catch (IOException e) { SWT.error(SWT.ERROR_IO, e); } - + // Unload palette if (numCols > 0) { try { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/image/WinICOFileFormat.java swt4-gtk-4.6.0/org/eclipse/swt/internal/image/WinICOFileFormat.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/image/WinICOFileFormat.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/image/WinICOFileFormat.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,7 +16,7 @@ import java.io.*; public final class WinICOFileFormat extends FileFormat { - + byte[] bitInvertData(byte[] data, int startIndex, int endIndex) { // Destructively bit invert data in the given byte array. for (int i = startIndex; i < endIndex; i++) { @@ -212,8 +212,8 @@ int infoHeight = (infoHeader[8] & 0xFF) | ((infoHeader[9] & 0xFF) << 8) | ((infoHeader[10] & 0xFF) << 16) | ((infoHeader[11] & 0xFF) << 24); int bitCount = (infoHeader[14] & 0xFF) | ((infoHeader[15] & 0xFF) << 8); /* - * Feature in the ico spec. The spec says that a width/height of 0 represents 256, however, newer images can be created with even larger sizes. - * Images with a width/height >= 256 will have their width/height set to 0 in the icon header; the fix for this case is to read the width/height + * Feature in the ico spec. The spec says that a width/height of 0 represents 256, however, newer images can be created with even larger sizes. + * Images with a width/height >= 256 will have their width/height set to 0 in the icon header; the fix for this case is to read the width/height * directly from the image header. */ if (width == 0) width = infoWidth; @@ -249,7 +249,7 @@ } catch (IOException e) { SWT.error(SWT.ERROR_IO, e); } - + byte[] rgbs = WinBMPFileFormat.paletteToBytes(icon.palette); try { outputStream.write(rgbs); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/ImageList.java swt4-gtk-4.6.0/org/eclipse/swt/internal/ImageList.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/ImageList.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/ImageList.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -11,10 +11,10 @@ package org.eclipse.swt.internal; -import org.eclipse.swt.SWT; +import org.eclipse.swt.*; +import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.cairo.*; import org.eclipse.swt.internal.gtk.*; -import org.eclipse.swt.graphics.*; public class ImageList { int /*long*/ [] pixbufs; @@ -30,7 +30,7 @@ int /*long*/ newSurface = image.surface; int type = Cairo.cairo_surface_get_type(newSurface); if (type != Cairo.CAIRO_SURFACE_TYPE_IMAGE) { - Rectangle bounds = image.getBounds(); + Rectangle bounds = image.getBoundsInPixels(); int format = Cairo.cairo_surface_get_content(newSurface) == Cairo.CAIRO_CONTENT_COLOR ? Cairo.CAIRO_FORMAT_RGB24 : Cairo.CAIRO_FORMAT_ARGB32; newSurface = Cairo.cairo_image_surface_create(format, bounds.width, bounds.height); if (newSurface == 0) SWT.error(SWT.ERROR_NO_HANDLES); @@ -136,7 +136,7 @@ } OS.g_object_unref(maskPixbuf); } else { - ImageData data = image.getImageData (); + ImageData data = image.getImageDataAtCurrentZoom (); boolean hasAlpha = data.getTransparencyType () == SWT.TRANSPARENCY_ALPHA; pixbuf = OS.gdk_pixbuf_new (OS.GDK_COLORSPACE_RGB, hasAlpha, 8, w [0], h [0]); if (pixbuf == 0) SWT.error (SWT.ERROR_NO_HANDLES); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/Library.java swt4-gtk-4.6.0/org/eclipse/swt/internal/Library.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/Library.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/Library.java 2016-07-06 19:11:33.000000000 +0000 @@ -17,22 +17,22 @@ public class Library { /* SWT Version - Mmmm (M=major, mmm=minor) */ - + /** * SWT Major version number (must be >= 0) */ static int MAJOR_VERSION = 4; - + /** * SWT Minor version number (must be in the range 0..999) */ - static int MINOR_VERSION = 527; - + static int MINOR_VERSION = 623; + /** * SWT revision number (must be >= 0) */ static int REVISION = 0; - + /** * The JAVA and SWT versions */ @@ -40,7 +40,7 @@ static final String SEPARATOR; static final String DELIMITER; - + /* 64-bit support */ static final boolean IS_64 = longConst() == (int /*long*/)longConst(); static final String SUFFIX_64 = "-64"; //$NON-NLS-1$ @@ -109,7 +109,7 @@ /** * Returns the Java version number as an integer. - * + * * @param major * @param minor * @param micro @@ -121,7 +121,7 @@ /** * Returns the SWT version number as an integer. - * + * * @param major * @param minor * @return the version @@ -196,7 +196,7 @@ /* * Mac has a special case since SWT's 32-bit libraries on Mac contain natives * for both the x86 and PPC architectures. For this reason SWT's manifest file - * for 32-bit Mac does not specify a value for SWT-Arch. + * for 32-bit Mac does not specify a value for SWT-Arch. */ if (os.equals ("macosx") && os.equals (manifestOS)) { //$NON-NLS-1$ return manifestArch.length () == 0 && (arch.equals ("ppc") || arch.equals ("x86")); //$NON-NLS-1$ //$NON-NLS-2$ @@ -210,7 +210,7 @@ System.load (libName); } else { System.loadLibrary (libName); - } + } return true; } catch (UnsatisfiedLinkError e) { if (message.length() == 0) message.append(DELIMITER); @@ -259,7 +259,7 @@ throw new UnsatisfiedLinkError ("Cannot load 32-bit SWT libraries on 64-bit JVM"); //$NON-NLS-1$ } } - + /* Compute the library name and mapped name */ String libName1, libName2, mappedName1, mappedName2; if (mapName) { @@ -272,7 +272,7 @@ } else { if (MINOR_VERSION < 100) version += "0"; //$NON-NLS-1$ } - version += MINOR_VERSION; + version += MINOR_VERSION; /* No "r" until first revision */ if (REVISION > 0) version += "r" + REVISION; //$NON-NLS-1$ } @@ -285,7 +285,7 @@ } StringBuffer message = new StringBuffer(); - + /* Try loading library from swt library path */ String path = System.getProperty ("swt.library.path"); //$NON-NLS-1$ if (path != null) { @@ -316,13 +316,13 @@ if (load (path + SEPARATOR + fileName1, message)) return; if (mapName && load (path + SEPARATOR + fileName2, message)) return; } - + /* Try extracting and loading library from jar */ if (path != null) { if (extract (path + SEPARATOR + fileName1, mappedName1, message)) return; if (mapName && extract (path + SEPARATOR + fileName2, mappedName2, message)) return; } - + /* Failed to find the library */ throw new UnsatisfiedLinkError ("Could not load SWT library. Reasons: " + message.toString()); //$NON-NLS-1$ } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/Lock.java swt4-gtk-4.6.0/org/eclipse/swt/internal/Lock.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/Lock.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/Lock.java 2016-07-06 19:11:33.000000000 +0000 @@ -21,7 +21,7 @@ * Locks the monitor and returns the lock count. If * the lock is owned by another thread, wait until * the lock is released. - * + * * @return the lock count */ public int lock() { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/LONG.java swt4-gtk-4.6.0/org/eclipse/swt/internal/LONG.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/LONG.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/LONG.java 2016-07-06 19:11:33.000000000 +0000 @@ -13,7 +13,7 @@ /** @jniclass flags=no_gen */ public class LONG { public int /*long*/ value; - + public LONG (int /*long*/ value) { this.value = value; } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/Execute.java swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/Execute.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/Execute.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/Execute.java 2016-07-06 19:11:33.000000000 +0000 @@ -29,9 +29,9 @@ public int EvalInWindow(nsIDOMWindow aWindow, nsEmbedString code, int /*long*/[] aVariant) { return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aWindow.getAddress(), code.getAddress(), aVariant); } - + public int EvalAsChrome(nsIDOMWindow aWindow, nsEmbedString code, int /*long*/[] aVariant) { return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aWindow.getAddress(), code.getAddress(), aVariant); } - + } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/IIDStore.java swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/IIDStore.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/IIDStore.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/IIDStore.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014 IBM Corporation and others. + * Copyright (c) 2014, 2016 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 @@ -15,7 +15,7 @@ import org.eclipse.swt.internal.C; public abstract class IIDStore { - static HashMap<Class<?>,nsID[]> IIDs = new HashMap<Class<?>,nsID[]> (); + static HashMap<Class<?>,nsID[]> IIDs = new HashMap<> (); public static nsID GetIID (Class<?> clazz) { return GetIID (clazz, MozillaVersion.GetCurrentVersion ()); @@ -29,7 +29,7 @@ if (version <= MozillaVersion.GetLatestVersion ()) { nsID[] table = IIDs.get (clazz); if (table == null) { - /* The nsI* class has not been loaded, so attempt to create a default instance to make this happen */ + /* The nsI* class has not been loaded, so attempt to create a default instance to make this happen */ try { Class<?> argType = C.PTR_SIZEOF == 4 ? Integer.TYPE : Long.TYPE; clazz.getConstructor (new Class<?>[] {argType}).newInstance (new Object[] {0}); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/MozillaVersion.java swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/MozillaVersion.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/MozillaVersion.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/MozillaVersion.java 2016-07-06 19:11:33.000000000 +0000 @@ -30,7 +30,7 @@ } public static boolean CheckVersion (int version, boolean exact) { - return exact ? version == CurrentVersion : version <= CurrentVersion; + return exact ? version == CurrentVersion : version <= CurrentVersion; } public static int GetCurrentVersion () { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsEmbedString.java swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsEmbedString.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsEmbedString.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsEmbedString.java 2016-07-06 19:11:33.000000000 +0000 @@ -29,7 +29,7 @@ public class nsEmbedString { int /*long*/ handle; - + public nsEmbedString() { handle = XPCOM.nsEmbedString_new(); } @@ -39,7 +39,7 @@ char[] aString = new char[string.length() + 1]; string.getChars(0, string.length(), aString, 0); handle = XPCOM.nsEmbedString_new(aString); - } + } } public nsEmbedString(int /*long*/ handle) { @@ -48,8 +48,8 @@ public int /*long*/ getAddress() { return handle; -} - +} + @Override public String toString() { if (handle == 0) return null; @@ -58,11 +58,11 @@ char[] dest = new char[length]; XPCOM.memmove(dest, buffer, length * 2); return new String(dest); -} - +} + public void dispose() { - if (handle == 0) return; + if (handle == 0) return; XPCOM.nsEmbedString_delete(handle); - handle = 0; -} + handle = 0; +} } \ No newline at end of file diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsID.java swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsID.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsID.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsID.java 2016-07-06 19:11:33.000000000 +0000 @@ -29,7 +29,7 @@ /** @jniclass flags=cpp */ public class nsID { - + public int m0; public short m1; public short m2; @@ -131,10 +131,10 @@ @Override public String toString () { - return '{' + toHex (m0, 8) + '-' + - toHex (m1, 4) + '-' + - toHex (m2, 4) + '-' + - toHex (m3[0], 2) + toHex (m3[1], 2) + '-' + + return '{' + toHex (m0, 8) + '-' + + toHex (m1, 4) + '-' + + toHex (m2, 4) + '-' + + toHex (m3[0], 2) + toHex (m3[1], 2) + '-' + toHex (m3[2], 2) + toHex (m3[3], 2) + toHex (m3[4], 2) + toHex (m3[5], 2) + toHex (m3[6], 2) + toHex (m3[7], 2) + '}'; } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsIDOMKeyEvent.java swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsIDOMKeyEvent.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsIDOMKeyEvent.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsIDOMKeyEvent.java 2016-07-06 19:11:33.000000000 +0000 @@ -162,7 +162,7 @@ public static final int DOM_VK_CLOSE_BRACKET = 221; public static final int DOM_VK_QUOTE = 222; public static final int DOM_VK_META = 224; - + /* the following constants are defined in Mozilla 10 */ public static final int DOM_VK_KANA = 21; public static final int DOM_VK_HANGUL = 21; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsIDOMSerializer.java swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsIDOMSerializer.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsIDOMSerializer.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsIDOMSerializer.java 2016-07-06 19:11:33.000000000 +0000 @@ -50,7 +50,7 @@ } return XPCOM.VtblCall(this.getMethodIndex("serializeToString"), getAddress(), root, _retval); } - + public int SerializeToString(int /*long*/ root, int /*long*/ _retval) { if (!MozillaVersion.CheckVersion (MozillaVersion.VERSION_XR1_8)) { /* 1.4.x */ return XPCOM.NS_COMFALSE; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsIDOMWindow.java swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsIDOMWindow.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsIDOMWindow.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsIDOMWindow.java 2016-07-06 19:11:33.000000000 +0000 @@ -56,12 +56,12 @@ if (IsXULRVersionOrLater(MozillaVersion.VERSION_XR24)) return GetRealTop(aTop); return XPCOM.VtblCall(this.getGetterIndex("top"), getAddress(), aTop); } - + public int GetRealTop(int /*long*/[] aTop) { if (!IsXULRVersionOrLater(MozillaVersion.VERSION_XR24)) return XPCOM.NS_ERROR_NOT_IMPLEMENTED; return XPCOM.VtblCall(this.getGetterIndex("realTop"), getAddress(), aTop); } - + public int GetFrames(int /*long*/[] aFrames) { return XPCOM.VtblCall(this.getGetterIndex("frames"), getAddress(), aFrames); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsIFile.java swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsIFile.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsIFile.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsIFile.java 2016-07-06 19:11:33.000000000 +0000 @@ -34,7 +34,7 @@ * Note: The following value is likely wrong for XULRunner 24 because nsIFile is referenced * (which initializes this value) before it has been determined whether XULRunner 24 * is being used or not. However this does not currently cause a problem because the - * only reference to it is nsILocalFile.LAST_METHOD_ID, which is currently not used. + * only reference to it is nsILocalFile.LAST_METHOD_ID, which is currently not used. */ static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + (IsXULRVersionOrLater(MozillaVersion.VERSION_XR24) ? 62 : 45); @@ -56,7 +56,13 @@ public static final int DIRECTORY_TYPE = 1; public int Create(int type, int permissions) { - return XPCOM.VtblCall(this.getMethodIndex("create"), getAddress(), type, permissions); + /* + * Finding the method index by name using getMethodIndex() fails if + * mozilla profile directory is missing. Hence, use method index + * directly to support nsIFile.Create operation in the absence of + * profile directory. + */ + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), type, permissions); } public int GetLeafName(int /*long*/ aLeafName) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsIHelperAppLauncher_1_8.java swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsIHelperAppLauncher_1_8.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsIHelperAppLauncher_1_8.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsIHelperAppLauncher_1_8.java 2016-07-06 19:11:33.000000000 +0000 @@ -36,16 +36,16 @@ static final String NS_IHELPERAPPLAUNCHER_1_9_IID_STR = "cc75c21a-0a79-4f68-90e1-563253d0c555"; static final String NS_IHELPERAPPLAUNCHER_10_IID_STR = "d9a19faf-497b-408c-b995-777d956b72c0"; static final String NS_IHELPERAPPLAUNCHER_24_IID_STR = "acf2a516-7d7f-4771-8b22-6c4a559c088e"; - + static { IIDStore.RegisterIID(nsIHelperAppLauncher_1_8.class, MozillaVersion.VERSION_BASE, new nsID(NS_IHELPERAPPLAUNCHER_IID_STR)); IIDStore.RegisterIID(nsIHelperAppLauncher_1_8.class, MozillaVersion.VERSION_XR1_9, new nsID(NS_IHELPERAPPLAUNCHER_1_9_IID_STR)); IIDStore.RegisterIID(nsIHelperAppLauncher_1_8.class, MozillaVersion.VERSION_XR10, new nsID(NS_IHELPERAPPLAUNCHER_10_IID_STR)); IIDStore.RegisterIID(nsIHelperAppLauncher_1_8.class, MozillaVersion.VERSION_XR24, new nsID(NS_IHELPERAPPLAUNCHER_24_IID_STR)); } - - /* - * This method is overridden in this Class because its Java Class name is different from the actual XULRunner Interface name. + + /* + * This method is overridden in this Class because its Java Class name is different from the actual XULRunner Interface name. * This would cause getMethodIndex() to fail as getClass().getSimpleName() returns the Java Class name. */ @Override @@ -60,5 +60,5 @@ public int SaveToDisk(int /*long*/ aNewFileLocation, int aRememberThisPreference) { return XPCOM.VtblCall(this.getMethodIndex("saveToDisk"), getAddress(), aNewFileLocation, aRememberThisPreference); } - + } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsIInputStream.java swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsIInputStream.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsIInputStream.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsIInputStream.java 2016-07-06 19:11:33.000000000 +0000 @@ -48,7 +48,7 @@ if (IsXULRVersionOrLater(MozillaVersion.VERSION_XR24)) return XPCOM.NS_COMFALSE; return XPCOM.VtblCall(this.getMethodIndex("available"), getAddress(), _retval); } - + public int Available(long[] _retval) { if (!IsXULRVersionOrLater(MozillaVersion.VERSION_XR24)) return XPCOM.NS_COMFALSE; return XPCOM.VtblCall(this.getMethodIndex("available"), getAddress(), _retval); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsIInterfaceInfo.java swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsIInterfaceInfo.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsIInterfaceInfo.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsIInterfaceInfo.java 2016-07-06 19:11:33.000000000 +0000 @@ -31,7 +31,7 @@ public class nsIInterfaceInfo extends nsISupports { static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + ((IsXULRVersionOrLater (MozillaVersion.VERSION_XR10)) ? 21 : 20); - + static final String NS_IINTERFACEINFO_IID_STR = "215dbe04-94a7-11d2-ba58-00805f8a5dd7"; static final String NS_IINTERFACEINFO_10_IID_STR = "1affa260-8965-4612-869a-78af4ccfb287"; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsIPrefBranch.java swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsIPrefBranch.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsIPrefBranch.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsIPrefBranch.java 2016-07-06 19:11:33.000000000 +0000 @@ -35,7 +35,7 @@ static final String NS_IPREFBRANCH_IID_STR = "56c35506-f14b-11d3-99d3-ddbfac2ccf65"; static final String NS_IPREFBRANCH_10_IID_STR = "e162bfa0-01bd-4e9f-9843-8fb2efcd6d1f"; static final String NS_IPREFBRANCH_24_IID_STR = "55d25e49-793f-4727-a69f-de8b15f4b985"; - + static { IIDStore.RegisterIID(nsIPrefBranch.class, MozillaVersion.VERSION_BASE, new nsID(NS_IPREFBRANCH_IID_STR)); IIDStore.RegisterIID(nsIPrefBranch.class, MozillaVersion.VERSION_XR10, new nsID(NS_IPREFBRANCH_10_IID_STR)); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsIScriptContext.java swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsIScriptContext.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsIScriptContext.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsIScriptContext.java 2016-07-06 19:11:33.000000000 +0000 @@ -43,7 +43,7 @@ IIDStore.RegisterIID(nsIScriptContext.class, MozillaVersion.VERSION_XR24, new nsID(NS_ISCRIPTCONTEXT_24_IID_STR)); IIDStore.RegisterIID(nsIScriptContext.class, MozillaVersion.VERSION_XR31, new nsID(NS_ISCRIPTCONTEXT_31_IID_STR)); } - + public nsIScriptContext(int /*long*/ address) { super(address); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsIScriptSecurityManager.java swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsIScriptSecurityManager.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsIScriptSecurityManager.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsIScriptSecurityManager.java 2016-07-06 19:11:33.000000000 +0000 @@ -58,7 +58,7 @@ public int GetSystemPrincipal(int /*long*/[] _retval) { return XPCOM.VtblCall(this.getMethodIndex("getSystemPrincipal"), getAddress(), _retval); } - + public int GetSubjectPrincipal(int /*long*/[] _retval) { return XPCOM.VtblCall(this.getMethodIndex("getSubjectPrincipal"), getAddress(), _retval); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsISupports.java swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsISupports.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsISupports.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsISupports.java 2016-07-06 19:11:33.000000000 +0000 @@ -48,19 +48,19 @@ protected static boolean IsXULRunner24 () { return MozillaVersion.CheckVersion (MozillaVersion.VERSION_XR24, true); } - + protected static boolean IsXULRunner31 () { return MozillaVersion.CheckVersion (MozillaVersion.VERSION_XR31, true); } - + protected static boolean IsXULRVersionOrLater (int version) { return MozillaVersion.CheckVersion (version, false); } public static final String NS_ISUPPORTS_IID_STR = "00000000-0000-0000-c000-000000000046"; - + static { - IIDStore.RegisterIID (nsISupports.class, MozillaVersion.VERSION_BASE, new nsID (NS_ISUPPORTS_IID_STR)); + IIDStore.RegisterIID (nsISupports.class, MozillaVersion.VERSION_BASE, new nsID (NS_ISUPPORTS_IID_STR)); } private static byte[] toByteArray (String str) { @@ -77,11 +77,11 @@ protected int getSetterIndex (String attribute) { return getMethodIndex (attribute) + 1; } - + protected String getClassName() { return getClass ().getSimpleName (); } - + protected int getMethodIndex (String methodString) { int /*long*/[] result = new int /*long*/[1]; result[0] = 0; @@ -114,7 +114,7 @@ if (rc != XPCOM.NS_OK) { throw new SWTError(rc); } - + return index[0]; } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsIURI.java swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsIURI.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/nsIURI.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/nsIURI.java 2016-07-06 19:11:33.000000000 +0000 @@ -29,7 +29,7 @@ public class nsIURI extends nsISupports { - + static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + (IsXULRVersionOrLater(MozillaVersion.VERSION_XR10) ? 32 : 26); static final String NS_IURI_IID_STR = "07a22cc0-0ce5-11d3-9331-00104ba0fd40"; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/XPCOM.java swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/XPCOM.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/XPCOM.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/XPCOM.java 2016-07-06 19:11:33.000000000 +0000 @@ -241,7 +241,7 @@ public static final native int /*long*/ CALLBACK_JSNative(int /*long*/ func); /** @method flags=no_gen */ -public static final native int /*long*/ _JS_DefineFunction(byte[] mozillaPath, int /*long*/ cx, int /*long*/ obj, byte[] name, int /*long*/ call, int nargs, int flags); +public static final native int /*long*/ _JS_DefineFunction(byte[] mozillaPath, int /*long*/ cx, int /*long*/ obj, byte[] name, int /*long*/ call, int nargs, int flags); public static final int /*long*/ JS_DefineFunction(byte[] mozillaPath, int /*long*/ cx, int /*long*/ obj, byte[] name, int /*long*/ call, int nargs, int flags) { lock.lock(); try { @@ -251,7 +251,7 @@ } } /** @method flags=no_gen */ -public static final native int /*long*/ _JS_DefineFunction24(int /*long*/ cx, int /*long*/ obj, byte[] name, int /*long*/ call, int nargs, int flags); +public static final native int /*long*/ _JS_DefineFunction24(int /*long*/ cx, int /*long*/ obj, byte[] name, int /*long*/ call, int nargs, int flags); public static final int /*long*/ JS_DefineFunction24(int /*long*/ cx, int /*long*/ obj, byte[] name, int /*long*/ call, int nargs, int flags) { lock.lock(); try { @@ -261,7 +261,7 @@ } } /** @method flags=no_gen */ -public static final native int _JS_EvaluateUCScriptForPrincipals(byte[] mozillaPath, int /*long*/ cx, int /*long*/ obj, int /*long*/ principals, char[] chars, int length, byte[] filename, int lineno, int /*long*/[] retVal); +public static final native int _JS_EvaluateUCScriptForPrincipals(byte[] mozillaPath, int /*long*/ cx, int /*long*/ obj, int /*long*/ principals, char[] chars, int length, byte[] filename, int lineno, int /*long*/[] retVal); public static final int JS_EvaluateUCScriptForPrincipals(byte[] mozillaPath, int /*long*/ cx, int /*long*/ obj, int /*long*/ principals, char[] chars, int length, byte[] filename, int lineno, int /*long*/[] retVal) { lock.lock(); try { @@ -271,7 +271,7 @@ } } /** @method flags=no_gen */ -public static final native int _JS_EvaluateUCScriptForPrincipals191(byte[] mozillaPath, int /*long*/ cx, int /*long*/ obj, int /*long*/ principals, char[] chars, int length, byte[] filename, int lineno, int /*long*/ retVal); +public static final native int _JS_EvaluateUCScriptForPrincipals191(byte[] mozillaPath, int /*long*/ cx, int /*long*/ obj, int /*long*/ principals, char[] chars, int length, byte[] filename, int lineno, int /*long*/ retVal); public static final int JS_EvaluateUCScriptForPrincipals191(byte[] mozillaPath, int /*long*/ cx, int /*long*/ obj, int /*long*/ principals, char[] chars, int length, byte[] filename, int lineno, int /*long*/ retVal) { lock.lock(); try { @@ -281,7 +281,7 @@ } } /** @method flags=no_gen */ -public static final native int _JS_EvaluateUCScriptForPrincipals24(byte[] mozillaPath, int /*long*/ cx, int /*long*/ obj, int /*long*/ principals, char[] chars, int length, byte[] filename, int lineno, int /*long*/ retVal); +public static final native int _JS_EvaluateUCScriptForPrincipals24(byte[] mozillaPath, int /*long*/ cx, int /*long*/ obj, int /*long*/ principals, char[] chars, int length, byte[] filename, int lineno, int /*long*/ retVal); public static final int JS_EvaluateUCScriptForPrincipals24(byte[] mozillaPath, int /*long*/ cx, int /*long*/ obj, int /*long*/ principals, char[] chars, int length, byte[] filename, int lineno, int /*long*/ retVal) { lock.lock(); try { @@ -291,7 +291,7 @@ } } /** @method flags=no_gen */ -public static final native int /*long*/ _JS_GetGlobalForScopeChain24(int /*long*/ cx); +public static final native int /*long*/ _JS_GetGlobalForScopeChain24(int /*long*/ cx); public static final int /*long*/ JS_GetGlobalForScopeChain24(int /*long*/ cx) { lock.lock(); try { @@ -301,7 +301,7 @@ } } /** @method flags=no_gen */ -public static final native int /*long*/ _JS_GetGlobalObject(byte[] mozillaPath, int /*long*/ cx); +public static final native int /*long*/ _JS_GetGlobalObject(byte[] mozillaPath, int /*long*/ cx); public static final int /*long*/ JS_GetGlobalObject(byte[] mozillaPath, int /*long*/ cx) { lock.lock(); try { @@ -311,7 +311,7 @@ } } /** @method flags=no_gen */ -public static final native int /*long*/ _JS_NewObject(byte[] mozillaPath, int /*long*/ cx, int /*long*/ clasp, int /*long*/ proto, int /*long*/ parent); +public static final native int /*long*/ _JS_NewObject(byte[] mozillaPath, int /*long*/ cx, int /*long*/ clasp, int /*long*/ proto, int /*long*/ parent); public static final int /*long*/ JS_NewObject(byte[] mozillaPath, int /*long*/ cx, int /*long*/ clasp, int /*long*/ proto, int /*long*/ parent) { lock.lock(); try { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/XPCOMObject.java swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/XPCOMObject.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/mozilla/XPCOMObject.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/mozilla/XPCOMObject.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2012 IBM Corporation and others. + * Copyright (c) 2003, 2016 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 @@ -21,16 +21,16 @@ String osName = System.getProperty ("os.name").toLowerCase (); //$NON-NLS-1$ IsSolaris = osName.startsWith ("sunos") || osName.startsWith("solaris"); //$NON-NLS-1$ } - + int /*long*/ ppVtable; static private final int MAX_ARG_COUNT = 12; static private final int MAX_VTABLE_LENGTH = 80; static final int OS_OFFSET = IsSolaris ? 2 : 0; static private Callback[][] Callbacks = new Callback[MAX_VTABLE_LENGTH + OS_OFFSET][MAX_ARG_COUNT]; - static private Hashtable<LONG, XPCOMObject> ObjectMap = new Hashtable<LONG, XPCOMObject> (); - - + static private Map<LONG, XPCOMObject> ObjectMap = new HashMap<> (); + + public XPCOMObject (int[] argCounts) { int /*long*/[] callbackAddresses = new int /*long*/[argCounts.length + OS_OFFSET]; synchronized (Callbacks) { @@ -57,722 +57,722 @@ static int /*long*/ callback0 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method0 (args); + return object.method0 (args); } static int /*long*/ callback1 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method1 (args); + return object.method1 (args); } static int /*long*/ callback10 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method10 (args); + return object.method10 (args); } static int /*long*/ callback11 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method11 (args); + return object.method11 (args); } static int /*long*/ callback12 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method12 (args); + return object.method12 (args); } static int /*long*/ callback13 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method13 (args); + return object.method13 (args); } static int /*long*/ callback14 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method14 (args); + return object.method14 (args); } static int /*long*/ callback15 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method15 (args); + return object.method15 (args); } static int /*long*/ callback16 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method16 (args); + return object.method16 (args); } static int /*long*/ callback17 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method17 (args); + return object.method17 (args); } static int /*long*/ callback18 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method18 (args); + return object.method18 (args); } static int /*long*/ callback19 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method19 (args); + return object.method19 (args); } static int /*long*/ callback2 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method2 (args); + return object.method2 (args); } static int /*long*/ callback20 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method20 (args); + return object.method20 (args); } static int /*long*/ callback21 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method21 (args); + return object.method21 (args); } static int /*long*/ callback22 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method22 (args); + return object.method22 (args); } static int /*long*/ callback23 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method23 (args); + return object.method23 (args); } static int /*long*/ callback24 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method24 (args); + return object.method24 (args); } static int /*long*/ callback25 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method25 (args); + return object.method25 (args); } static int /*long*/ callback26 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method26 (args); + return object.method26 (args); } static int /*long*/ callback27 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method27 (args); + return object.method27 (args); } static int /*long*/ callback28 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method28 (args); + return object.method28 (args); } static int /*long*/ callback29 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method29 (args); + return object.method29 (args); } static int /*long*/ callback3 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method3 (args); + return object.method3 (args); } static int /*long*/ callback30 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method30 (args); + return object.method30 (args); } static int /*long*/ callback31 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method31 (args); + return object.method31 (args); } static int /*long*/ callback32 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method32 (args); + return object.method32 (args); } static int /*long*/ callback33 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method33 (args); + return object.method33 (args); } static int /*long*/ callback34 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method34 (args); + return object.method34 (args); } static int /*long*/ callback35 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method35 (args); + return object.method35 (args); } static int /*long*/ callback36 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method36 (args); + return object.method36 (args); } static int /*long*/ callback37 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method37 (args); + return object.method37 (args); } static int /*long*/ callback38 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method38 (args); + return object.method38 (args); } static int /*long*/ callback39 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method39 (args); + return object.method39 (args); } static int /*long*/ callback4 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method4 (args); + return object.method4 (args); } static int /*long*/ callback40 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method40 (args); + return object.method40 (args); } static int /*long*/ callback41 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method41 (args); + return object.method41 (args); } static int /*long*/ callback42 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method42 (args); + return object.method42 (args); } static int /*long*/ callback43 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method43 (args); + return object.method43 (args); } static int /*long*/ callback44 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method44 (args); + return object.method44 (args); } static int /*long*/ callback45 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method45 (args); + return object.method45 (args); } static int /*long*/ callback46 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method46 (args); + return object.method46 (args); } static int /*long*/ callback47 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method47 (args); + return object.method47 (args); } static int /*long*/ callback48 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method48 (args); + return object.method48 (args); } static int /*long*/ callback49 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method49 (args); + return object.method49 (args); } static int /*long*/ callback5 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method5 (args); + return object.method5 (args); } static int /*long*/ callback50 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method50 (args); + return object.method50 (args); } static int /*long*/ callback51 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method51 (args); + return object.method51 (args); } static int /*long*/ callback52 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method52 (args); + return object.method52 (args); } static int /*long*/ callback53 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method53 (args); + return object.method53 (args); } static int /*long*/ callback54 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method54 (args); + return object.method54 (args); } static int /*long*/ callback55 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method55 (args); + return object.method55 (args); } static int /*long*/ callback56 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method56 (args); + return object.method56 (args); } static int /*long*/ callback57 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method57 (args); + return object.method57 (args); } static int /*long*/ callback58 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method58 (args); + return object.method58 (args); } static int /*long*/ callback59 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method59 (args); + return object.method59 (args); } static int /*long*/ callback6 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method6 (args); + return object.method6 (args); } static int /*long*/ callback60 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method60 (args); + return object.method60 (args); } static int /*long*/ callback61 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method61 (args); + return object.method61 (args); } static int /*long*/ callback62 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method62 (args); + return object.method62 (args); } static int /*long*/ callback63 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method63 (args); + return object.method63 (args); } static int /*long*/ callback64 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method64 (args); + return object.method64 (args); } static int /*long*/ callback65 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method65 (args); + return object.method65 (args); } static int /*long*/ callback66 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method66 (args); + return object.method66 (args); } static int /*long*/ callback67 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method67 (args); + return object.method67 (args); } static int /*long*/ callback68 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method68 (args); + return object.method68 (args); } static int /*long*/ callback69 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method69 (args); + return object.method69 (args); } static int /*long*/ callback7 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method7 (args); + return object.method7 (args); } static int /*long*/ callback70 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method70 (args); + return object.method70 (args); } static int /*long*/ callback71 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method71 (args); + return object.method71 (args); } static int /*long*/ callback72 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method72 (args); + return object.method72 (args); } static int /*long*/ callback73 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method73 (args); + return object.method73 (args); } static int /*long*/ callback74 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method74 (args); + return object.method74 (args); } static int /*long*/ callback75 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method75 (args); + return object.method75 (args); } static int /*long*/ callback76 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method76 (args); + return object.method76 (args); } static int /*long*/ callback77 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method77 (args); + return object.method77 (args); } static int /*long*/ callback78 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method78 (args); + return object.method78 (args); } static int /*long*/ callback79 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method79 (args); + return object.method79 (args); } static int /*long*/ callback8 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method8 (args); + return object.method8 (args); } static int /*long*/ callback9 (int /*long*/[] callbackArgs) { // find the object on which this call was invoked int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); + XPCOMObject object = ObjectMap.get (new LONG (address)); if (object == null) return XPCOM.NS_ERROR_FAILURE; int /*long*/[] args = new int /*long*/[callbackArgs.length - 1]; System.arraycopy (callbackArgs, 1, args, 0, args.length); - return ((XPCOMObject) object).method9 (args); + return object.method9 (args); } public void dispose() { @@ -780,14 +780,14 @@ int /*long*/[] pVtable = new int /*long*/[1]; XPCOM.memmove (pVtable, ppVtable, C.PTR_SIZEOF); C.free (pVtable[0]); - C.free (ppVtable); + C.free (ppVtable); // remove this ppVtable from the list - ObjectMap.remove (new LONG (ppVtable)); + ObjectMap.remove (new LONG (ppVtable)); ppVtable = 0; } - + public int /*long*/ getAddress () { return ppVtable; } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/opengl/glx/GLX.java swt4-gtk-4.6.0/org/eclipse/swt/internal/opengl/glx/GLX.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/opengl/glx/GLX.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/opengl/glx/GLX.java 2016-07-06 19:11:33.000000000 +0000 @@ -56,7 +56,7 @@ public static final int GLX_MAX_PBUFFER_HEIGHT = 0x8017; public static final int GLX_MAX_PBUFFER_PIXELS = 0x8018; public static final int GLX_VISUAL_ID = 0x800B; - + /* ** Error return values from glXGetConfig. Success is indicated by ** a value of 0. @@ -68,29 +68,29 @@ public static final int GLX_BAD_CONTEXT = 5; /* returned only by import_context EXT? */ public static final int GLX_BAD_VALUE = 6; /* returned only by glXSwapIntervalSGI? */ public static final int GLX_BAD_ENUM = 7; /* unused? */ - + /* FBConfig attribute values */ - + /* ** Generic "don't care" value for glX ChooseFBConfig attributes (except ** GLX_LEVEL) */ public static final int GLX_DONT_CARE = 0xFFFFFFFF; - + /* GLX_RENDER_TYPE bits */ public static final int GLX_RGBA_BIT = 0x00000001; public static final int GLX_COLOR_INDEX_BIT = 0x00000002; - + /* GLX_DRAWABLE_TYPE bits */ public static final int GLX_WINDOW_BIT = 0x00000001; public static final int GLX_PIXMAP_BIT = 0x00000002; public static final int GLX_PBUFFER_BIT = 0x00000004; - + /* GLX_CONFIG_CAVEAT attribute values */ public static final int GLX_NONE = 0x8000; public static final int GLX_SLOW_CONFIG = 0x8001; public static final int GLX_NON_CONFORMANT_CONFIG = 0x800D; - + /* GLX_X_VISUAL_TYPE attribute values */ public static final int GLX_TRUE_COLOR = 0x8002; public static final int GLX_DIRECT_COLOR = 0x8003; @@ -98,43 +98,43 @@ public static final int GLX_STATIC_COLOR = 0x8005; public static final int GLX_GRAY_SCALE = 0x8006; public static final int GLX_STATIC_GRAY = 0x8007; - + /* GLX_TRANSPARENT_TYPE attribute values */ /* public static final int GLX_NONE 0x8000 */ public static final int GLX_TRANSPARENT_RGB = 0x8008; public static final int GLX_TRANSPARENT_INDEX = 0x8009; - + /* glXCreateGLXPbuffer attributes */ public static final int GLX_PRESERVED_CONTENTS = 0x801B; public static final int GLX_LARGEST_PBUFFER = 0x801C; public static final int GLX_PBUFFER_HEIGHT = 0x8040; /* New for GLX 1.3 */ public static final int GLX_PBUFFER_WIDTH = 0x8041; /* New for GLX 1.3 */ - + /* glXQueryGLXPBuffer attributes */ public static final int GLX_WIDTH = 0x801D; public static final int GLX_HEIGHT = 0x801E; public static final int GLX_EVENT_MASK = 0x801F; - + /* glXCreateNewContext render_type attribute values */ public static final int GLX_RGBA_TYPE = 0x8014; public static final int GLX_COLOR_INDEX_TYPE = 0x8015; - + /* glXQueryContext attributes */ /* public static final int GLX_FBCONFIG_ID 0x8013 */ /* public static final int GLX_RENDER_TYPE 0x8011 */ public static final int GLX_SCREEN = 0x800C; - + /* glXSelectEvent event mask bits */ public static final int GLX_PBUFFER_CLOBBER_MASK = 0x08000000; - + /* GLXPbufferClobberEvent event_type values */ public static final int GLX_DAMAGED = 0x8020; public static final int GLX_SAVED = 0x8021; - + /* GLXPbufferClobberEvent draw_type values */ public static final int GLX_WINDOW = 0x8022; public static final int GLX_PBUFFER = 0x8023; - + /* GLXPbufferClobberEvent buffer_mask bits */ public static final int GLX_FRONT_LEFT_BUFFER_BIT = 0x00000001; public static final int GLX_FRONT_RIGHT_BUFFER_BIT = 0x00000002; @@ -144,12 +144,12 @@ public static final int GLX_DEPTH_BUFFER_BIT = 0x00000020; public static final int GLX_STENCIL_BUFFER_BIT = 0x00000040; public static final int GLX_ACCUM_BUFFER_BIT = 0x00000080; - + /* ** Extension return values from glXGetConfig. These are also ** accepted as parameter values for glXChooseVisual. */ - + public static final int GLX_X_VISUAL_TYPE_EXT = 0x22; /* visual_info extension type */ public static final int GLX_TRANSPARENT_TYPE_EXT = 0x23; /* visual_info extension */ public static final int GLX_TRANSPARENT_INDEX_VALUE_EXT = 0x24; /* visual_info extension */ @@ -157,7 +157,7 @@ public static final int GLX_TRANSPARENT_GREEN_VALUE_EXT = 0x26; /* visual_info extension */ public static final int GLX_TRANSPARENT_BLUE_VALUE_EXT = 0x27; /* visual_info extension */ public static final int GLX_TRANSPARENT_ALPHA_VALUE_EXT = 0x28; /* visual_info extension */ - + /* Property values for visual_type */ public static final int GLX_TRUE_COLOR_EXT = 0x8002; public static final int GLX_DIRECT_COLOR_EXT = 0x8003; @@ -165,42 +165,42 @@ public static final int GLX_STATIC_COLOR_EXT = 0x8005; public static final int GLX_GRAY_SCALE_EXT = 0x8006; public static final int GLX_STATIC_GRAY_EXT = 0x8007; - + /* Property values for transparent pixel */ public static final int GLX_NONE_EXT = 0x8000; public static final int GLX_TRANSPARENT_RGB_EXT = 0x8008; public static final int GLX_TRANSPARENT_INDEX_EXT = 0x8009; - + /* Property values for visual_rating */ public static final int GLX_VISUAL_CAVEAT_EXT = 0x20; /* visual_rating extension type */ public static final int GLX_SLOW_VISUAL_EXT = 0x8001; public static final int GLX_NON_CONFORMANT_VISUAL_EXT = 0x800D; - + /* ** Names for attributes to glXGetClientString. */ public static final int GLX_VENDOR = 0x1; public static final int GLX_VERSION = 0x2; public static final int GLX_EXTENSIONS = 0x3; - + /* ** Names for attributes to glXQueryContextInfoEXT. */ public static final int GLX_SHARE_CONTEXT_EXT = 0x800A; /* id of share context */ public static final int GLX_VISUAL_ID_EXT = 0x800B; /* id of context's visual */ public static final int GLX_SCREEN_EXT = 0x800C; /* screen number */ - + /* - * GLX 1.4 + * GLX 1.4 */ public static final int GLX_SAMPLE_BUFFERS = 100000; public static final int GLX_SAMPLES = 100001; /* - * GL bits + * GL bits */ public static final int GL_VIEWPORT = 0x0BA2; - + public static final native int XVisualInfo_sizeof(); /** * @param pname cast=(GLenum) diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/Platform.java swt4-gtk-4.6.0/org/eclipse/swt/internal/Platform.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/Platform.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/Platform.java 2016-07-06 19:11:33.000000000 +0000 @@ -8,7 +8,7 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -20,7 +20,7 @@ public static final Lock lock = new Lock (); public static boolean isLoadable () { - return Library.isLoadable (); + return Library.isLoadable (); } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/SerializableCompatibility.java swt4-gtk-4.6.0/org/eclipse/swt/internal/SerializableCompatibility.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/SerializableCompatibility.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/SerializableCompatibility.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 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; - - -import java.io.Serializable; - -/** - * This interface is the cross-platform version of the - * java.io.Serializable interface. - * <p> - * It is part of our effort to provide support for both J2SE - * and J2ME platforms. Under this scheme, classes need to - * implement SerializableCompatibility instead of - * java.io.Serializable. - * </p> - * <p> - * Note: java.io.Serializable is not part of CLDC. - * </p> - */ -public interface SerializableCompatibility extends Serializable { -} diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/SWTEventListener.java swt4-gtk-4.6.0/org/eclipse/swt/internal/SWTEventListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/SWTEventListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/SWTEventListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -18,7 +18,7 @@ * java.util.EventListener interface. * <p> * It is part of our effort to provide support for both J2SE - * and J2ME platforms. Under this scheme, classes need to + * and J2ME platforms. Under this scheme, classes need to * implement SWTEventListener instead of java.util.EventListener. * </p> * <p> diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/SWTEventObject.java swt4-gtk-4.6.0/org/eclipse/swt/internal/SWTEventObject.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/SWTEventObject.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/SWTEventObject.java 2016-07-06 19:11:33.000000000 +0000 @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.swt.internal; - + import java.util.EventObject; /** @@ -18,7 +18,7 @@ * java.util.EventObject class. * <p> * It is part of our effort to provide support for both J2SE - * and J2ME platforms. Under this scheme, classes need to + * and J2ME platforms. Under this scheme, classes need to * extend SWTEventObject instead of java.util.EventObject. * </p> * <p> diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/SWTMessages_lv.properties swt4-gtk-4.6.0/org/eclipse/swt/internal/SWTMessages_lv.properties --- swt4-gtk-4.5.0/org/eclipse/swt/internal/SWTMessages_lv.properties 1970-01-01 00:00:00.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/SWTMessages_lv.properties 2016-07-06 19:11:33.000000000 +0000 @@ -0,0 +1,122 @@ +############################################################################### +# Copyright (c) 2000, 2013 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 +############################################################################### +# NLS_ENCODING=UNICODE +# NLS_MARKUP=IBMNJDK2 +# NLS_MESSAGEFORMAT_VAR + +SWT_Yes=J\u0101 +SWT_No=N\u0113 +SWT_OK=Labi +SWT_Cancel=Atcelt +SWT_Help=Pal\u012bdz\u012bba +SWT_Abort=Priek\u0161laikus p\u0101rtraukt +SWT_Retry=M\u0113\u0123in\u0101t v\u0113lreiz +SWT_Ignore=Ignor\u0113t +SWT_Sample=Paraugs +SWT_A_Sample_Text=Parauga teksts +SWT_Selection=Atlase +SWT_Current_Selection=Pa\u0161reiz\u0113j\u0101 atlase +SWT_Font=Fonts +SWT_Color=Kr\u0101sa +SWT_Extended_style=Papla\u0161in\u0101ts stils +SWT_Size=Izm\u0113rs +SWT_Style=Stils +SWT_Save=Saglab\u0101t +SWT_Character_set=Rakstz\u012bmju kopa +SWT_ColorDialog_Title=Kr\u0101sas +SWT_FontDialog_Title=Fonti +SWT_FontSet=Fontu kopa +SWT_NewFont=Jauns fonts +SWT_Remove=No\u0146emt +SWT_Up=Uz aug\u0161u +SWT_Down=Uz leju +SWT_Charset_Western=rietumu +SWT_Charset_EastEuropean=austrumu +SWT_Charset_SouthEuropean=dienvidu +SWT_Charset_NorthEuropean=zieme\u013cu +SWT_Charset_Cyrillic=kirilica +SWT_Charset_Arabic=ar\u0101bu +SWT_Charset_Greek=grie\u0137u +SWT_Charset_Hebrew=ebreju +SWT_Charset_Turkish=turku +SWT_Charset_Nordic=nordic +SWT_Charset_Thai=taju +SWT_Charset_BalticRim=baltic rim +SWT_Charset_Celtic=\u0137eltu +SWT_Charset_Euro=euro +SWT_Charset_Romanian=rum\u0101\u0146u +SWT_Charset_SimplifiedChinese=vienk.\u0137\u012bnie\u0161u +SWT_Charset_TraditionalChinese=trad. \u0137\u012bnie\u0161u +SWT_Charset_Japanese=jap\u0101\u0146u +SWT_Charset_Korean=korejie\u0161u +SWT_Charset_Unicode=unikods +SWT_Charset_ASCII=ASCII +SWT_InputMethods=Ievades metodes +SWT_Password=Parole: +SWT_Username=Lietot\u0101jv\u0101rds: +SWT_Switch=P\u0101rsl\u0113gt +SWT_Press=Nospiest +SWT_Open=Atv\u0113rt +SWT_Close=Aizv\u0113rt +SWT_Minimize=Minimiz\u0113t +SWT_Maximize=Maksimiz\u0113t +SWT_Restore=Atjaunot +SWT_ShowList=R\u0101d\u012bt sarakstu +SWT_Page_Mnemonic=Alt+{0} +SWT_SwitchPage_Shortcut=Ctrl+PageDown +SWT_FileDownload=Faila lejupiel\u0101de +SWT_Download_Error=Rad\u0101s k\u013c\u016bda, lejupiel\u0101de netika pabeigta +SWT_Download_File=Lejupiel\u0101de: {0} +SWT_Download_Location=Saglab\u0101 {0} no {1} +SWT_Download_Started=Lejupiel\u0101d\u0113... +SWT_Download_Status=Lejupiel\u0101de: {0,number,integer} KB no {1,number,integer} KB +SWT_Authentication_Required=Nepiecie\u0161ama autentific\u0113\u0161ana +SWT_Enter_Username_and_Password=Ievadiet lietot\u0101jv\u0101rdu un paroli {0} lauk\u0101 {1} +SWT_Page_Load_Failed=Lapas iel\u0101de neizdev\u0101s, jo rad\u0101s k\u013c\u016bda: {0} +SWT_InvalidCert_Title=Neder\u012bgs sertifik\u0101ts +SWT_InvalidCert_Message=Dro\u0161\u012bbas sertifik\u0101tam, ko iesniedza "{0}", ir probl\u0113ma(s). +SWT_InvalidCert_InvalidName=Sertifik\u0101ta nosaukums ir neder\u012bgs vai neatbilst vietnes nosaukumam. Sertifik\u0101ts izsniegts: "{0}". +SWT_InvalidCert_NotValid=Sertifik\u0101ts pa\u0161laik nav der\u012bgs. Der\u012bgo datumu diapazons: "{0}". +SWT_InvalidCert_NotTrusted=Sertifik\u0101tu nav izsniegusi uzticama iest\u0101de. Sertifik\u0101ta izsniedz\u0113js: "{0}". +SWT_InvalidCert_Connect=Vai vienalga v\u0113laties turpin\u0101t? +SWT_OnBeforeUnload_Message1=Vai tie\u0161\u0101m v\u0113laties atst\u0101t \u0161o lapu? +SWT_OnBeforeUnload_Message2=Noklik\u0161\u0137iniet uz Labi, lai turpin\u0101tu, vai uz Atcelt, lai paliktu \u0161aj\u0101 lap\u0101. +SWT_ViewCertificate=Skat\u012bt sertifik\u0101tu +SWT_Certificate=Sertifik\u0101ts +SWT_Controlled_By=kontrol\u0113: +SWT_Controller_For=kontrolleris paredz\u0113ts: +SWT_Described_By=aprakst\u012bjis: +SWT_Description_For=apraksts paredz\u0113ts: +SWT_Embedded_By=iegul\u0161anu veica: +SWT_Embeds=iegul\u0161ana +SWT_Flows_From=pl\u016bsmas no +SWT_Flows_To=pl\u016bsmas uz +SWT_Label_For=eti\u0137ete paredz\u0113ta: +SWT_Labelled_By=eti\u0137eti piestiprin\u0101ja: +SWT_Member_Of=dal\u012bbnieks +SWT_Node_Child_Of=mezgla atvase +SWT_Parent_Window_Of=galvenais logs +SWT_Popup_For=uznirsto\u0161ais logs +SWT_Subwindow_Of=apak\u0161logs +SWT_Continue=Turpin\u0101t +SWT_IssuedTo=Izsniegts:\t{0} +SWT_IssuedFrom=Izsniedzis: \t{0} +SWT_Issuer=Izsniedz\u0113js +SWT_General=Visp\u0101r\u012bgi +SWT_Details=Dati +SWT_Field=Lauks +SWT_Value=V\u0113rt\u012bba +SWT_Version=Versija +SWT_ValidFrom=Sp\u0113k\u0101 no +SWT_ValidTo=Sp\u0113k\u0101 l\u012bdz +SWT_ValidFromTo=Sp\u0113k\u0101 no: {0} l\u012bdz: {1} +SWT_Subject=Temats +SWT_SerialNumber=S\u0113rijas numurs diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/ButtonDrawData.java swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/ButtonDrawData.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/ButtonDrawData.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/ButtonDrawData.java 2016-07-06 19:11:33.000000000 +0000 @@ -13,11 +13,10 @@ import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; -import org.eclipse.swt.internal.cairo.Cairo; import org.eclipse.swt.internal.gtk.*; public class ButtonDrawData extends DrawData { - + public ButtonDrawData() { state = new int[1]; } @@ -30,7 +29,7 @@ int /*long*/ drawable = gc.getGCData().drawable; if ((style & SWT.RADIO) != 0) { int /*long*/ radioButtonHandle = theme.radioButtonHandle; - int /*long*/ gtkStyle = OS.gtk_widget_get_style (radioButtonHandle); + int /*long*/ gtkStyle = gtk_widget_get_style (radioButtonHandle); theme.transferClipping (gc, gtkStyle); int indicator_size = theme.getWidgetProperty(radioButtonHandle, "indicator-size"); int indicator_spacing = theme.getWidgetProperty(radioButtonHandle, "indicator-spacing"); @@ -38,14 +37,14 @@ int focus_line_width = theme.getWidgetProperty(radioButtonHandle, "focus-line-width"); int focus_padding = theme.getWidgetProperty(radioButtonHandle, "focus-padding"); int border_width = OS.gtk_container_get_border_width(radioButtonHandle); - + int x = bounds.x + indicator_spacing + border_width; int y = bounds.y + (bounds.height - indicator_size) / 2; - + if (interior_focus == 0) { x += focus_line_width + focus_padding; } - + int shadow_type; if ((state & DrawData.GRAYED) != 0) { shadow_type = OS.GTK_SHADOW_ETCHED_IN; @@ -54,7 +53,7 @@ } else { shadow_type = OS.GTK_SHADOW_OUT; } - + byte[] detail = Converter.wcsToMbcs(null, "radiobutton", true); if ((state & DrawData.HOT) != 0) { int prelight_x, prelight_y, prelight_width, prelight_height; @@ -74,7 +73,7 @@ } return; } - + if ((style & SWT.CHECK) != 0) { int /*long*/ checkButtonHandle = theme.checkButtonHandle; int /*long*/ gtkStyle = OS.gtk_widget_get_style (checkButtonHandle); @@ -85,14 +84,14 @@ int focus_line_width = theme.getWidgetProperty(checkButtonHandle, "focus-line-width"); int focus_padding = theme.getWidgetProperty(checkButtonHandle, "focus-padding"); int border_width = OS.gtk_container_get_border_width(checkButtonHandle); - + int x = bounds.x + indicator_spacing + border_width; int y = bounds.y + (bounds.height - indicator_size) / 2; - + if (interior_focus == 0) { x += focus_line_width + focus_padding; } - + int shadow_type; if ((state & DrawData.GRAYED) != 0) { shadow_type = OS.GTK_SHADOW_ETCHED_IN; @@ -101,7 +100,7 @@ } else { shadow_type = OS.GTK_SHADOW_OUT; } - + byte[] detail = Converter.wcsToMbcs(null, "checkbutton", true); if ((state & DrawData.HOT) != 0) { int prelight_x, prelight_y, prelight_width, prelight_height; @@ -121,16 +120,16 @@ } return; } - + if ((style & SWT.PUSH) != 0) { int /*long*/ buttonHandle = theme.buttonHandle; - int /*long*/ gtkStyle = OS.gtk_widget_get_style (buttonHandle); - theme.transferClipping (gc, gtkStyle); + int /*long*/ gtkStyle = gtk_widget_get_style (buttonHandle); + theme.transferClipping (gc, gtkStyle); int focus_line_width = theme.getWidgetProperty(buttonHandle, "focus-line-width"); int focus_padding = theme.getWidgetProperty(buttonHandle, "focus-padding"); int border_width = OS.gtk_container_get_border_width(buttonHandle); - + GtkBorder default_border = new GtkBorder(); int /*long*/ default_border_ptr = theme.getBorderProperty(buttonHandle, "default-border"); if (default_border_ptr != 0) { @@ -148,7 +147,7 @@ } else { default_outside_border.left = default_outside_border.right = default_outside_border.top = default_outside_border.bottom = 0; } - + int x = bounds.x + border_width; int y = bounds.y + border_width; int width = bounds.width - border_width * 2; @@ -176,13 +175,13 @@ if (relief != OS.GTK_RELIEF_NONE || ((state & (DrawData.PRESSED | DrawData.HOT)) != 0)) { gtk_render_box (gtkStyle, drawable, state_type, shadow_type, null, buttonHandle, detail, x, y, width, height); } - + if ((state & DrawData.FOCUSED) != 0) { int child_displacement_y = theme.getWidgetProperty(buttonHandle, "child-displacement-y"); int child_displacement_x = theme.getWidgetProperty(buttonHandle, "child-displacement-x"); - int displace_focus = theme.getWidgetProperty(buttonHandle, "displace-focus"); + int displace_focus = theme.getWidgetProperty(buttonHandle, "displace-focus"); int interior_focus = theme.getWidgetProperty(buttonHandle, "interior-focus"); - + if (interior_focus != 0) { int xthickness = OS.gtk_style_get_xthickness(gtkStyle); int ythickness = OS.gtk_style_get_ythickness(gtkStyle); @@ -196,12 +195,12 @@ width += 2 * (focus_line_width + focus_padding); height += 2 * (focus_line_width + focus_padding); } - + if ((state & DrawData.PRESSED) != 0 && displace_focus != 0) { x += child_displacement_x; y += child_displacement_y; } - + gtk_render_focus (gtkStyle, drawable, state_type, null, buttonHandle, detail, x, y, width, height); } if (clientArea != null) { @@ -221,10 +220,7 @@ void gtk_render_option (int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height) { if (OS.GTK3) { - int /*long*/ cairo = OS.gdk_cairo_create (window); - int /*long*/ context = OS.gtk_widget_get_style_context (style); - OS.gtk_render_option (context, cairo, x, y, width, height); - Cairo.cairo_destroy (cairo); + OS.gtk_render_option (style, window, x, y, width, height); } else { OS.gtk_paint_option (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); } @@ -232,10 +228,7 @@ void gtk_render_check(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, int /*long*/ widget, byte[] detail, int x , int y, int width, int height) { if (OS.GTK3) { - int /*long*/ cairo = OS.gdk_cairo_create (window); - int /*long*/ context = OS.gtk_widget_get_style_context (style); - OS.gtk_render_check (context, cairo, x, y, width, height); - Cairo.cairo_destroy (cairo); + OS.gtk_render_check (style, window, x, y, width, height); } else { OS.gtk_paint_check (style, window, state_type, shadow_type, null, widget, detail, x, y, width, height); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/ComboDrawData.java swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/ComboDrawData.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/ComboDrawData.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/ComboDrawData.java 2016-07-06 19:11:33.000000000 +0000 @@ -12,7 +12,6 @@ import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; -import org.eclipse.swt.internal.cairo.Cairo; import org.eclipse.swt.internal.gtk.*; public class ComboDrawData extends DrawData { @@ -27,10 +26,10 @@ @Override void draw(Theme theme, GC gc, Rectangle bounds) { int /*long*/ buttonHandle = theme.buttonHandle; - int /*long*/ gtkStyle = OS.gtk_widget_get_style(buttonHandle); + int /*long*/ gtkStyle = gtk_widget_get_style(buttonHandle); int /*long*/ drawable = gc.getGCData().drawable; theme.transferClipping(gc, gtkStyle); - + int x = bounds.x; int y = bounds.y ; int width = bounds.width; @@ -39,7 +38,7 @@ int shadow_type = OS.GTK_SHADOW_OUT; if ((state[DrawData.COMBO_ARROW] & DrawData.PRESSED) != 0) shadow_type = OS.GTK_SHADOW_IN; int state_type = getStateType(DrawData.COMBO_ARROW); - + int relief = OS.gtk_button_get_relief(buttonHandle); int interior_focus = theme.getWidgetProperty(buttonHandle, "interior-focus"); int focus_line_width = theme.getWidgetProperty(buttonHandle, "focus-line-width"); @@ -54,20 +53,20 @@ x_border += focus_line_width; //y_border += focus_line_width; } - int arrow_button_width = arrow_width + x_border * 2; + int arrow_button_width = arrow_width + x_border * 2; int arrow_button_x = x + width - arrow_button_width; int arrow_x = arrow_button_x + (arrow_button_width - arrow_width) / 2; int arrow_y = y + (height - arrow_height) / 2 + 1; if (relief != OS.GTK_RELIEF_NONE || ((state[DrawData.COMBO_ARROW] & (DrawData.PRESSED | DrawData.HOT)) != 0)) { byte[] detail = Converter.wcsToMbcs(null, "button", true); gtk_render_box (gtkStyle, drawable, state_type, shadow_type, null, buttonHandle, detail, arrow_button_x, y, arrow_button_width, height); - } + } byte[] arrow_detail = Converter.wcsToMbcs(null, "arrow", true); int /*long*/ arrowHandle = theme.arrowHandle; gtk_render_arrow (gtkStyle, drawable, state_type, OS.GTK_SHADOW_OUT, null, arrowHandle, arrow_detail, OS.GTK_ARROW_DOWN, true, arrow_x, arrow_y, arrow_width, arrow_height); - + int /*long*/ entryHandle = theme.entryHandle; - gtkStyle = OS.gtk_widget_get_style(entryHandle); + gtkStyle = gtk_widget_get_style(entryHandle); theme.transferClipping(gc, gtkStyle); state_type = getStateType(DrawData.WIDGET_WHOLE); byte[] detail = Converter.wcsToMbcs(null, "entry", true); @@ -80,13 +79,13 @@ height -= 2 * ythickness; detail = Converter.wcsToMbcs(null, "entry_bg", true); gtk_render_frame (gtkStyle, drawable, state_type, OS.GTK_SHADOW_NONE, null, entryHandle, detail, x, y, width - arrow_button_width, height); - + if (clientArea != null) { clientArea.x = x; clientArea.y = y; clientArea.width = width - arrow_button_width; clientArea.height = height; - } + } } @Override @@ -105,7 +104,7 @@ int hit(Theme theme, Point position, Rectangle bounds) { if (!bounds.contains(position)) return DrawData.WIDGET_NOWHERE; int /*long*/ buttonHandle = theme.buttonHandle; - int /*long*/ gtkStyle = OS.gtk_widget_get_style(buttonHandle); + int /*long*/ gtkStyle = gtk_widget_get_style(buttonHandle); int interior_focus = theme.getWidgetProperty(buttonHandle, "interior-focus"); int focus_line_width = theme.getWidgetProperty(buttonHandle, "focus-line-width"); int focus_padding = theme.getWidgetProperty(buttonHandle, "focus-padding"); @@ -118,7 +117,7 @@ x_border += focus_line_width; //y_border += focus_line_width; } - int arrow_button_width = arrow_width + x_border * 2; + int arrow_button_width = arrow_width + x_border * 2; int arrow_button_x = bounds.x + bounds.width - arrow_button_width; Rectangle arrowRect = new Rectangle(arrow_button_x, bounds.y, arrow_button_width, bounds.height); @@ -128,12 +127,9 @@ void gtk_render_shadow(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height) { if (OS.GTK3) { - int /*long*/ cairo = OS.gdk_cairo_create (window); - int /*long*/ context = OS.gtk_widget_get_style_context (style); - OS.gtk_style_context_save(context); + OS.gtk_style_context_save(style); OS.gtk_style_context_set_state (style, state_type); - OS.gtk_render_frame (context, cairo, x, y, width, height); - Cairo.cairo_destroy (cairo); + OS.gtk_render_frame (style, window, x, y, width, height); } else { OS.gtk_paint_shadow(style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/DrawData.java swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/DrawData.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/DrawData.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/DrawData.java 2016-07-06 19:11:33.000000000 +0000 @@ -12,7 +12,7 @@ import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; -import org.eclipse.swt.internal.cairo.Cairo; +import org.eclipse.swt.internal.cairo.*; import org.eclipse.swt.internal.gtk.*; public class DrawData { @@ -29,7 +29,7 @@ public static final int HOT = 1 << 6; public static final int DEFAULTED = 1 << 7; public static final int GRAYED = 1 << 8; - + /** Text and Image drawing flags */ public static final int DRAW_LEFT = 1 << 4; public static final int DRAW_TOP = 1 << 5; @@ -52,20 +52,20 @@ public static final int SCROLLBAR_LEFT_TRACK = SCROLLBAR_UP_TRACK; public static final int SCROLLBAR_RIGHT_TRACK = SCROLLBAR_DOWN_TRACK; public static final int SCROLLBAR_THUMB = 5; - + /** Scale parts */ public static final int SCALE_UP_TRACK = 1; public static final int SCALE_LEFT_TRACK = SCALE_UP_TRACK; public static final int SCALE_DOWN_TRACK = 2; public static final int SCALE_RIGHT_TRACK = SCALE_DOWN_TRACK; public static final int SCALE_THUMB = 3; - + /** ToolItem parts */ public static final int TOOLITEM_ARROW = 1; - + /** Combo parts */ public static final int COMBO_ARROW = 1; - + public DrawData() { state = new int[1]; @@ -76,7 +76,7 @@ } void draw(Theme theme, GC gc, Rectangle bounds) { - + } void drawImage(Theme theme, Image image, GC gc, Rectangle bounds) { @@ -92,7 +92,7 @@ OS.gtk_icon_source_set_pixbuf(source, pixbuf); //TODO - always uses buttonHandle int /*long*/ buttonHandle = theme.buttonHandle; - int /*long*/ gtkStyle = OS.gtk_widget_get_style (buttonHandle); + int /*long*/ gtkStyle = gtk_widget_get_style (buttonHandle); theme.transferClipping(gc, gtkStyle); int /*long*/ rendered = OS.gtk_style_render_icon(gtkStyle, source, OS.GTK_TEXT_DIR_NONE, state_type, -1, buttonHandle, null); OS.g_object_unref(pixbuf); @@ -116,7 +116,7 @@ void drawText(Theme theme, String text, int flags, GC gc, Rectangle bounds) { int /*long*/ widget = getTextHandle(theme); - int /*long*/ gtkStyle = OS.gtk_widget_get_style(widget); + int /*long*/ gtkStyle = gtk_widget_get_style(widget); int /*long*/ drawable = gc.getGCData().drawable; theme.transferClipping (gc, gtkStyle); byte[] buffer = Converter.wcsToMbcs(null, text, true); @@ -159,7 +159,7 @@ } else { if ((state & DrawData.SELECTED) != 0) state_type = OS.GTK_STATE_ACTIVE; if ((state & DrawData.HOT) != 0) { - if ((state & DrawData.PRESSED) != 0) { + if ((state & DrawData.PRESSED) != 0) { state_type = OS.GTK_STATE_ACTIVE; } else { state_type = OS.GTK_STATE_PRELIGHT; @@ -199,10 +199,7 @@ void gtk_render_frame (int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height) { if (OS.GTK3) { - int /*long*/ cairo = OS.gdk_cairo_create (window); - int /*long*/ context = OS.gtk_widget_get_style_context (style); - OS.gtk_render_frame (context, cairo, x, y, width, height); - Cairo.cairo_destroy (cairo); + OS.gtk_render_frame (style, window, x, y, width, height); } else { OS.gtk_paint_flat_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); } @@ -210,11 +207,8 @@ void gtk_render_box (int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height) { if (OS.GTK3) { - int /*long*/ cairo = OS.gdk_cairo_create (window); - int /*long*/ context = OS.gtk_widget_get_style_context (style); - OS.gtk_render_frame (context, cairo, x, y, width, height); - OS.gtk_render_background (context, cairo, x, y, width, height); - Cairo.cairo_destroy (cairo); + OS.gtk_render_frame (style, window, x, y, width, height); + OS.gtk_render_background (style, window, x, y, width, height); } else { OS.gtk_paint_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); } @@ -223,10 +217,7 @@ void gtk_render_layout (int /*long*/ style, int /*long*/ window, int state_type, boolean use_text, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int /*long*/ layout) { if (OS.GTK3) { - int /*long*/ cairo = OS.gdk_cairo_create (window); - int /*long*/ context = OS.gtk_widget_get_style_context (style); - OS.gtk_render_layout (context, cairo, x, y, layout); - Cairo.cairo_destroy (cairo); + OS.gtk_render_layout (style, window, x, y, layout); } else { OS.gtk_paint_layout (style, window, state_type, use_text, area, widget, detail, x , y, layout); } @@ -234,16 +225,13 @@ void gtk_render_focus (int /*long*/ style, int /*long*/ window, int state_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height) { if (OS.GTK3) { - int /*long*/ cairo = OS.gdk_cairo_create (window); - int /*long*/ context = OS.gtk_widget_get_style_context (style); - OS.gtk_style_context_save (context); - OS.gtk_style_context_set_state (context, OS.gtk_widget_get_state_flags (widget)); - Cairo.cairo_save (cairo); - OS.gtk_render_focus(context, cairo, x, y, width, height); - Cairo.cairo_restore (cairo); - OS.gtk_style_context_restore (context); - Cairo.cairo_destroy (cairo); - + OS.gtk_style_context_save (style); + OS.gtk_style_context_set_state (style, OS.gtk_widget_get_state_flags (widget)); + Cairo.cairo_save (window); + OS.gtk_render_focus(style, window, x, y, width, height); + Cairo.cairo_restore (window); + OS.gtk_style_context_restore (style); + } else { OS.gtk_paint_focus (style, window, state_type, area, widget, detail, x, y, width, height); } @@ -271,16 +259,18 @@ size = height; break; } - int /*long*/ cairo = OS.gdk_cairo_create (window); - int /*long*/ context = OS.gtk_widget_get_style_context (style); - OS.gtk_style_context_set_state(context, state_type); - OS.gtk_render_background(context, cairo, x, y, width, height); - OS.gtk_render_frame (context, cairo, x, y, width, height); - OS.gtk_render_arrow(context, cairo, angle, x, y, size); - Cairo.cairo_destroy(cairo); + OS.gtk_style_context_set_state(style, state_type); + OS.gtk_render_background(style, window, x, y, width, height); + OS.gtk_render_frame (style, window, x, y, width, height); + OS.gtk_render_arrow(style, window, angle, x, y, size); } else { OS.gtk_paint_arrow(style, window, state_type, shadow_type, area, widget, detail, arrow_type, fill, x, y, width, height); } } +int /*long*/ gtk_widget_get_style(int /*long*/ handle) { + return OS.GTK3 ? OS.gtk_widget_get_style_context(handle) : OS.gtk_widget_get_style(handle); +} + + } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/ExpanderDrawData.java swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/ExpanderDrawData.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/ExpanderDrawData.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/ExpanderDrawData.java 2016-07-06 19:11:33.000000000 +0000 @@ -13,11 +13,10 @@ import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; -import org.eclipse.swt.internal.cairo.Cairo; import org.eclipse.swt.internal.gtk.*; public class ExpanderDrawData extends DrawData { - + public ExpanderDrawData() { state = new int[1]; } @@ -25,8 +24,8 @@ @Override void draw(Theme theme, GC gc, Rectangle bounds) { int /*long*/ treeHandle = theme.treeHandle; - int /*long*/ gtkStyle = OS.gtk_widget_get_style (treeHandle); - int /*long*/ drawable = gc.getGCData().drawable; + int /*long*/ gtkStyle = gtk_widget_get_style (treeHandle); + int /*long*/ drawable = OS.GTK3 ? gc.getGCData().cairo : gc.getGCData().drawable; theme.transferClipping(gc, gtkStyle); int state_type = getStateType(DrawData.WIDGET_WHOLE); int expander_style = OS.GTK_EXPANDER_COLAPSED; @@ -36,12 +35,9 @@ int x = bounds.x + expander_size / 2; int y = bounds.y + expander_size / 2; if (OS.GTK3) { - int /*long*/ cairo = OS.gdk_cairo_create (drawable); - int /*long*/ context = OS.gtk_widget_get_style_context (gtkStyle); - OS.gtk_render_expander (context, cairo, bounds.x, bounds.y, expander_size, expander_size); - Cairo.cairo_destroy (cairo); + OS.gtk_render_expander (gtkStyle, drawable, bounds.x, bounds.y, expander_size, expander_size); } else { - OS.gtk_paint_expander(gtkStyle, drawable, state_type, null, treeHandle, detail, x, y, expander_style); + OS.gtk_paint_expander(gtkStyle, drawable, state_type, null, treeHandle, detail, x, y, expander_style); } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/GroupDrawData.java swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/GroupDrawData.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/GroupDrawData.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/GroupDrawData.java 2016-07-06 19:11:33.000000000 +0000 @@ -12,17 +12,16 @@ import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; -import org.eclipse.swt.internal.cairo.Cairo; import org.eclipse.swt.internal.gtk.*; public class GroupDrawData extends DrawData { public int headerWidth; public int headerHeight; public Rectangle headerArea; - + static final int GROUP_X = 2; static final int GROUP_PAD = 1; - + public GroupDrawData() { state = new int[1]; } @@ -32,8 +31,8 @@ @Override void draw(Theme theme, GC gc, Rectangle bounds) { int /*long*/ frameHandle = theme.frameHandle; - int /*long*/ gtkStyle = OS.gtk_widget_get_style (frameHandle); - int /*long*/ drawable = gc.getGCData().drawable; + int /*long*/ gtkStyle = gtk_widget_get_style (frameHandle); + int /*long*/ drawable = OS.GTK3 ? gc.getGCData().cairo : gc.getGCData().drawable; theme.transferClipping(gc, gtkStyle); int xthickness = OS.gtk_style_get_xthickness(gtkStyle); int ythickness = OS.gtk_style_get_ythickness(gtkStyle); @@ -71,12 +70,9 @@ void gtk_render_shadow_gap (int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height, int gap_side, int gap_x, int gap_width) { if (OS.GTK3) { - int /*long*/ cairo = OS.gdk_cairo_create (window); - int /*long*/ context = OS.gtk_widget_get_style_context (style); - OS.gtk_style_context_save (context); - OS.gtk_style_context_set_state (context, state_type); - OS.gtk_render_frame_gap (context, cairo, context, y, gap_width, height, gap_side, gap_x, gap_x + gap_width); - Cairo.cairo_destroy (cairo); + OS.gtk_style_context_save (style); + OS.gtk_style_context_set_state (style, state_type); + OS.gtk_render_frame_gap (style, window, style, y, gap_width, height, gap_side, gap_x, gap_x + gap_width); } else { OS.gtk_paint_shadow_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/ProgressBarDrawData.java swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/ProgressBarDrawData.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/ProgressBarDrawData.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/ProgressBarDrawData.java 2016-07-06 19:11:33.000000000 +0000 @@ -24,7 +24,7 @@ @Override void draw(Theme theme, GC gc, Rectangle bounds) { int /*long*/ progressHandle = theme.progressHandle; - int /*long*/ gtkStyle = OS.gtk_widget_get_style (progressHandle); + int /*long*/ gtkStyle = gtk_widget_get_style (progressHandle); int /*long*/ drawable = gc.getGCData().drawable; theme.transferClipping(gc, gtkStyle); byte[] detail = Converter.wcsToMbcs(null, "trough", true); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/ScaleDrawData.java swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/ScaleDrawData.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/ScaleDrawData.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/ScaleDrawData.java 2016-07-06 19:11:33.000000000 +0000 @@ -15,14 +15,14 @@ public class ScaleDrawData extends RangeDrawData { public int increment; public int pageIncrement; - + public ScaleDrawData() { state = new int[4]; } @Override void draw(Theme theme, GC gc, Rectangle bounds) { - + } @Override diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/ScrollBarDrawData.java swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/ScrollBarDrawData.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/ScrollBarDrawData.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/ScrollBarDrawData.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,7 +16,7 @@ public int thumb; public int increment; public int pageIncrement; - + public ScrollBarDrawData() { state = new int[6]; } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/TabFolderDrawData.java swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/TabFolderDrawData.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/TabFolderDrawData.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/TabFolderDrawData.java 2016-07-06 19:11:33.000000000 +0000 @@ -10,10 +10,9 @@ *******************************************************************************/ package org.eclipse.swt.internal.theme; -import org.eclipse.swt.SWT; +import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; -import org.eclipse.swt.internal.cairo.Cairo; import org.eclipse.swt.internal.gtk.*; public class TabFolderDrawData extends DrawData { @@ -23,7 +22,7 @@ public int selectedX; public int selectedWidth; public int spacing; - + public TabFolderDrawData() { state = new int[1]; if (SWT.getPlatform().equals("gtk")) { @@ -34,8 +33,8 @@ @Override void draw(Theme theme, GC gc, Rectangle bounds) { int /*long*/ notebookHandle = theme.notebookHandle; - int /*long*/ gtkStyle = OS.gtk_widget_get_style (notebookHandle); - int /*long*/ drawable = gc.getGCData().drawable; + int /*long*/ gtkStyle = gtk_widget_get_style (notebookHandle); + int /*long*/ drawable = OS.GTK3 ? gc.getGCData().cairo : gc.getGCData().drawable; theme.transferClipping(gc, gtkStyle); int x = bounds.x, y = bounds.y, width = bounds.width, height = bounds.height; height -= tabsHeight; @@ -70,10 +69,7 @@ void gtk_render_frame_gap (int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height, int gap_side, int gap_x, int gap_width) { if (OS.GTK3) { - int /*long*/ cairo = OS.gdk_cairo_create (window); - int /*long*/ context = OS.gtk_widget_get_style_context (style); - OS.gtk_render_frame_gap (context, cairo, context, y, gap_width, height, gap_side, gap_x, gap_x + gap_width); - Cairo.cairo_destroy (cairo); + OS.gtk_render_frame_gap (style, window, style, y, gap_width, height, gap_side, gap_x, gap_x + gap_width); } else { OS.gtk_paint_box_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/TabItemDrawData.java swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/TabItemDrawData.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/TabItemDrawData.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/TabItemDrawData.java 2016-07-06 19:11:33.000000000 +0000 @@ -10,14 +10,13 @@ *******************************************************************************/ package org.eclipse.swt.internal.theme; -import org.eclipse.swt.SWT; +import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; -import org.eclipse.swt.internal.cairo.Cairo; import org.eclipse.swt.internal.gtk.*; public class TabItemDrawData extends DrawData { - + public TabFolderDrawData parent; public int position; @@ -30,7 +29,7 @@ @Override Rectangle computeTrim(Theme theme, GC gc) { int /*long*/ notebookHandle = theme.notebookHandle; - int /*long*/ gtkStyle = OS.gtk_widget_get_style(notebookHandle); + int /*long*/ gtkStyle = gtk_widget_get_style(notebookHandle); int hborder = theme.getWidgetProperty(notebookHandle, "tab-hborder"); int vborder = theme.getWidgetProperty(notebookHandle, "tab-vborder"); int focus_width = theme.getWidgetProperty(notebookHandle, "focus-line-width"); @@ -48,8 +47,8 @@ @Override void draw(Theme theme, GC gc, Rectangle bounds) { int /*long*/ notebookHandle = theme.notebookHandle; - int /*long*/ gtkStyle = OS.gtk_widget_get_style (notebookHandle); - int /*long*/ drawable = gc.getGCData().drawable; + int /*long*/ gtkStyle = gtk_widget_get_style (notebookHandle); + int /*long*/ drawable = OS.GTK3 ? gc.getGCData().cairo : gc.getGCData().drawable; theme.transferClipping(gc, gtkStyle); int x = bounds.x, y = bounds.y, width = bounds.width, height = bounds.height; if ((state[DrawData.WIDGET_WHOLE] & DrawData.SELECTED) == 0) { @@ -95,10 +94,7 @@ void gtk_render_extension(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height, int gap_side) { if (OS.GTK3) { - int /*long*/ cairo = OS.gdk_cairo_create (window); - int /*long*/ context = OS.gtk_widget_get_style_context (style); - OS.gtk_render_extension(context, cairo, x, y, width, height, gap_side); - Cairo.cairo_destroy (cairo); + OS.gtk_render_extension(style, window, x, y, width, height, gap_side); } else { OS.gtk_paint_extension (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/ToolBarDrawData.java swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/ToolBarDrawData.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/ToolBarDrawData.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/ToolBarDrawData.java 2016-07-06 19:11:33.000000000 +0000 @@ -15,7 +15,7 @@ import org.eclipse.swt.internal.gtk.*; public class ToolBarDrawData extends DrawData { - + public ToolBarDrawData() { state = new int[1]; } @@ -23,7 +23,7 @@ @Override void draw(Theme theme, GC gc, Rectangle bounds) { int /*long*/ toolbarHandle = theme.toolbarHandle; - int /*long*/ gtkStyle = OS.gtk_widget_get_style (toolbarHandle); + int /*long*/ gtkStyle = gtk_widget_get_style (toolbarHandle); int /*long*/ drawable = gc.getGCData().drawable; theme.transferClipping(gc, gtkStyle); int x = bounds.x, y = bounds.y, width = bounds.width, height = bounds.height; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/ToolItemDrawData.java swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/ToolItemDrawData.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/theme/ToolItemDrawData.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/theme/ToolItemDrawData.java 2016-07-06 19:11:33.000000000 +0000 @@ -13,7 +13,6 @@ import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; -import org.eclipse.swt.internal.cairo.Cairo; import org.eclipse.swt.internal.gtk.*; public class ToolItemDrawData extends DrawData { @@ -30,7 +29,7 @@ @Override Rectangle computeTrim(Theme theme, GC gc) { int /*long*/ buttonHandle = theme.buttonHandle; - int /*long*/ gtkStyle = OS.gtk_widget_get_style(buttonHandle); + int /*long*/ gtkStyle = gtk_widget_get_style(buttonHandle); int focus_width = theme.getWidgetProperty(buttonHandle, "focus-line-width"); int focus_padding = theme.getWidgetProperty(buttonHandle, "focus-padding"); int xthickness = OS.gtk_style_get_xthickness(gtkStyle); @@ -50,29 +49,23 @@ @Override void draw(Theme theme, GC gc, Rectangle bounds) { int state = this.state[DrawData.WIDGET_WHOLE]; - int /*long*/ drawable = gc.getGCData().drawable; + int /*long*/ drawable = OS.GTK3 ? gc.getGCData().cairo : gc.getGCData().drawable; if ((style & SWT.SEPARATOR) != 0) { int state_type = getStateType(DrawData.WIDGET_WHOLE); int /*long*/ separatorHandle = theme.separatorHandle; byte[] detail = Converter.wcsToMbcs(null, "vseparator", true); - int /*long*/ gtkStyle = OS.gtk_widget_get_style (separatorHandle); + int /*long*/ gtkStyle = gtk_widget_get_style (separatorHandle); theme.transferClipping(gc, gtkStyle); if ((parent.style & SWT.VERTICAL) != 0) { if (OS.GTK3) { - int /*long*/ cairo = OS.gdk_cairo_create (drawable); - int /*long*/ context = OS.gtk_widget_get_style_context (separatorHandle); - OS.gtk_render_line (context, cairo, bounds.x, bounds.y + bounds.height / 2, bounds.x + bounds.width, bounds.y + bounds.height / 2); - Cairo.cairo_destroy(cairo); + OS.gtk_render_line (gtkStyle, drawable, bounds.x, bounds.y + bounds.height / 2, bounds.x + bounds.width, bounds.y + bounds.height / 2); } else { OS.gtk_paint_hline(gtkStyle, drawable, state_type, null, separatorHandle, detail, bounds.x, bounds.x + bounds.width, bounds.y + bounds.height / 2); - } + } } else { if (OS.GTK3) { - int /*long*/ cairo = OS.gdk_cairo_create (drawable); - int /*long*/ context = OS.gtk_widget_get_style_context (separatorHandle); - OS.gtk_render_line (context, cairo, bounds.x + bounds.width / 2, bounds.y, bounds.x + bounds.width / 2, bounds.y + bounds.height); - Cairo.cairo_destroy (cairo); + OS.gtk_render_line (gtkStyle, drawable, bounds.x + bounds.width / 2, bounds.y, bounds.x + bounds.width / 2, bounds.y + bounds.height); } else { OS.gtk_paint_vline(gtkStyle, drawable, state_type, null, separatorHandle, detail, bounds.y, bounds.y + bounds.height, bounds.x + bounds.width / 2); } @@ -81,7 +74,7 @@ } int /*long*/ buttonHandle = theme.buttonHandle; - int /*long*/ gtkStyle = OS.gtk_widget_get_style (buttonHandle); + int /*long*/ gtkStyle = gtk_widget_get_style (buttonHandle); theme.transferClipping (gc, gtkStyle); int focus_line_width = theme.getWidgetProperty(buttonHandle, "focus-line-width"); int focus_padding = theme.getWidgetProperty(buttonHandle, "focus-padding"); @@ -98,7 +91,7 @@ } else if ((style & (SWT.CHECK | SWT.RADIO)) != 0) { detail = Converter.wcsToMbcs(null, "togglebutton", true); } - + int[] relief = new int[1]; int /*long*/ toolbarHandle = theme.toolbarHandle; OS.gtk_widget_style_get(toolbarHandle, OS.button_relief, relief, 0); @@ -106,7 +99,7 @@ int shadow_type = OS.GTK_SHADOW_OUT; if ((state & (DrawData.SELECTED | DrawData.PRESSED)) != 0) shadow_type = OS.GTK_SHADOW_IN; int state_type = getStateType(DrawData.WIDGET_WHOLE); - + if (relief[0] != OS.GTK_RELIEF_NONE || ((state & (DrawData.PRESSED | DrawData.HOT | DrawData.SELECTED)) != 0)) { gtk_render_box(gtkStyle, drawable, state_type, shadow_type, null, buttonHandle, detail, x, y, width, height); } @@ -137,7 +130,7 @@ int child_displacement_y = theme.getWidgetProperty(buttonHandle, "child-displacement-y"); int child_displacement_x = theme.getWidgetProperty(buttonHandle, "child-displacement-x"); int displace_focus = theme.getWidgetProperty(buttonHandle, "displace-focus"); - + if (interior_focus != 0) { int ythickness = OS.gtk_style_get_ythickness(gtkStyle); x += xthickness + focus_padding; @@ -150,12 +143,12 @@ width += 2 * (focus_line_width + focus_padding); height += 2 * (focus_line_width + focus_padding); } - + if ((state & (DrawData.PRESSED | DrawData.SELECTED)) != 0 && displace_focus != 0) { x += child_displacement_x; y += child_displacement_y; } - + gtk_render_focus (gtkStyle, drawable, state_type, null, buttonHandle, detail, x, y, width, height); } } @@ -165,7 +158,7 @@ if (!bounds.contains(position)) return DrawData.WIDGET_NOWHERE; if ((style & SWT.DROP_DOWN) != 0) { int /*long*/ buttonHandle = theme.buttonHandle; - int /*long*/ gtkStyle = OS.gtk_widget_get_style (buttonHandle); + int /*long*/ gtkStyle = gtk_widget_get_style (buttonHandle); int xthickness = OS.gtk_style_get_xthickness(gtkStyle); int interior_focus = theme.getWidgetProperty(buttonHandle, "interior-focus"); int focus_line_width = theme.getWidgetProperty(buttonHandle, "focus-line-width"); @@ -175,7 +168,7 @@ if (interior_focus == 0) arrow_x -= focus_line_width; if (arrow_x <= position.x) return DrawData.TOOLITEM_ARROW; } - return DrawData.WIDGET_WHOLE; + return DrawData.WIDGET_WHOLE; } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/internal/webkit/JSClassDefinition.java swt4-gtk-4.6.0/org/eclipse/swt/internal/webkit/JSClassDefinition.java --- swt4-gtk-4.5.0/org/eclipse/swt/internal/webkit/JSClassDefinition.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/internal/webkit/JSClassDefinition.java 2016-07-06 19:11:33.000000000 +0000 @@ -48,6 +48,6 @@ public int /*long*/ hasInstance; /** @field cast=(void*) */ public int /*long*/ convertToType; - + public static final int sizeof = WebKitGTK.JSClassDefinition_sizeof(); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/layout/FillData.java swt4-gtk-4.6.0/org/eclipse/swt/layout/FillData.java --- swt4-gtk-4.5.0/org/eclipse/swt/layout/FillData.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/layout/FillData.java 2016-07-06 19:11:33.000000000 +0000 @@ -18,7 +18,7 @@ int defaultWidth = -1, defaultHeight = -1; int currentWhint, currentHhint, currentWidth = -1, currentHeight = -1; - + Point computeSize (Control control, int wHint, int hHint, boolean flushCache) { if (flushCache) flushCache(); if (wHint == SWT.DEFAULT && hHint == SWT.DEFAULT) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/layout/FillLayout.java swt4-gtk-4.6.0/org/eclipse/swt/layout/FillLayout.java --- swt4-gtk-4.5.0/org/eclipse/swt/layout/FillLayout.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/layout/FillLayout.java 2016-07-06 19:11:33.000000000 +0000 @@ -15,22 +15,22 @@ import org.eclipse.swt.widgets.*; /** - * <code>FillLayout</code> is the simplest layout class. It lays out - * controls in a single row or column, forcing them to be the same size. + * <code>FillLayout</code> is the simplest layout class. It lays out + * controls in a single row or column, forcing them to be the same size. * <p> - * Initially, the controls will all be as tall as the tallest control, - * and as wide as the widest. <code>FillLayout</code> does not wrap, - * but you can specify margins and spacing. You might use it to - * lay out buttons in a task bar or tool bar, or to stack checkboxes - * in a <code>Group</code>. <code>FillLayout</code> can also be used - * when a <code>Composite</code> only has one child. For example, - * if a <code>Shell</code> has a single <code>Group</code> child, - * <code>FillLayout</code> will cause the <code>Group</code> to + * Initially, the controls will all be as tall as the tallest control, + * and as wide as the widest. <code>FillLayout</code> does not wrap, + * but you can specify margins and spacing. You might use it to + * lay out buttons in a task bar or tool bar, or to stack checkboxes + * in a <code>Group</code>. <code>FillLayout</code> can also be used + * when a <code>Composite</code> only has one child. For example, + * if a <code>Shell</code> has a single <code>Group</code> child, + * <code>FillLayout</code> will cause the <code>Group</code> to * completely fill the <code>Shell</code> (if margins are 0). * </p> * <p> * Example code: first a <code>FillLayout</code> is created and - * its type field is set, and then the layout is set into the + * its type field is set, and then the layout is set into the * <code>Composite</code>. Note that in a <code>FillLayout</code>, * children are always the same size, and they fill all available space. * <pre> @@ -45,7 +45,7 @@ */ public final class FillLayout extends Layout { /** - * type specifies how controls will be positioned + * type specifies how controls will be positioned * within the layout. * * The default value is HORIZONTAL. @@ -56,37 +56,37 @@ * </ul> */ public int type = SWT.HORIZONTAL; - + /** * marginWidth specifies the number of pixels of horizontal margin * that will be placed along the left and right edges of the layout. * * The default value is 0. - * + * * @since 3.0 */ public int marginWidth = 0; - + /** * marginHeight specifies the number of pixels of vertical margin * that will be placed along the top and bottom edges of the layout. * * The default value is 0. - * + * * @since 3.0 */ public int marginHeight = 0; - + /** * spacing specifies the number of pixels between the edge of one cell * and the edge of its neighbouring cell. * * The default value is 0. - * + * * @since 3.0 */ public int spacing = 0; - + /** * Constructs a new instance of this class. */ @@ -97,7 +97,7 @@ * Constructs a new instance of this class given the type. * * @param type the type of fill layout - * + * * @since 2.0 */ public FillLayout (int type) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/layout/FormAttachment.java swt4-gtk-4.6.0/org/eclipse/swt/layout/FormAttachment.java --- swt4-gtk-4.5.0/org/eclipse/swt/layout/FormAttachment.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/layout/FormAttachment.java 2016-07-06 19:11:33.000000000 +0000 @@ -15,7 +15,7 @@ /** * Instances of this class are used to define the edges of a control - * within a <code>FormLayout</code>. + * within a <code>FormLayout</code>. * <p> * <code>FormAttachments</code> are set into the top, bottom, left, * and right fields of the <code>FormData</code> for a control. @@ -31,10 +31,10 @@ * </p> * <p> * A <code>FormAttachment</code> defines where to attach the side of - * a control by using the equation, y = ax + b. The "a" term represents + * a control by using the equation, y = ax + b. The "a" term represents * a fraction of the parent composite's width (from the left) or height * (from the top). It can be defined using a numerator and denominator, - * or just a percentage value. If a percentage is used, the denominator + * or just a percentage value. If a percentage is used, the denominator * is set to 100. The "b" term in the equation represents an offset, in * pixels, from the attachment position. For example: * <pre> @@ -50,8 +50,8 @@ * FormAttachment attach = new FormAttachment (button, 10); * </pre> * specifies that the side to which the <code>FormAttachment</code> - * object belongs will lie in the same position as the adjacent side of - * the <code>button</code> control, plus 10 pixels. The control side can + * object belongs will lie in the same position as the adjacent side of + * the <code>button</code> control, plus 10 pixels. The control side can * also be attached to the opposite side of the specified control. * For example: * <pre> @@ -59,8 +59,8 @@ * data.left = new FormAttachment (button, 0, SWT.LEFT); * </pre> * specifies that the left side of the control will lie in the same position - * as the left side of the <code>button</code> control. The control can also - * be attached in a position that will center the control on the specified + * as the left side of the <code>button</code> control. The control can also + * be attached in a position that will center the control on the specified * control. For example: * <pre> * data.left = new FormAttachment (button, 0, SWT.CENTER); @@ -69,11 +69,11 @@ * centered between the left and right sides of the <code>button</code> control. * If the alignment is not specified, the default is to attach to the adjacent side. * </p> - * + * * @see FormLayout * @see FormData * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 2.0 */ public final class FormAttachment { @@ -82,15 +82,15 @@ * equation, y = ax + b, which defines the attachment. */ public int numerator; - + /** * denominator specifies the denominator of the "a" term in the * equation, y = ax + b, which defines the attachment. - * + * * The default value is 100. */ public int denominator = 100; - + /** * offset specifies the offset, in pixels, of the control side * from the attachment position. @@ -98,27 +98,27 @@ * to the right of or below the attachment position. If it is * negative, then the control side is offset to the left of or * above the attachment position. - * + * * This is equivalent to the "b" term in the equation y = ax + b. * The default value is 0. */ public int offset; - + /** * control specifies the control to which the control side is * attached. */ public Control control; - + /** * alignment specifies the alignment of the control side that is * attached to a control. * <p> - * For top and bottom attachments, TOP, BOTTOM and CENTER are used. For left + * For top and bottom attachments, TOP, BOTTOM and CENTER are used. For left * and right attachments, LEFT, RIGHT and CENTER are used. If any other case * occurs, the default will be used instead. * </p> - * + * * <br>Possible values are: <ul> * <li>{@link SWT#TOP}: Attach the side to the top side of the specified control.</li> * <li>{@link SWT#BOTTOM}: Attach the side to the bottom side of the specified control.</li> @@ -136,7 +136,7 @@ * the attachment is treated as a percentage of the form. * The numerator is zero, the denominator is 100 and the * offset is zero. - * + * * @since 3.2 */ public FormAttachment () { @@ -145,11 +145,11 @@ /** * Constructs a new instance of this class given a numerator * Since no denominator or offset is specified, the default - * is to treat the numerator as a percentage of the form, with a + * is to treat the numerator as a percentage of the form, with a * denominator of 100. The offset is zero. - * + * * @param numerator the percentage of the position - * + * * @since 3.0 */ public FormAttachment (int numerator) { @@ -159,9 +159,9 @@ /** * Constructs a new instance of this class given a numerator * and an offset. Since no denominator is specified, the default - * is to treat the numerator as a percentage of the form, with a + * is to treat the numerator as a percentage of the form, with a * denominator of 100. - * + * * @param numerator the percentage of the position * @param offset the offset of the side from the position */ @@ -170,7 +170,7 @@ } /** - * Constructs a new instance of this class given a numerator + * Constructs a new instance of this class given a numerator * and denominator and an offset. The position of the side is * given by the fraction of the form defined by the numerator * and denominator. @@ -189,10 +189,10 @@ /** * Constructs a new instance of this class given a control. * Since no alignment is specified, the default alignment is - * to attach the side to the adjacent side of the specified + * to attach the side to the adjacent side of the specified * control. Since no offset is specified, an offset of 0 is * used. - * + * * @param control the control the side is attached to */ public FormAttachment (Control control) { @@ -202,9 +202,9 @@ /** * Constructs a new instance of this class given a control * and an offset. Since no alignment is specified, the default - * alignment is to attach the side to the adjacent side of the + * alignment is to attach the side to the adjacent side of the * specified control. - * + * * @param control the control the side is attached to * @param offset the offset of the side from the control */ @@ -229,7 +229,7 @@ * <dt><b>{@link SWT#DEFAULT}</b></dt> * <dd>the side will be attached to the adjacent side of the specified control</dd> * </dl> - * + * * @param control the control the side is attached to * @param offset the offset of the side from the control * @param alignment the alignment of the side to the control it is attached to, @@ -301,7 +301,7 @@ if (numerator == 0) SWT.error (SWT.ERROR_CANNOT_BE_ZERO); return (value - offset) * denominator / numerator; } - + /** * Returns a string containing a concise, human-readable * description of the receiver. diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/layout/FormData.java swt4-gtk-4.6.0/org/eclipse/swt/layout/FormData.java --- swt4-gtk-4.5.0/org/eclipse/swt/layout/FormData.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/layout/FormData.java 2016-07-06 19:11:33.000000000 +0000 @@ -10,17 +10,17 @@ *******************************************************************************/ package org.eclipse.swt.layout; - + import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*; /** - * Instances of this class are used to define the attachments - * of a control in a <code>FormLayout</code>. + * Instances of this class are used to define the attachments + * of a control in a <code>FormLayout</code>. * <p> - * To set a <code>FormData</code> object into a control, you use the - * <code>setLayoutData ()</code> method. To define attachments for the + * To set a <code>FormData</code> object into a control, you use the + * <code>setLayoutData ()</code> method. To define attachments for the * <code>FormData</code>, set the fields directly, like this: * <pre> * FormData data = new FormData(); @@ -30,23 +30,23 @@ * </pre> * </p> * <p> - * <code>FormData</code> contains the <code>FormAttachments</code> for + * <code>FormData</code> contains the <code>FormAttachments</code> for * each edge of the control that the <code>FormLayout</code> uses to * determine the size and position of the control. <code>FormData</code> * objects also allow you to set the width and height of controls within - * a <code>FormLayout</code>. + * a <code>FormLayout</code>. * </p> - * + * * @see FormLayout * @see FormAttachment * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 2.0 */ public final class FormData { /** * width specifies the preferred width in pixels. This value - * is the wHint passed into Control.computeSize(int, int, boolean) + * is the wHint passed into Control.computeSize(int, int, boolean) * to determine the preferred size of the control. * * The default value is SWT.DEFAULT. @@ -56,7 +56,7 @@ public int width = SWT.DEFAULT; /** * height specifies the preferred height in pixels. This value - * is the hHint passed into Control.computeSize(int, int, boolean) + * is the hHint passed into Control.computeSize(int, int, boolean) * to determine the preferred size of the control. * * The default value is SWT.DEFAULT. @@ -65,7 +65,7 @@ */ public int height = SWT.DEFAULT; /** - * left specifies the attachment of the left side of + * left specifies the attachment of the left side of * the control. */ public FormAttachment left; @@ -83,25 +83,25 @@ * control. */ public FormAttachment bottom; - + int cacheWidth = -1, cacheHeight = -1; int defaultWhint, defaultHhint, defaultWidth = -1, defaultHeight = -1; int currentWhint, currentHhint, currentWidth = -1, currentHeight = -1; FormAttachment cacheLeft, cacheRight, cacheTop, cacheBottom; boolean isVisited, needed; - + /** * Constructs a new instance of FormData using * default values. */ public FormData () { } - + /** * Constructs a new instance of FormData according to the parameters. * A value of SWT.DEFAULT indicates that no minimum width or * no minimum height is specified. - * + * * @param width a minimum width for the control * @param height a minimum height for the control */ @@ -174,7 +174,7 @@ FormData bottomData = (FormData) bottomControl.getLayoutData (); FormAttachment bottomAttachment = bottomData.getBottomAttachment (bottomControl, spacing, flushCache); switch (bottom.alignment) { - case SWT.BOTTOM: + case SWT.BOTTOM: cacheBottom = bottomAttachment.plus (bottom.offset); break; case SWT.CENTER: { @@ -185,7 +185,7 @@ } default: { FormAttachment topAttachment = bottomData.getTopAttachment (bottomControl, spacing, flushCache); - cacheBottom = topAttachment.plus (bottom.offset - spacing); + cacheBottom = topAttachment.plus (bottom.offset - spacing); break; } } @@ -226,13 +226,13 @@ } default: { FormAttachment rightAttachment = leftData.getRightAttachment (leftControl, spacing, flushCache); - cacheLeft = rightAttachment.plus (left.offset + spacing); + cacheLeft = rightAttachment.plus (left.offset + spacing); } } - isVisited = false; + isVisited = false; return cacheLeft; } - + String getName () { String string = getClass ().getName (); int index = string.lastIndexOf ('.'); @@ -262,7 +262,7 @@ FormData rightData = (FormData) rightControl.getLayoutData (); FormAttachment rightAttachment = rightData.getRightAttachment (rightControl, spacing, flushCache); switch (right.alignment) { - case SWT.RIGHT: + case SWT.RIGHT: cacheRight = rightAttachment.plus (right.offset); break; case SWT.CENTER: { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/layout/FormLayout.java swt4-gtk-4.6.0/org/eclipse/swt/layout/FormLayout.java --- swt4-gtk-4.5.0/org/eclipse/swt/layout/FormLayout.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/layout/FormLayout.java 2016-07-06 19:11:33.000000000 +0000 @@ -15,7 +15,7 @@ import org.eclipse.swt.widgets.*; /** - * Instances of this class control the position and size of the + * Instances of this class control the position and size of the * children of a composite control by using <code>FormAttachments</code> * to optionally configure the left, top, right and bottom edges of * each child. @@ -51,7 +51,7 @@ * </pre> * </p> * <p> - * Each side of a child control can be attached to a position in the parent + * Each side of a child control can be attached to a position in the parent * composite, or to other controls within the <code>Composite</code> by * creating instances of <code>FormAttachment</code> and setting them into * the top, bottom, left, and right fields of the child's <code>FormData</code>. @@ -77,17 +77,17 @@ * <code>button1</code>. This will over constrain the layout, causing undefined * behavior. The algorithm will terminate, but the results are undefined. * </p> - * + * * @see FormData * @see FormAttachment * @see <a href="http://www.eclipse.org/swt/snippets/#formlayout">FormLayout snippets</a> * @see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: LayoutExample</a> - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> + * * @since 2.0 */ public final class FormLayout extends Layout { - + /** * marginWidth specifies the number of pixels of horizontal margin * that will be placed along the left and right edges of the layout. @@ -95,7 +95,7 @@ * The default value is 0. */ public int marginWidth = 0; - + /** * marginHeight specifies the number of pixels of vertical margin * that will be placed along the top and bottom edges of the layout. @@ -103,14 +103,14 @@ * The default value is 0. */ public int marginHeight = 0; - + /** * marginLeft specifies the number of pixels of horizontal margin * that will be placed along the left edge of the layout. * * The default value is 0. - * + * * @since 3.1 */ public int marginLeft = 0; @@ -120,7 +120,7 @@ * that will be placed along the top edge of the layout. * * The default value is 0. - * + * * @since 3.1 */ public int marginTop = 0; @@ -130,7 +130,7 @@ * that will be placed along the right edge of the layout. * * The default value is 0. - * + * * @since 3.1 */ public int marginRight = 0; @@ -140,7 +140,7 @@ * that will be placed along the bottom edge of the layout. * * The default value is 0. - * + * * @since 3.1 */ public int marginBottom = 0; @@ -150,11 +150,11 @@ * and the edge of its neighbouring control. * * The default value is 0. - * + * * @since 3.0 */ public int spacing = 0; - + /** * Constructs a new instance of this class. */ @@ -164,28 +164,28 @@ /* * Computes the preferred height of the form with * respect to the preferred height of the control. - * + * * Given that the equations for top (T) and bottom (B) * of the control in terms of the height of the form (X) * are: * T = AX + B * B = CX + D - * + * * The equation for the height of the control (H) * is bottom (B) minus top (T) or (H = B - T) or: - * + * * H = (CX + D) - (AX + B) - * + * * Solving for (X), the height of the form, we get: - * + * * X = (H + B - D) / (C - A) - * + * * When (A = C), (C - A = 0) and the equation has no * solution for X. This is a special case meaning that * the control does not constrain the height of the * form. In this case, we need to arbitrarily define * the height of the form (X): - * + * * Case 1: A = C, A = 0, C = 0 * * Let X = D, the distance from the top of the form @@ -193,9 +193,9 @@ * the control was attached to the top of the form * and the form needs to be large enough to show the * bottom edge of the control. - * + * * Case 2: A = C, A = 1, C = 1 - * + * * Let X = -B, the distance from the bottom of the * form to the top edge of the control. In this case, * the control was attached to the bottom of the form @@ -204,21 +204,21 @@ * positive, there is no possible height for the form * that will show the control as it will always be * below the bottom edge of the form. - * + * * Case 3: A = C, A != 0, C != 0 and A != 1, C != 0 - * - * Let X = D / (1 - C), the distance from the top of the - * form to the bottom edge of the control. In this case, - * since C is not 0 or 1, it must be a fraction, U / V. - * The offset D is the distance from CX to the bottom edge - * of the control. This represents a fraction of the form - * (1 - C)X. Since the height of a fraction of the form is + * + * Let X = D / (1 - C), the distance from the top of the + * form to the bottom edge of the control. In this case, + * since C is not 0 or 1, it must be a fraction, U / V. + * The offset D is the distance from CX to the bottom edge + * of the control. This represents a fraction of the form + * (1 - C)X. Since the height of a fraction of the form is * known, the height of the entire form can be found by setting - * (1 - C)X = D. We solve this equation for X in terms of U - * and V, giving us X = (U * D) / (U - V). Similarly, if the + * (1 - C)X = D. We solve this equation for X in terms of U + * and V, giving us X = (U * D) / (U - V). Similarly, if the * offset D is negative, the control is positioned above CX. * The offset -B is the distance from the top edge of the control - * to CX. We can find the height of the entire form by setting + * to CX. We can find the height of the entire form by setting * CX = -B. Solving in terms of U and V gives us X = (-B * V) / U. */ int computeHeight (Control control, FormData data, boolean flushCache) { @@ -231,7 +231,7 @@ if (bottom.offset <= 0) { return -top.offset * top.denominator / bottom.numerator; } - int divider = bottom.denominator - bottom.numerator; + int divider = bottom.denominator - bottom.numerator; return bottom.denominator * bottom.offset / divider; } return height.solveY (data.getHeight (control, flushCache)); @@ -273,7 +273,7 @@ if (right.offset <= 0) { return -left.offset * left.denominator / left.numerator; } - int divider = right.denominator - right.numerator; + int divider = right.denominator - right.numerator; return right.denominator * right.offset / divider; } return width.solveY (data.getWidth (control, flushCache)); @@ -385,5 +385,5 @@ string = string.trim(); string += "}"; return string; -} +} } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/layout/GridData.java swt4-gtk-4.6.0/org/eclipse/swt/layout/GridData.java --- swt4-gtk-4.5.0/org/eclipse/swt/layout/GridData.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/layout/GridData.java 2016-07-06 19:11:33.000000000 +0000 @@ -15,18 +15,18 @@ import org.eclipse.swt.widgets.*; /** - * <code>GridData</code> is the layout data object associated with - * <code>GridLayout</code>. To set a <code>GridData</code> object into a - * control, you use the <code>Control.setLayoutData(Object)</code> method. + * <code>GridData</code> is the layout data object associated with + * <code>GridLayout</code>. To set a <code>GridData</code> object into a + * control, you use the <code>Control.setLayoutData(Object)</code> method. * <p> - * There are two ways to create a <code>GridData</code> object with certain + * There are two ways to create a <code>GridData</code> object with certain * fields set. The first is to set the fields directly, like this: * <pre> * GridData gridData = new GridData(); * gridData.horizontalAlignment = GridData.FILL; * gridData.grabExcessHorizontalSpace = true; * button1.setLayoutData(gridData); - * + * * gridData = new GridData(); * gridData.horizontalAlignment = GridData.FILL; * gridData.verticalAlignment = GridData.FILL; @@ -35,28 +35,28 @@ * gridData.horizontalSpan = 2; * button2.setLayoutData(gridData); * </pre> - * The second is to take advantage of <code>GridData</code> convenience constructors, for example: + * The second is to take advantage of <code>GridData</code> convenience constructors, for example: * <pre> * button1.setLayoutData(new GridData (SWT.FILL, SWT.CENTER, true, false)); * button2.setLayoutData(new GridData (SWT.FILL, SWT.FILL, true, true, 2, 1)); * </pre> * </p> * <p> - * NOTE: Do not reuse <code>GridData</code> objects. Every control in a + * NOTE: Do not reuse <code>GridData</code> objects. Every control in a * <code>Composite</code> that is managed by a <code>GridLayout</code> - * must have a unique <code>GridData</code> object. If the layout data - * for a control in a <code>GridLayout</code> is null at layout time, + * must have a unique <code>GridData</code> object. If the layout data + * for a control in a <code>GridLayout</code> is null at layout time, * a unique <code>GridData</code> object is created for it. * </p> - * + * * @see GridLayout * @see Control#setLayoutData * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public final class GridData { /** - * verticalAlignment specifies how controls will be positioned - * vertically within a cell. + * verticalAlignment specifies how controls will be positioned + * vertically within a cell. * * The default value is CENTER. * @@ -68,10 +68,10 @@ * </ul> */ public int verticalAlignment = CENTER; - + /** - * horizontalAlignment specifies how controls will be positioned - * horizontally within a cell. + * horizontalAlignment specifies how controls will be positioned + * horizontally within a cell. * * The default value is BEGINNING. * @@ -83,29 +83,29 @@ * </ul> */ public int horizontalAlignment = BEGINNING; - + /** * widthHint specifies the preferred width in pixels. This value - * is the wHint passed into Control.computeSize(int, int, boolean) + * is the wHint passed into Control.computeSize(int, int, boolean) * to determine the preferred size of the control. * * The default value is SWT.DEFAULT. - * + * * @see Control#computeSize(int, int, boolean) */ public int widthHint = SWT.DEFAULT; - + /** * heightHint specifies the preferred height in pixels. This value - * is the hHint passed into Control.computeSize(int, int, boolean) + * is the hHint passed into Control.computeSize(int, int, boolean) * to determine the preferred size of the control. * * The default value is SWT.DEFAULT. - * + * * @see Control#computeSize(int, int, boolean) */ public int heightHint = SWT.DEFAULT; - + /** * horizontalIndent specifies the number of pixels of indentation * that will be placed along the left side of the cell. @@ -113,17 +113,17 @@ * The default value is 0. */ public int horizontalIndent = 0; - + /** * verticalIndent specifies the number of pixels of indentation * that will be placed along the top side of the cell. * * The default value is 0. - * + * * @since 3.1 */ public int verticalIndent = 0; - + /** * horizontalSpan specifies the number of column cells that the control * will take up. @@ -131,7 +131,7 @@ * The default value is 1. */ public int horizontalSpan = 1; - + /** * verticalSpan specifies the number of row cells that the control * will take up. @@ -139,74 +139,74 @@ * The default value is 1. */ public int verticalSpan = 1; - + /** - * <p>grabExcessHorizontalSpace specifies whether the width of the cell - * changes depending on the size of the parent Composite. If + * <p>grabExcessHorizontalSpace specifies whether the width of the cell + * changes depending on the size of the parent Composite. If * grabExcessHorizontalSpace is <code>true</code>, the following rules * apply to the width of the cell:</p> * <ul> - * <li>If extra horizontal space is available in the parent, the cell will - * grow to be wider than its preferred width. The new width - * will be "preferred width + delta" where delta is the extra + * <li>If extra horizontal space is available in the parent, the cell will + * grow to be wider than its preferred width. The new width + * will be "preferred width + delta" where delta is the extra * horizontal space divided by the number of grabbing columns.</li> - * <li>If there is not enough horizontal space available in the parent, the - * cell will shrink until it reaches its minimum width as specified by - * GridData.minimumWidth. The new width will be the maximum of - * "minimumWidth" and "preferred width - delta", where delta is + * <li>If there is not enough horizontal space available in the parent, the + * cell will shrink until it reaches its minimum width as specified by + * GridData.minimumWidth. The new width will be the maximum of + * "minimumWidth" and "preferred width - delta", where delta is * the amount of space missing divided by the number of grabbing columns.</li> - * <li>If the parent is packed, the cell will be its preferred width + * <li>If the parent is packed, the cell will be its preferred width * as specified by GridData.widthHint.</li> - * <li>If the control spans multiple columns and there are no other grabbing + * <li>If the control spans multiple columns and there are no other grabbing * controls in any of the spanned columns, the last column in the span will * grab the extra space. If there is at least one other grabbing control - * in the span, the grabbing will be spread over the columns already + * in the span, the grabbing will be spread over the columns already * marked as grabExcessHorizontalSpace.</li> * </ul> - * + * * <p>The default value is false.</p> - * + * * @see GridData#minimumWidth * @see GridData#widthHint - */ + */ public boolean grabExcessHorizontalSpace = false; - + /** - * <p>grabExcessVerticalSpace specifies whether the height of the cell - * changes depending on the size of the parent Composite. If + * <p>grabExcessVerticalSpace specifies whether the height of the cell + * changes depending on the size of the parent Composite. If * grabExcessVerticalSpace is <code>true</code>, the following rules * apply to the height of the cell:</p> * <ul> - * <li>If extra vertical space is available in the parent, the cell will - * grow to be taller than its preferred height. The new height - * will be "preferred height + delta" where delta is the extra + * <li>If extra vertical space is available in the parent, the cell will + * grow to be taller than its preferred height. The new height + * will be "preferred height + delta" where delta is the extra * vertical space divided by the number of grabbing rows.</li> - * <li>If there is not enough vertical space available in the parent, the - * cell will shrink until it reaches its minimum height as specified by - * GridData.minimumHeight. The new height will be the maximum of - * "minimumHeight" and "preferred height - delta", where delta is + * <li>If there is not enough vertical space available in the parent, the + * cell will shrink until it reaches its minimum height as specified by + * GridData.minimumHeight. The new height will be the maximum of + * "minimumHeight" and "preferred height - delta", where delta is * the amount of space missing divided by the number of grabbing rows.</li> - * <li>If the parent is packed, the cell will be its preferred height + * <li>If the parent is packed, the cell will be its preferred height * as specified by GridData.heightHint.</li> - * <li>If the control spans multiple rows and there are no other grabbing + * <li>If the control spans multiple rows and there are no other grabbing * controls in any of the spanned rows, the last row in the span will * grab the extra space. If there is at least one other grabbing control - * in the span, the grabbing will be spread over the rows already + * in the span, the grabbing will be spread over the rows already * marked as grabExcessVerticalSpace.</li> * </ul> - * + * * <p>The default value is false.</p> - * + * * @see GridData#minimumHeight * @see GridData#heightHint - */ + */ public boolean grabExcessVerticalSpace = false; /** * minimumWidth specifies the minimum width in pixels. This value - * applies only if grabExcessHorizontalSpace is true. A value of + * applies only if grabExcessHorizontalSpace is true. A value of * SWT.DEFAULT means that the minimum width will be the result - * of Control.computeSize(int, int, boolean) where wHint is + * of Control.computeSize(int, int, boolean) where wHint is * determined by GridData.widthHint. * * The default value is 0. @@ -216,12 +216,12 @@ * @see GridData#widthHint */ public int minimumWidth = 0; - + /** * minimumHeight specifies the minimum height in pixels. This value - * applies only if grabExcessVerticalSpace is true. A value of + * applies only if grabExcessVerticalSpace is true. A value of * SWT.DEFAULT means that the minimum height will be the result - * of Control.computeSize(int, int, boolean) where hHint is + * of Control.computeSize(int, int, boolean) where hHint is * determined by GridData.heightHint. * * The default value is 0. @@ -231,41 +231,41 @@ * @see GridData#heightHint */ public int minimumHeight = 0; - + /** * exclude informs the layout to ignore this control when sizing * and positioning controls. If this value is <code>true</code>, * the size and position of the control will not be managed by the - * layout. If this value is <code>false</code>, the size and + * layout. If this value is <code>false</code>, the size and * position of the control will be computed and assigned. - * + * * The default value is <code>false</code>. - * + * * @since 3.1 */ public boolean exclude = false; - + /** * Value for horizontalAlignment or verticalAlignment. * Position the control at the top or left of the cell. * Not recommended. Use SWT.BEGINNING, SWT.TOP or SWT.LEFT instead. */ public static final int BEGINNING = SWT.BEGINNING; - + /** * Value for horizontalAlignment or verticalAlignment. * Position the control in the vertical or horizontal center of the cell * Not recommended. Use SWT.CENTER instead. */ public static final int CENTER = 2; - + /** * Value for horizontalAlignment or verticalAlignment. * Position the control at the bottom or right of the cell * Not recommended. Use SWT.END, SWT.BOTTOM or SWT.RIGHT instead. */ public static final int END = 3; - + /** * Value for horizontalAlignment or verticalAlignment. * Resize the control to fill the cell horizontally or vertically. @@ -276,124 +276,124 @@ /** * Style bit for <code>new GridData(int)</code>. * Position the control at the top of the cell. - * Not recommended. Use + * Not recommended. Use * <code>new GridData(int, SWT.BEGINNING, boolean, boolean)</code> * instead. */ public static final int VERTICAL_ALIGN_BEGINNING = 1 << 1; - + /** - * Style bit for <code>new GridData(int)</code> to position the + * Style bit for <code>new GridData(int)</code> to position the * control in the vertical center of the cell. * Not recommended. Use * <code>new GridData(int, SWT.CENTER, boolean, boolean)</code> * instead. */ public static final int VERTICAL_ALIGN_CENTER = 1 << 2; - + /** - * Style bit for <code>new GridData(int)</code> to position the + * Style bit for <code>new GridData(int)</code> to position the * control at the bottom of the cell. * Not recommended. Use * <code>new GridData(int, SWT.END, boolean, boolean)</code> * instead. */ public static final int VERTICAL_ALIGN_END = 1 << 3; - + /** - * Style bit for <code>new GridData(int)</code> to resize the + * Style bit for <code>new GridData(int)</code> to resize the * control to fill the cell vertically. * Not recommended. Use * <code>new GridData(int, SWT.FILL, boolean, boolean)</code> * instead */ public static final int VERTICAL_ALIGN_FILL = 1 << 4; - + /** - * Style bit for <code>new GridData(int)</code> to position the + * Style bit for <code>new GridData(int)</code> to position the * control at the left of the cell. * Not recommended. Use * <code>new GridData(SWT.BEGINNING, int, boolean, boolean)</code> * instead. */ public static final int HORIZONTAL_ALIGN_BEGINNING = 1 << 5; - + /** - * Style bit for <code>new GridData(int)</code> to position the + * Style bit for <code>new GridData(int)</code> to position the * control in the horizontal center of the cell. * Not recommended. Use * <code>new GridData(SWT.CENTER, int, boolean, boolean)</code> * instead. */ public static final int HORIZONTAL_ALIGN_CENTER = 1 << 6; - + /** - * Style bit for <code>new GridData(int)</code> to position the + * Style bit for <code>new GridData(int)</code> to position the * control at the right of the cell. * Not recommended. Use * <code>new GridData(SWT.END, int, boolean, boolean)</code> * instead. */ public static final int HORIZONTAL_ALIGN_END = 1 << 7; - + /** - * Style bit for <code>new GridData(int)</code> to resize the + * Style bit for <code>new GridData(int)</code> to resize the * control to fill the cell horizontally. * Not recommended. Use * <code>new GridData(SWT.FILL, int, boolean, boolean)</code> * instead. */ public static final int HORIZONTAL_ALIGN_FILL = 1 << 8; - + /** - * Style bit for <code>new GridData(int)</code> to resize the + * Style bit for <code>new GridData(int)</code> to resize the * control to fit the remaining horizontal space. * Not recommended. Use * <code>new GridData(int, int, true, boolean)</code> * instead. */ public static final int GRAB_HORIZONTAL = 1 << 9; - + /** - * Style bit for <code>new GridData(int)</code> to resize the + * Style bit for <code>new GridData(int)</code> to resize the * control to fit the remaining vertical space. * Not recommended. Use * <code>new GridData(int, int, boolean, true)</code> * instead. */ public static final int GRAB_VERTICAL = 1 << 10; - + /** - * Style bit for <code>new GridData(int)</code> to resize the + * Style bit for <code>new GridData(int)</code> to resize the * control to fill the cell vertically and to fit the remaining * vertical space. * FILL_VERTICAL = VERTICAL_ALIGN_FILL | GRAB_VERTICAL * Not recommended. Use * <code>new GridData(int, SWT.FILL, boolean, true)</code> * instead. - */ + */ public static final int FILL_VERTICAL = VERTICAL_ALIGN_FILL | GRAB_VERTICAL; - + /** - * Style bit for <code>new GridData(int)</code> to resize the + * Style bit for <code>new GridData(int)</code> to resize the * control to fill the cell horizontally and to fit the remaining * horizontal space. * FILL_HORIZONTAL = HORIZONTAL_ALIGN_FILL | GRAB_HORIZONTAL * Not recommended. Use * <code>new GridData(SWT.FILL, int, true, boolean)</code> * instead. - */ + */ public static final int FILL_HORIZONTAL = HORIZONTAL_ALIGN_FILL | GRAB_HORIZONTAL; - + /** - * Style bit for <code>new GridData(int)</code> to resize the - * control to fill the cell horizontally and vertically and + * Style bit for <code>new GridData(int)</code> to resize the + * control to fill the cell horizontally and vertically and * to fit the remaining horizontal and vertical space. * FILL_BOTH = FILL_VERTICAL | FILL_HORIZONTAL * Not recommended. Use * <code>new GridData(SWT.FILL, SWT.FILL, true, true)</code> * instead. - */ + */ public static final int FILL_BOTH = FILL_VERTICAL | FILL_HORIZONTAL; int cacheWidth = -1, cacheHeight = -1; @@ -411,7 +411,7 @@ /** * Constructs a new instance based on the GridData style. * This constructor is not recommended. - * + * * @param style the GridData style */ public GridData (int style) { @@ -430,14 +430,14 @@ /** * Constructs a new instance of GridData according to the parameters. - * + * * @param horizontalAlignment how control will be positioned horizontally within a cell, * one of: SWT.BEGINNING (or SWT.LEFT), SWT.CENTER, SWT.END (or SWT.RIGHT), or SWT.FILL * @param verticalAlignment how control will be positioned vertically within a cell, * one of: SWT.BEGINNING (or SWT.TOP), SWT.CENTER, SWT.END (or SWT.BOTTOM), or SWT.FILL * @param grabExcessHorizontalSpace whether cell will be made wide enough to fit the remaining horizontal space * @param grabExcessVerticalSpace whether cell will be made high enough to fit the remaining vertical space - * + * * @since 3.0 */ public GridData (int horizontalAlignment, int verticalAlignment, boolean grabExcessHorizontalSpace, boolean grabExcessVerticalSpace) { @@ -446,7 +446,7 @@ /** * Constructs a new instance of GridData according to the parameters. - * + * * @param horizontalAlignment how control will be positioned horizontally within a cell, * one of: SWT.BEGINNING (or SWT.LEFT), SWT.CENTER, SWT.END (or SWT.RIGHT), or SWT.FILL * @param verticalAlignment how control will be positioned vertically within a cell, @@ -455,7 +455,7 @@ * @param grabExcessVerticalSpace whether cell will be made high enough to fit the remaining vertical space * @param horizontalSpan the number of column cells that the control will take up * @param verticalSpan the number of row cells that the control will take up - * + * * @since 3.0 */ public GridData (int horizontalAlignment, int verticalAlignment, boolean grabExcessHorizontalSpace, boolean grabExcessVerticalSpace, int horizontalSpan, int verticalSpan) { @@ -472,10 +472,10 @@ * Constructs a new instance of GridData according to the parameters. * A value of SWT.DEFAULT indicates that no minimum width or * no minimum height is specified. - * + * * @param width a minimum width for the column * @param height a minimum height for the row - * + * * @since 3.0 */ public GridData (int width, int height) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/layout/GridLayout.java swt4-gtk-4.6.0/org/eclipse/swt/layout/GridLayout.java --- swt4-gtk-4.5.0/org/eclipse/swt/layout/GridLayout.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/layout/GridLayout.java 2016-07-06 19:11:33.000000000 +0000 @@ -15,13 +15,13 @@ import org.eclipse.swt.widgets.*; /** - * Instances of this class lay out the control children of a - * <code>Composite</code> in a grid. + * Instances of this class lay out the control children of a + * <code>Composite</code> in a grid. * <p> - * <code>GridLayout</code> has a number of configuration fields, and the - * controls it lays out can have an associated layout data object, called - * <code>GridData</code>. The power of <code>GridLayout</code> lies in the - * ability to configure <code>GridData</code> for each control in the layout. + * <code>GridLayout</code> has a number of configuration fields, and the + * controls it lays out can have an associated layout data object, called + * <code>GridData</code>. The power of <code>GridLayout</code> lies in the + * ability to configure <code>GridData</code> for each control in the layout. * </p> * <p> * The following code creates a shell managed by a <code>GridLayout</code> @@ -33,19 +33,19 @@ * gridLayout.numColumns = 3; * shell.setLayout(gridLayout); * </pre> - * The <code>numColumns</code> field is the most important field in a - * <code>GridLayout</code>. Widgets are laid out in columns from left - * to right, and a new row is created when <code>numColumns</code> + 1 + * The <code>numColumns</code> field is the most important field in a + * <code>GridLayout</code>. Widgets are laid out in columns from left + * to right, and a new row is created when <code>numColumns</code> + 1 * controls are added to the <code>Composite<code>. * </p> - * + * * @see GridData * @see <a href="http://www.eclipse.org/swt/snippets/#gridlayout">GridLayout snippets</a> * @see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: LayoutExample</a> * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public final class GridLayout extends Layout { - + /** * numColumns specifies the number of cell columns in the layout. * If numColumns has a value less than 1, the layout will not @@ -62,7 +62,7 @@ * The default value is false. */ public boolean makeColumnsEqualWidth = false; - + /** * marginWidth specifies the number of pixels of horizontal margin * that will be placed along the left and right edges of the layout. @@ -70,7 +70,7 @@ * The default value is 5. */ public int marginWidth = 5; - + /** * marginHeight specifies the number of pixels of vertical margin * that will be placed along the top and bottom edges of the layout. @@ -84,7 +84,7 @@ * that will be placed along the left edge of the layout. * * The default value is 0. - * + * * @since 3.1 */ public int marginLeft = 0; @@ -94,7 +94,7 @@ * that will be placed along the top edge of the layout. * * The default value is 0. - * + * * @since 3.1 */ public int marginTop = 0; @@ -104,7 +104,7 @@ * that will be placed along the right edge of the layout. * * The default value is 0. - * + * * @since 3.1 */ public int marginRight = 0; @@ -114,7 +114,7 @@ * that will be placed along the bottom edge of the layout. * * The default value is 0. - * + * * @since 3.1 */ public int marginBottom = 0; @@ -135,7 +135,7 @@ * The default value is 5. */ public int verticalSpacing = 5; - + /** * Constructs a new instance of this class * with a single column. @@ -151,7 +151,7 @@ * * @param numColumns the number of columns in the grid * @param makeColumnsEqualWidth whether or not the columns will have equal width - * + * * @since 2.0 */ public GridLayout (int numColumns, boolean makeColumnsEqualWidth) { @@ -208,7 +208,7 @@ GridData data = (GridData) control.getLayoutData (); if (data == null || !data.exclude) { children [count++] = children [i]; - } + } } if (count == 0) { return new Point (marginLeft + marginWidth * 2 + marginRight, marginTop + marginHeight * 2 + marginBottom); @@ -241,7 +241,7 @@ /* Build the grid */ int row = 0, column = 0, rowCount = 0, columnCount = numColumns; Control [][] grid = new Control [4] [columnCount]; - for (int i=0; i<count; i++) { + for (int i=0; i<count; i++) { Control child = children [i]; GridData data = (GridData) child.getLayoutData (); int hSpan = Math.max (1, Math.min (data.horizontalSpan, columnCount)); @@ -407,7 +407,7 @@ } } if (last > -1) widths [last] += remainder; - + for (int j=0; j<columnCount; j++) { for (int i=0; i<rowCount; i++) { GridData data = getData (grid, i, j, rowCount, columnCount, false); @@ -433,7 +433,7 @@ widths [last2=j-k] += delta2; } } - if (last2 > -1) widths [last2] += remainder2; + if (last2 > -1) widths [last2] += remainder2; } } } @@ -545,7 +545,7 @@ heights [last=i-k] += delta; } } - if (last > -1) heights [last] += remainder; + if (last > -1) heights [last] += remainder; } } if (!data.grabExcessVerticalSpace || data.minimumHeight != 0) { @@ -562,7 +562,7 @@ minHeights [last=i-k] += delta; } } - if (last > -1) minHeights [last] += remainder; + if (last > -1) minHeights [last] += remainder; } } } @@ -592,7 +592,7 @@ } } if (last > -1) heights [last] += remainder; - + for (int i=0; i<rowCount; i++) { for (int j=0; j<columnCount; j++) { GridData data = getData (grid, i, j, rowCount, columnCount, false); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/layout/RowData.java swt4-gtk-4.6.0/org/eclipse/swt/layout/RowData.java --- swt4-gtk-4.5.0/org/eclipse/swt/layout/RowData.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/layout/RowData.java 2016-07-06 19:11:33.000000000 +0000 @@ -14,8 +14,8 @@ import org.eclipse.swt.graphics.*; /** - * Each control controlled by a <code>RowLayout</code> can have its initial - * width and height specified by setting a <code>RowData</code> object + * Each control controlled by a <code>RowLayout</code> can have its initial + * width and height specified by setting a <code>RowData</code> object * into the control. * <p> * The following code uses a <code>RowData</code> object to change the initial @@ -29,14 +29,14 @@ * button1.setLayoutData(new RowData(50, 40)); * </pre> * </p> - * + * * @see RowLayout * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public final class RowData { /** * width specifies the desired width in pixels. This value - * is the wHint passed into Control.computeSize(int, int, boolean) + * is the wHint passed into Control.computeSize(int, int, boolean) * to determine the preferred size of the control. * * The default value is SWT.DEFAULT. @@ -46,7 +46,7 @@ public int width = SWT.DEFAULT; /** * height specifies the preferred height in pixels. This value - * is the hHint passed into Control.computeSize(int, int, boolean) + * is the hHint passed into Control.computeSize(int, int, boolean) * to determine the preferred size of the control. * * The default value is SWT.DEFAULT. @@ -54,20 +54,20 @@ * @see org.eclipse.swt.widgets.Control#computeSize(int, int, boolean) */ public int height = SWT.DEFAULT; - + /** * exclude informs the layout to ignore this control when sizing * and positioning controls. If this value is <code>true</code>, * the size and position of the control will not be managed by the - * layout. If this value is <code>false</code>, the size and + * layout. If this value is <code>false</code>, the size and * position of the control will be computed and assigned. - * + * * The default value is <code>false</code>. - * + * * @since 3.1 */ public boolean exclude = false; - + /** * Constructs a new instance of RowData using * default values. @@ -79,7 +79,7 @@ * Constructs a new instance of RowData according to the parameters. * A value of SWT.DEFAULT indicates that no minimum width or * no minimum height is specified. - * + * * @param width a minimum width for the control * @param height a minimum height for the control */ @@ -92,7 +92,7 @@ * Constructs a new instance of RowData according to the parameter. * A value of SWT.DEFAULT indicates that no minimum width or * no minimum height is specified. - * + * * @param point a point whose x coordinate specifies a minimum width for the control * and y coordinate specifies a minimum height for the control */ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/layout/RowLayout.java swt4-gtk-4.6.0/org/eclipse/swt/layout/RowLayout.java --- swt4-gtk-4.5.0/org/eclipse/swt/layout/RowLayout.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/layout/RowLayout.java 2016-07-06 19:11:33.000000000 +0000 @@ -15,22 +15,22 @@ import org.eclipse.swt.widgets.*; /** - * Instances of this class determine the size and position of the - * children of a <code>Composite</code> by placing them either in - * horizontal rows or vertical columns within the parent <code>Composite</code>. + * Instances of this class determine the size and position of the + * children of a <code>Composite</code> by placing them either in + * horizontal rows or vertical columns within the parent <code>Composite</code>. * <p> * <code>RowLayout</code> aligns all controls in one row if the * <code>type</code> is set to horizontal, and one column if it is - * set to vertical. It has the ability to wrap, and provides configurable - * margins and spacing. <code>RowLayout</code> has a number of configuration - * fields. In addition, the height and width of each control in a + * set to vertical. It has the ability to wrap, and provides configurable + * margins and spacing. <code>RowLayout</code> has a number of configuration + * fields. In addition, the height and width of each control in a * <code>RowLayout</code> can be specified by setting a <code>RowData</code> * object into the control using <code>setLayoutData ()</code>. * </p> * <p> - * The following example code creates a <code>RowLayout</code>, sets all - * of its fields to non-default values, and then sets it into a - * <code>Shell</code>. + * The following example code creates a <code>RowLayout</code>, sets all + * of its fields to non-default values, and then sets it into a + * <code>Shell</code>. * <pre> * RowLayout rowLayout = new RowLayout(); * rowLayout.wrap = false; @@ -49,45 +49,45 @@ * shell.setLayout(new RowLayout()); * </pre> * </p> - * + * * @see RowData * @see <a href="http://www.eclipse.org/swt/snippets/#rowlayout">RowLayout snippets</a> * @see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: LayoutExample</a> * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public final class RowLayout extends Layout { - + /** - * type specifies whether the layout places controls in rows or + * type specifies whether the layout places controls in rows or * columns. - * + * * The default value is HORIZONTAL. - * + * * Possible values are: <ul> * <li>HORIZONTAL: Position the controls horizontally from left to right</li> * <li>VERTICAL: Position the controls vertically from top to bottom</li> * </ul> - * + * * @since 2.0 */ public int type = SWT.HORIZONTAL; - + /** * marginWidth specifies the number of pixels of horizontal margin * that will be placed along the left and right edges of the layout. * * The default value is 0. - * + * * @since 3.0 */ public int marginWidth = 0; - + /** * marginHeight specifies the number of pixels of vertical margin * that will be placed along the top and bottom edges of the layout. * * The default value is 0. - * + * * @since 3.0 */ public int marginHeight = 0; @@ -99,7 +99,7 @@ * The default value is 3. */ public int spacing = 3; - + /** * wrap specifies whether a control will be wrapped to the next * row if there is insufficient space on the current row. @@ -110,22 +110,22 @@ /** * pack specifies whether all controls in the layout take - * their preferred size. If pack is false, all controls will - * have the same size which is the size required to accommodate the - * largest preferred height and the largest preferred width of all + * their preferred size. If pack is false, all controls will + * have the same size which is the size required to accommodate the + * largest preferred height and the largest preferred width of all * the controls in the layout. * * The default value is true. */ public boolean pack = true; - + /** * fill specifies whether the controls in a row should be * all the same height for horizontal layouts, or the same * width for vertical layouts. * * The default value is false. - * + * * @since 3.0 */ public boolean fill = false; @@ -136,11 +136,11 @@ * or centered horizontally in each cell for vertical layouts. * * The default value is false. - * + * * @since 3.4 */ public boolean center = false; - + /** * justify specifies whether the controls in a row should be * fully justified, with any extra space placed between the controls. @@ -191,7 +191,7 @@ * Constructs a new instance of this class given the type. * * @param type the type of row layout - * + * * @since 2.0 */ public RowLayout (int type) { @@ -251,7 +251,7 @@ RowData data = (RowData) control.getLayoutData (); if (data == null || !data.exclude) { children [count++] = children [i]; - } + } } if (count == 0) { return new Point (marginLeft + marginWidth * 2 + marginRight, marginTop + marginHeight * 2 + marginBottom); @@ -370,7 +370,7 @@ RowData data = (RowData) control.getLayoutData (); if (data == null || !data.exclude) { children [count++] = children [i]; - } + } } if (count == 0) { return new Point (marginLeft + marginWidth * 2 + marginRight, marginTop + marginHeight * 2 + marginBottom); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/opengl/GLCanvas.java swt4-gtk-4.6.0/org/eclipse/swt/opengl/GLCanvas.java --- swt4-gtk-4.5.0/org/eclipse/swt/opengl/GLCanvas.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/opengl/GLCanvas.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -12,13 +12,14 @@ import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; import org.eclipse.swt.internal.opengl.glx.*; import org.eclipse.swt.widgets.*; /** * GLCanvas is a widget capable of displaying OpenGL content. - * + * * @see GLData * @see <a href="http://www.eclipse.org/swt/snippets/#opengl">OpenGL snippets</a> * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> @@ -43,11 +44,11 @@ * * @exception IllegalArgumentException * <ul><li>ERROR_NULL_ARGUMENT when the data is null - * <li>ERROR_UNSUPPORTED_DEPTH when the requested attributes cannot be provided</ul> + * <li>ERROR_UNSUPPORTED_DEPTH when the requested attributes cannot be provided</ul> * </ul> */ public GLCanvas (Composite parent, int style, GLData data) { - super (parent, style); + super (parent, style); if (data == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); int glxAttrib [] = new int [MAX_ATTRIBUTES]; int pos = 0; @@ -105,7 +106,7 @@ glxAttrib [pos++] = 0; OS.gtk_widget_realize (handle); int /*long*/ window = OS.gtk_widget_get_window (handle); - + int /*long*/ xDisplay; if (OS.GTK_VERSION >= OS.VERSION(2, 24, 0)) { xDisplay = OS.gdk_x11_display_get_xdisplay(OS.gdk_window_get_display(window)); @@ -146,6 +147,7 @@ OS.gdk_window_show (glWindow); Listener listener = new Listener () { + @Override public void handleEvent (Event event) { switch (event.type) { case SWT.Paint: @@ -160,7 +162,7 @@ GLX.glViewport (viewport [0],viewport [1],viewport [2],viewport [3]); break; case SWT.Resize: - Rectangle clientArea = getClientArea(); + Rectangle clientArea = DPIUtil.autoScaleUp(getClientArea()); OS.gdk_window_move (glWindow, clientArea.x, clientArea.y); OS.gdk_window_resize (glWindow, clientArea.width, clientArea.height); break; @@ -189,7 +191,7 @@ /** * Returns a GLData object describing the created context. - * + * * @return GLData description of the OpenGL context attributes * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -236,7 +238,7 @@ /** * Returns a boolean indicating whether the receiver's OpenGL context * is the current context. - * + * * @return true if the receiver holds the current OpenGL context, * false otherwise * @exception SWTException <ul> @@ -252,7 +254,7 @@ /** * Sets the OpenGL context associated with this GLCanvas to be the * current GL context. - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -268,7 +270,7 @@ /** * Swaps the front and back color buffers. - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/opengl/GLData.java swt4-gtk-4.6.0/org/eclipse/swt/opengl/GLData.java --- swt4-gtk-4.5.0/org/eclipse/swt/opengl/GLData.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/opengl/GLData.java 2016-07-06 19:11:33.000000000 +0000 @@ -17,7 +17,7 @@ * @see GLCanvas * @see <a href="http://www.eclipse.org/swt/snippets/#opengl">OpenGL snippets</a> * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.2 */ @@ -25,13 +25,13 @@ /** * Specifies a double-buffered surface. During context * creation, only double-buffered formats are considered - * when set to true. + * when set to true. */ public boolean doubleBuffer; /** * Specifies a stereo surface. During context creation, - * only stereo formats are considered when set to true. + * only stereo formats are considered when set to true. */ public boolean stereo; @@ -121,15 +121,15 @@ * are preferred. */ public int samples; - + /** * Another GLCanvas whose texture namespace and display lists * should be shared. - * + * * @since 3.5 */ public GLCanvas shareContext; - + /** * Returns a string containing a concise, human-readable * description of the receiver. diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/printing/PrinterData.java swt4-gtk-4.6.0/org/eclipse/swt/printing/PrinterData.java --- swt4-gtk-4.5.0/org/eclipse/swt/printing/PrinterData.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/printing/PrinterData.java 2016-07-06 19:11:33.000000000 +0000 @@ -34,7 +34,7 @@ */ public final class PrinterData extends DeviceData { - + /** * the printer driver * On Windows systems, this is the name of the driver (often "winspool"). @@ -45,14 +45,14 @@ */ // TODO: note that this api is not finalized for GTK+ public String driver; - + /** * the name of the printer * On Windows systems, this is the name of the 'device'. * On Mac OSX, X/Window systems, and GTK+, this is the printer's 'name'. */ public String name; - + /** * the scope of the print job, expressed as one of the following values: * <dl> @@ -65,7 +65,7 @@ * </dl> */ public int scope = ALL_PAGES; - + /** * the start page of a page range, used when scope is PAGE_RANGE. * This value can be from 1 to the maximum number of pages for the platform. @@ -77,18 +77,18 @@ * This value can be from 1 to the maximum number of pages for the platform. */ public int endPage = 1; - + /** * whether or not the print job should go to a file */ public boolean printToFile = false; - + /** * the name of the file to print to if printToFile is true. * Note that this field is ignored if printToFile is false. */ public String fileName; - + /** * the number of copies to print. * Note that this field may be controlled by the printer driver @@ -96,7 +96,7 @@ * multiple copies, and if so, the value of this field will always be 1. */ public int copyCount = 1; - + /** * whether or not the printer should collate the printed paper * Note that this field may be controlled by the printer driver. @@ -104,11 +104,11 @@ * collation, and if so, the value of this field will always be false. */ public boolean collate = false; - + /** * The orientation of the paper, which can be either PORTRAIT * or LANDSCAPE. - * + * * @since 3.5 */ public int orientation = PORTRAIT; @@ -132,7 +132,7 @@ * A printer's default value is typically single-sided, * however it can default to double-sided in order to save paper. * </p> - * + * * @since 3.7 */ public int duplex = SWT.DEFAULT; @@ -140,49 +140,49 @@ /** * <code>scope</code> field value indicating that * all pages should be printed - */ + */ public static final int ALL_PAGES = 0; - + /** * <code>scope</code> field value indicating that * the range of pages specified by startPage and endPage * should be printed - */ + */ public static final int PAGE_RANGE = 1; - + /** * <code>scope</code> field value indicating that * the current selection should be printed - */ + */ public static final int SELECTION = 2; - + /** * <code>orientation</code> field value indicating * portrait paper orientation - * + * * @since 3.5 */ public static final int PORTRAIT = 1; - + /** * <code>orientation</code> field value indicating * landscape paper orientation - * + * * @since 3.5 */ public static final int LANDSCAPE = 2; - + /** * <code>duplex</code> field value indicating * single-sided printing. * <p> * This is also known as simplex printing. * </p> - * + * * @since 3.7 */ public static final int DUPLEX_NONE = 0; - + /** * <code>duplex</code> field value indicating * double-sided printing for binding on the long edge. @@ -192,11 +192,11 @@ * </p><p> * This is also known as duplex printing. * </p> - * + * * @since 3.7 */ public static final int DUPLEX_LONG_EDGE = 1; - + /** * <code>duplex</code> field value indicating * double-sided printing for binding on the short edge. @@ -206,11 +206,11 @@ * </p><p> * This is also known as duplex tumble printing. * </p> - * + * * @since 3.7 */ public static final int DUPLEX_SHORT_EDGE = 2; - + /** * private, platform-specific data * On Windows, this contains a copy of the DEVMODE struct @@ -220,13 +220,13 @@ * On OS X Carbon, this contains a copy of the PrintSettings and PageFormat * returned from the <code>PrintDialog</code>. * This field is not currently used on the X/Window System. - */ + */ byte [] otherData; /** * Constructs an instance of this class that can be * used to print to the default printer. - * + * * @see Printer#getDefaultPrinterData */ public PrinterData() { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/program/Program.java swt4-gtk-4.6.0/org/eclipse/swt/program/Program.java --- swt4-gtk-4.5.0/org/eclipse/swt/program/Program.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/program/Program.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -11,18 +11,18 @@ package org.eclipse.swt.program; +import java.io.*; +import java.util.*; +import java.util.List; + import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; -import org.eclipse.swt.internal.gnome.*; import org.eclipse.swt.internal.cde.*; +import org.eclipse.swt.internal.gnome.*; import org.eclipse.swt.internal.gtk.*; import org.eclipse.swt.widgets.*; -import java.io.*; -import java.util.*; -import java.util.List; - /** * Instances of this class represent programs and * their associated file extensions in the operating @@ -44,7 +44,7 @@ boolean gnomeExpectUri; static int /*long*/ modTime; - static Hashtable<String, List<String>> mimeTable; + static Map<String, List<String>> mimeTable; static int /*long*/ cdeShell; @@ -73,9 +73,9 @@ if (desktopValue != null) return desktopValue.intValue(); int desktop = DESKTOP_UNKNOWN; - if (OS.GDK_WINDOWING_WAYLAND ()) { + if (!OS.isX11 ()) { desktop = DESKTOP_GIO; - display.setData(DESKTOP_DATA, new Integer(desktop)); + display.setData(DESKTOP_DATA, Integer.valueOf(desktop)); return desktop; } @@ -133,6 +133,7 @@ int /*long*/ icon_theme = GNOME.gnome_icon_theme_new(); display.setData(ICON_THEME_DATA, new LONG(icon_theme)); display.addListener(SWT.Dispose, new Listener() { + @Override public void handleEvent(Event event) { LONG gnomeIconTheme = (LONG)display.getData(ICON_THEME_DATA); if (gnomeIconTheme == null) return; @@ -162,7 +163,7 @@ } } - display.setData(DESKTOP_DATA, new Integer(desktop)); + display.setData(DESKTOP_DATA, Integer.valueOf(desktop)); return desktop; } @@ -210,8 +211,8 @@ return new String(Converter.mbcsToWcs(null, attrValueBuf)); } -static Hashtable<String, List<String>> cde_getDataTypeInfo() { - Hashtable<String, List<String>> dataTypeInfo = new Hashtable<String, List<String>>(); +static Map<String, List<String>> cde_getDataTypeInfo() { + Map<String, List<String>> dataTypeInfo = new HashMap<>(); int index; int /*long*/ dataTypeList = CDE.DtDtsDataTypeNames(); if (dataTypeList != 0) { @@ -230,7 +231,7 @@ String extension = cde_getExtension(dataTypeName); if (!CDE.DtDtsDataTypeIsAction(dataTypeBuf) && extension != null && cde_getAction(dataTypeName) != null) { - List<String> exts = new ArrayList<String>(); + List<String> exts = new ArrayList<>(); exts.add(extension); dataTypeInfo.put(dataTypeName, exts); } @@ -267,11 +268,11 @@ static String cde_getMimeType(String extension) { String mimeType = null; - Hashtable<String, List<String>> mimeInfo = cde_getDataTypeInfo(); + Map<String, List<String>> mimeInfo = cde_getDataTypeInfo(); if (mimeInfo == null) return null; - Enumeration<String> keys = mimeInfo.keys(); - while (mimeType == null && keys.hasMoreElements()) { - String type = keys.nextElement(); + Iterator<String> keys = mimeInfo.keySet().iterator(); + while (mimeType == null && keys.hasNext()) { + String type = keys.next(); List<String> mimeExts = mimeInfo.get(type); for (int index = 0; index < mimeExts.size(); index++){ if (extension.equals(mimeExts.get(index))) { @@ -327,12 +328,12 @@ } static String[] parseCommand(String cmd) { - List<String> args = new ArrayList<String>(); + List<String> args = new ArrayList<>(); int sIndex = 0; int eIndex; while (sIndex < cmd.length()) { /* Trim initial white space of argument. */ - while (sIndex < cmd.length() && Compatibility.isWhitespace(cmd.charAt(sIndex))) { + while (sIndex < cmd.length() && Character.isWhitespace(cmd.charAt(sIndex))) { sIndex++; } if (sIndex < cmd.length()) { @@ -357,7 +358,7 @@ else { /* Use white space for the delimiters. */ eIndex = sIndex; - while (eIndex < cmd.length() && !Compatibility.isWhitespace(cmd.charAt(eIndex))) eIndex++; + while (eIndex < cmd.length() && !Character.isWhitespace(cmd.charAt(eIndex))) eIndex++; args.add(cmd.substring(sIndex, eIndex)); sIndex = eIndex + 1; } @@ -553,7 +554,7 @@ */ static String[] getExtensions(Display display) { int desktop = getDesktop(display); - Hashtable<String, List<String>> mimeInfo = null; + Map<String, List<String>> mimeInfo = null; switch (desktop) { case DESKTOP_GIO: return gio_getExtensions(); case DESKTOP_GNOME: break; @@ -562,10 +563,10 @@ if (mimeInfo == null) return new String[0]; /* Create a unique set of the file extensions. */ - List<String> extensions = new ArrayList<String>(); - Enumeration<String> keys = mimeInfo.keys(); - while (keys.hasMoreElements()) { - String mimeType = keys.nextElement(); + List<String> extensions = new ArrayList<>(); + Iterator<String> keys = mimeInfo.keySet().iterator(); + while (keys.hasNext()) { + String mimeType = keys.next(); List<String> mimeExts = mimeInfo.get(mimeType); for (int index = 0; index < mimeExts.size(); index++){ if (!extensions.contains(mimeExts.get(index))) { @@ -595,17 +596,17 @@ */ static Program[] getPrograms(Display display) { int desktop = getDesktop(display); - Hashtable<String, List<String>> mimeInfo = null; + Map<String, List<String>> mimeInfo = null; switch (desktop) { case DESKTOP_GIO: return gio_getPrograms(display); case DESKTOP_GNOME: break; case DESKTOP_CDE: mimeInfo = cde_getDataTypeInfo(); break; } if (mimeInfo == null) return new Program[0]; - List<Program> programs = new ArrayList<Program>(); - Enumeration<String> keys = mimeInfo.keys(); - while (keys.hasMoreElements()) { - String mimeType = keys.nextElement(); + List<Program> programs = new ArrayList<>(); + Iterator<String> keys = mimeInfo.keySet().iterator(); + while (keys.hasNext()) { + String mimeType = keys.next(); Program program = null; switch (desktop) { case DESKTOP_CDE: program = cde_getProgram(display, mimeType); break; @@ -662,7 +663,7 @@ return data; } -static Hashtable<String, List<String>> gio_getMimeInfo() { +static Map<String, List<String>> gio_getMimeInfo() { int /*long*/ mimeDatabase = 0, fileInfo = 0; /* * The file 'globs' contain the file extensions @@ -683,7 +684,7 @@ if (modTime != 0 && modTimestamp[0] == modTime) { return mimeTable; } else { - mimeTable = new Hashtable<String, List<String>>(); + mimeTable = new HashMap<>(); modTime = modTimestamp[0]; int /*long*/ reader = OS.g_data_input_stream_new (fileInputStream); int /*long*/ [] length = new int /*long*/ [1]; @@ -697,7 +698,7 @@ int separatorIndex = line.indexOf (':'); if (separatorIndex > 0) { - List<String> mimeTypes = new ArrayList<String> (); + List<String> mimeTypes = new ArrayList<> (); String mimeType = line.substring (0, separatorIndex); String extensionFormat = line.substring (separatorIndex+1); int extensionIndex = extensionFormat.indexOf ("."); @@ -733,7 +734,7 @@ static String gio_getMimeType(String extension) { String mimeType = null; - Hashtable<String, List<String>> h = gio_getMimeInfo(); + Map<String, List<String>> h = gio_getMimeInfo(); if (h != null && h.containsKey(extension)) { List<String> mimeTypes = h.get(extension); mimeType = mimeTypes.get(0); @@ -796,7 +797,7 @@ int /*long*/ applicationList = OS.g_app_info_get_all (); int /*long*/ list = applicationList; Program program; - List<Program> programs = new ArrayList<Program>(); + List<Program> programs = new ArrayList<>(); while (list != 0) { int /*long*/ application = OS.g_list_data(list); if (application != 0) { @@ -892,15 +893,10 @@ } static String[] gio_getExtensions() { - Hashtable<String, List<String>> mimeInfo = gio_getMimeInfo(); + Map<String, List<String>> mimeInfo = gio_getMimeInfo(); if (mimeInfo == null) return new String[0]; /* Create a unique set of the file extensions. */ - List<String> extensions = new ArrayList<String>(); - Enumeration<String> keys = mimeInfo.keys(); - while (keys.hasMoreElements()) { - String extension = keys.nextElement(); - extensions.add(extension); - } + List<String> extensions = new ArrayList<>(mimeInfo.keySet()); /* Return the list of extensions. */ return extensions.toArray(new String[extensions.size()]); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/SWTError.java swt4-gtk-4.6.0/org/eclipse/swt/SWTError.java --- swt4-gtk-4.5.0/org/eclipse/swt/SWTError.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/SWTError.java 2016-07-06 19:11:33.000000000 +0000 @@ -10,11 +10,9 @@ *******************************************************************************/ package org.eclipse.swt; -import org.eclipse.swt.internal.*; - /** * This error is thrown whenever an unrecoverable error - * occurs internally in SWT. The message text and error code + * occurs internally in SWT. The message text and error code * provide a further description of the problem. The exception * has a <code>throwable</code> field which holds the underlying * throwable that caused the problem (if this information is @@ -29,7 +27,7 @@ * still catch them. * </p><p> * This class also provides support methods used by SWT to match - * error codes to the appropriate exception class (SWTError, + * error codes to the appropriate exception class (SWTError, * SWTException, or IllegalArgumentException) and to provide * human readable strings for SWT error codes. * </p> @@ -52,9 +50,9 @@ public Throwable throwable; static final long serialVersionUID = 3833467327105808433L; - + /** - * Constructs a new instance of this class with its + * Constructs a new instance of this class with its * stack trace filled in. The error code is set to an * unspecified value. */ @@ -63,7 +61,7 @@ } /** - * Constructs a new instance of this class with its + * Constructs a new instance of this class with its * stack trace and message filled in. The error code is * set to an unspecified value. Specifying <code>null</code> * as the message is equivalent to specifying an empty string. @@ -75,7 +73,7 @@ } /** - * Constructs a new instance of this class with its + * Constructs a new instance of this class with its * stack trace and error code filled in. * * @param code the SWT error code @@ -85,11 +83,11 @@ } /** - * Constructs a new instance of this class with its + * Constructs a new instance of this class with its * stack trace, error code and message filled in. * Specifying <code>null</code> as the message is * equivalent to specifying an empty string. - * + * * @param code the SWT error code * @param message the detail message for the exception */ @@ -107,7 +105,7 @@ * in order for inherited printStackTrace() methods to work. * </p> * @return the underlying throwable - * + * * @since 3.1 */ @Override @@ -140,10 +138,6 @@ @Override public void printStackTrace () { super.printStackTrace (); - if (Library.JAVA_VERSION < Library.JAVA_VERSION(1, 4, 0) && throwable != null) { - System.err.println ("*** Stack trace of contained error ***"); //$NON-NLS-1$ - throwable.printStackTrace (); - } } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/SWTException.java swt4-gtk-4.6.0/org/eclipse/swt/SWTException.java --- swt4-gtk-4.5.0/org/eclipse/swt/SWTException.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/SWTException.java 2016-07-06 19:11:33.000000000 +0000 @@ -10,11 +10,9 @@ *******************************************************************************/ package org.eclipse.swt; -import org.eclipse.swt.internal.*; - /** * This runtime exception is thrown whenever a recoverable error - * occurs internally in SWT. The message text and error code + * occurs internally in SWT. The message text and error code * provide a further description of the problem. The exception * has a <code>throwable</code> field which holds the underlying * exception that caused the problem (if this information is @@ -41,11 +39,11 @@ * or null if this information is not available. */ public Throwable throwable; - + static final long serialVersionUID = 3257282552304842547L; - + /** - * Constructs a new instance of this class with its + * Constructs a new instance of this class with its * stack trace filled in. The error code is set to an * unspecified value. */ @@ -54,7 +52,7 @@ } /** - * Constructs a new instance of this class with its + * Constructs a new instance of this class with its * stack trace and message filled in. The error code is * set to an unspecified value. Specifying <code>null</code> * as the message is equivalent to specifying an empty string. @@ -66,7 +64,7 @@ } /** - * Constructs a new instance of this class with its + * Constructs a new instance of this class with its * stack trace and error code filled in. * * @param code the SWT error code @@ -76,7 +74,7 @@ } /** - * Constructs a new instance of this class with its + * Constructs a new instance of this class with its * stack trace, error code and message filled in. * Specifying <code>null</code> as the message is * equivalent to specifying an empty string. @@ -98,7 +96,7 @@ * in order for inherited printStackTrace() methods to work. * </p> * @return the underlying throwable - * + * * @since 3.1 */ @Override @@ -131,10 +129,6 @@ @Override public void printStackTrace () { super.printStackTrace (); - if (Library.JAVA_VERSION < Library.JAVA_VERSION(1, 4, 0) && throwable != null) { - System.err.println ("*** Stack trace of contained exception ***"); //$NON-NLS-1$ - throwable.printStackTrace (); - } } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/SWT.java swt4-gtk-4.6.0/org/eclipse/swt/SWT.java --- swt4-gtk-4.5.0/org/eclipse/swt/SWT.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/SWT.java 2016-07-06 19:11:33.000000000 +0000 @@ -13,6 +13,7 @@ import org.eclipse.swt.internal.*; +import org.eclipse.swt.widgets.*; /** * This class provides access to a small number of SWT system-wide @@ -35,9 +36,9 @@ * * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ - + /* NOTE: - * Good javadoc coding style is to put the values of static final + * Good javadoc coding style is to put the values of static final * constants in the comments. This reinforces the fact that * consumers are allowed to rely on the value (and they must * since the values are compiled inline in their code). We @@ -45,142 +46,142 @@ * releases. */ public class SWT { - + /* Widget Event Constants */ - + /** * The null event type (value is 0). - * + * * @since 3.0 */ public static final int None = 0; - + /** * The key down event type (value is 1). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Control#addKeyListener * @see org.eclipse.swt.widgets.Tracker#addKeyListener * @see org.eclipse.swt.events.KeyListener#keyPressed * @see org.eclipse.swt.events.KeyEvent */ public static final int KeyDown = 1; - + /** * The key up event type (value is 2). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Control#addKeyListener * @see org.eclipse.swt.widgets.Tracker#addKeyListener * @see org.eclipse.swt.events.KeyListener#keyReleased * @see org.eclipse.swt.events.KeyEvent */ public static final int KeyUp = 2; - + /** * The mouse down event type (value is 3). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Control#addMouseListener * @see org.eclipse.swt.events.MouseListener#mouseDown * @see org.eclipse.swt.events.MouseEvent */ public static final int MouseDown = 3; - + /** * The mouse up event type (value is 4). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Control#addMouseListener * @see org.eclipse.swt.events.MouseListener#mouseUp * @see org.eclipse.swt.events.MouseEvent */ public static final int MouseUp = 4; - + /** * The mouse move event type (value is 5). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Control#addMouseMoveListener * @see org.eclipse.swt.events.MouseMoveListener#mouseMove * @see org.eclipse.swt.events.MouseEvent */ public static final int MouseMove = 5; - + /** * The mouse enter event type (value is 6). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Control#addMouseTrackListener * @see org.eclipse.swt.events.MouseTrackListener#mouseEnter * @see org.eclipse.swt.events.MouseEvent */ - public static final int MouseEnter = 6; - + public static final int MouseEnter = 6; + /** * The mouse exit event type (value is 7). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Control#addMouseTrackListener * @see org.eclipse.swt.events.MouseTrackListener#mouseExit * @see org.eclipse.swt.events.MouseEvent */ public static final int MouseExit = 7; - + /** * The mouse double click event type (value is 8). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Control#addMouseListener * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick * @see org.eclipse.swt.events.MouseEvent */ - public static final int MouseDoubleClick = 8; - + public static final int MouseDoubleClick = 8; + /** * The paint event type (value is 9). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Control#addPaintListener * @see org.eclipse.swt.events.PaintListener#paintControl * @see org.eclipse.swt.events.PaintEvent */ - public static final int Paint = 9; - + public static final int Paint = 9; + /** * The move event type (value is 10). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Control#addControlListener * @see org.eclipse.swt.widgets.TableColumn#addControlListener * @see org.eclipse.swt.widgets.Tracker#addControlListener @@ -189,14 +190,14 @@ * @see org.eclipse.swt.events.ControlEvent */ public static final int Move = 10; - + /** * The resize event type (value is 11). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Control#addControlListener * @see org.eclipse.swt.widgets.TableColumn#addControlListener * @see org.eclipse.swt.widgets.Tracker#addControlListener @@ -205,28 +206,28 @@ * @see org.eclipse.swt.events.ControlEvent */ public static final int Resize = 11; - + /** * The dispose event type (value is 12). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Widget#addDisposeListener * @see org.eclipse.swt.events.DisposeListener#widgetDisposed * @see org.eclipse.swt.events.DisposeEvent */ public static final int Dispose = 12; - + /** * The selection event type (value is 13). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Button#addSelectionListener * @see org.eclipse.swt.widgets.Combo#addSelectionListener * @see org.eclipse.swt.widgets.CoolItem#addSelectionListener @@ -248,14 +249,14 @@ * @see org.eclipse.swt.events.SelectionEvent */ public static final int Selection = 13; - + /** * The default selection event type (value is 14). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Combo#addSelectionListener * @see org.eclipse.swt.widgets.List#addSelectionListener * @see org.eclipse.swt.widgets.Spinner#addSelectionListener @@ -267,132 +268,132 @@ * @see org.eclipse.swt.events.SelectionEvent */ public static final int DefaultSelection = 14; - + /** * The focus in event type (value is 15). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Control#addFocusListener * @see org.eclipse.swt.events.FocusListener#focusGained * @see org.eclipse.swt.events.FocusEvent */ public static final int FocusIn = 15; - + /** * The focus out event type (value is 16). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Control#addFocusListener * @see org.eclipse.swt.events.FocusListener#focusLost * @see org.eclipse.swt.events.FocusEvent */ public static final int FocusOut = 16; - + /** * The expand event type (value is 17). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Tree#addTreeListener * @see org.eclipse.swt.events.TreeListener#treeExpanded * @see org.eclipse.swt.events.TreeEvent */ public static final int Expand = 17; - + /** * The collapse event type (value is 18). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Tree#addTreeListener * @see org.eclipse.swt.events.TreeListener#treeCollapsed * @see org.eclipse.swt.events.TreeEvent */ public static final int Collapse = 18; - + /** * The iconify event type (value is 19). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Shell#addShellListener * @see org.eclipse.swt.events.ShellListener#shellIconified * @see org.eclipse.swt.events.ShellEvent */ public static final int Iconify = 19; - + /** * The de-iconify event type (value is 20). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Shell#addShellListener * @see org.eclipse.swt.events.ShellListener#shellDeiconified * @see org.eclipse.swt.events.ShellEvent */ public static final int Deiconify = 20; - + /** * The close event type (value is 21). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Shell#addShellListener * @see org.eclipse.swt.events.ShellListener#shellClosed * @see org.eclipse.swt.events.ShellEvent */ public static final int Close = 21; - + /** * The show event type (value is 22). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Menu#addMenuListener * @see org.eclipse.swt.events.MenuListener#menuShown * @see org.eclipse.swt.events.MenuEvent */ public static final int Show = 22; - + /** * The hide event type (value is 23). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Menu#addMenuListener * @see org.eclipse.swt.events.MenuListener#menuHidden * @see org.eclipse.swt.events.MenuEvent */ public static final int Hide = 23; - + /** * The modify event type (value is 24). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Combo#addModifyListener * @see org.eclipse.swt.widgets.Spinner#addModifyListener * @see org.eclipse.swt.widgets.Text#addModifyListener @@ -400,14 +401,14 @@ * @see org.eclipse.swt.events.ModifyEvent */ public static final int Modify = 24; - + /** * The verify event type (value is 25). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.custom.CCombo#addVerifyListener * @see org.eclipse.swt.widgets.Combo#addVerifyListener * @see org.eclipse.swt.custom.StyledText#addVerifyListener @@ -416,40 +417,40 @@ * @see org.eclipse.swt.events.VerifyEvent */ public static final int Verify = 25; - + /** * The activate event type (value is 26). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Shell#addShellListener * @see org.eclipse.swt.events.ShellListener#shellActivated * @see org.eclipse.swt.events.ShellEvent */ public static final int Activate = 26; - + /** * The deactivate event type (value is 27). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Shell#addShellListener * @see org.eclipse.swt.events.ShellListener#shellDeactivated * @see org.eclipse.swt.events.ShellEvent */ - public static final int Deactivate = 27; - + public static final int Deactivate = 27; + /** * The help event type (value is 28). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Control#addHelpListener * @see org.eclipse.swt.widgets.Menu#addHelpListener * @see org.eclipse.swt.widgets.MenuItem#addHelpListener @@ -457,54 +458,54 @@ * @see org.eclipse.swt.events.HelpEvent */ public static final int Help = 28; - + /** * The drag detect event type (value is 29). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Control#addDragDetectListener * @see org.eclipse.swt.events.DragDetectListener#dragDetected * @see org.eclipse.swt.events.DragDetectEvent * @see org.eclipse.swt.dnd.DragSource */ public static final int DragDetect = 29; - + /** * The arm event type (value is 30). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.MenuItem#addArmListener * @see org.eclipse.swt.events.ArmListener#widgetArmed * @see org.eclipse.swt.events.ArmEvent */ public static final int Arm = 30; - + /** * The traverse event type (value is 31). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Control#addTraverseListener * @see org.eclipse.swt.events.TraverseListener#keyTraversed * @see org.eclipse.swt.events.TraverseEvent */ public static final int Traverse = 31; - + /** * The mouse hover event type (value is 32). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Control#addMouseTrackListener * @see org.eclipse.swt.events.MouseTrackListener#mouseHover * @see org.eclipse.swt.events.MouseEvent @@ -513,16 +514,16 @@ /** * The hardware key down event type (value is 33). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event */ public static final int HardKeyDown = 33; - + /** * The hardware key up event type (value is 34). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event @@ -531,66 +532,66 @@ /** * The menu detect event type (value is 35). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Control#addMenuDetectListener * @see org.eclipse.swt.widgets.TrayItem#addMenuDetectListener * @see org.eclipse.swt.events.MenuDetectListener#menuDetected * @see org.eclipse.swt.events.MenuDetectEvent - * + * * @since 3.0 */ public static final int MenuDetect = 35; - + /** * The set data event type (value is 36). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Table * @see org.eclipse.swt.widgets.Tree - * + * * @since 3.0 */ public static final int SetData = 36; /** * The mouse vertical wheel event type (value is 37). - * + * * @see org.eclipse.swt.widgets.Control#addMouseWheelListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @since 3.6 */ public static final int MouseVerticalWheel = 37; - + /** * The mouse horizontal wheel event type (value is 38). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @since 3.6 */ public static final int MouseHorizontalWheel = 38; - + /** * The mouse wheel event type (value is 37). - * This is a synonym for {@link #MouseVerticalWheel} (value is 37). - * Newer applications should use {@link #MouseVerticalWheel} instead + * This is a synonym for {@link #MouseVerticalWheel} (value is 37). + * Newer applications should use {@link #MouseVerticalWheel} instead * of {@link #MouseWheel} to make code more understandable. - * + * * @see org.eclipse.swt.widgets.Control#addMouseWheelListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @since 3.1 */ public static final int MouseWheel = MouseVerticalWheel; @@ -608,122 +609,122 @@ * cached value. The operating system automatically redraws and * lays out all widgets after this event is sent. * </p> - * + * * @see org.eclipse.swt.widgets.Display#addListener * @see org.eclipse.swt.widgets.Event - * + * * @since 3.2 */ public static final int Settings = 39; - + /** * The erase item event type (value is 40). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @since 3.2 */ public static final int EraseItem = 40; - + /** * The measure item event type (value is 41). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @since 3.2 */ public static final int MeasureItem = 41; - + /** * The paint item event type (value is 42). - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @since 3.2 */ - public static final int PaintItem = 42; - + public static final int PaintItem = 42; + /** - * The IME composition event type (value is 43). + * The IME composition event type (value is 43). * <p> * The IME composition event is sent to allow * custom text editors to implement in-line - * editing of international text. - * </p> - * + * editing of international text. + * </p> + * * The detail field indicates the action to be taken: * <p><ul> * <li>{@link SWT#COMPOSITION_CHANGED}</li> * <li>{@link SWT#COMPOSITION_OFFSET}</li> * <li>{@link SWT#COMPOSITION_SELECTION}</li> * </ul></p> - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @since 3.4 */ public static final int ImeComposition = 43; /** - * The orientation change event type (value is 44). + * The orientation change event type (value is 44). * <p> * On some platforms the orientation of text widgets * can be changed by keyboard shortcut. * The application can use the <code>doit</code> field * of the event to stop the change from happening. - * </p> - * + * </p> + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @since 3.6 */ public static final int OrientationChange = 44; /** * The skin event type (value is 45). - * + * * <p> * The skin event is sent by the display when a widget needs to - * be skinned. + * be skinned. * </p> - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event * @see org.eclipse.swt.widgets.Widget#reskin(int) - * + * * @since 3.6 */ public static final int Skin = 45; - + /** * The open document event type (value is 46). - * + * * <p> - * This event is sent when SWT receives notification that a document + * This event is sent when SWT receives notification that a document * should be opened. * </p> - * + * * @see org.eclipse.swt.widgets.Display#addListener * @see org.eclipse.swt.widgets.Event - * + * * @since 3.6 */ public static final int OpenDocument = 46; - + /** * The touch event type (value is 47). - * + * * <p> * This event is sent when a touch has been performed * on a touch-based input source. @@ -731,47 +732,47 @@ * * @see org.eclipse.swt.widgets.Display#addListener * @see org.eclipse.swt.widgets.Event - * + * * @since 3.7 */ public static final int Touch = 47; /** * The gesture event type (value is 48). - * + * * <p> * This event is sent when a gesture has been performed. * </p> - * + * * @see org.eclipse.swt.widgets.Display#addListener * @see org.eclipse.swt.widgets.Event * @see SWT#GESTURE_MAGNIFY * @see SWT#GESTURE_PAN * @see SWT#GESTURE_ROTATE * @see SWT#GESTURE_SWIPE - * + * * @since 3.7 */ public static final int Gesture = 48; /** * The segments event type (value is 49). - * + * * <p> * This event is sent when text content has been changed. * </p> - * + * * @see org.eclipse.swt.widgets.Widget#addListener * @see org.eclipse.swt.widgets.Display#addFilter * @see org.eclipse.swt.widgets.Event - * + * * @see org.eclipse.swt.widgets.Text#addSegmentListener * @see org.eclipse.swt.events.SegmentEvent - * + * * @since 3.8 */ public static final int Segments = 49; - + /** * The PreEvent event type (value is 50). * @@ -834,54 +835,54 @@ public static final int Sleep = PreExternalEventDispatch; /** - * @deprecated The same as PostExternalEventDispatch (value is 53). + * @deprecated The same as PostExternalEventDispatch (value is 53). * @since 3.103 */ @Deprecated public static final int Wakeup = PostExternalEventDispatch; /* Event Details */ - + /** * The IME composition event detail that indicates * a change in the IME composition. The text field - * of the event is the new composition text. + * of the event is the new composition text. * The start and end indicate the offsets where the * composition text should be inserted. - * The styles and ranges are stored in the IME + * The styles and ranges are stored in the IME * object (value is 1). - * + * * @see SWT#ImeComposition - * + * * @since 3.4 */ public static final int COMPOSITION_CHANGED = 1; - + /** * The IME composition event detail that indicates * that the IME needs the offset for a given location. - * The x and y fields of the event are used by the + * The x and y fields of the event are used by the * application to determine the offset. - * - * The index field of the event should be set to the - * text offset at that location. The count field should + * + * The index field of the event should be set to the + * text offset at that location. The count field should * be set to indicate whether the location is closer to * the leading edge (0) or the trailing edge (1) (value is 2). - * + * * @see SWT#ImeComposition * @see org.eclipse.swt.graphics.TextLayout#getOffset(int, int, int[]) - * + * * @since 3.4 */ public static final int COMPOSITION_OFFSET = 2; - + /** * The IME composition event detail that indicates * that IME needs the selected text and its start * and end offsets (value is 3). - * + * * @see SWT#ImeComposition - * + * * @since 3.4 */ public static final int COMPOSITION_SELECTION = 3; @@ -891,7 +892,7 @@ * for example dragging the thumb of a scroll bar (value is 1). */ public static final int DRAG = 1; - + /** * Event detail field that indicates a user-interface component * state is selected (value is 1<<1). @@ -899,15 +900,15 @@ * @since 3.2 */ public static final int SELECTED = 1 << 1; - + /** * Event detail field that indicates a user-interface component * state is focused (value is 1<<2). * * @since 3.2 - */ + */ public static final int FOCUSED = 1 << 2; - + /** * Event detail field that indicates a user-interface component * draws the background (value is 1<<3). @@ -915,7 +916,7 @@ * @since 3.2 */ public static final int BACKGROUND = 1 << 3; - + /** * Event detail field that indicates a user-interface component * draws the foreground (value is 1<<4). @@ -923,7 +924,7 @@ * @since 3.2 */ public static final int FOREGROUND = 1 << 4; - + /** * Event detail field that indicates a user-interface component * state is hot (value is 1<<5). @@ -931,7 +932,7 @@ * @since 3.3 */ public static final int HOT = 1 << 5; - + /* This code is intentionally commented */ //public static final int PRESSED = 1 << 3; //public static final int ACTIVE = 1 << 4; @@ -940,14 +941,14 @@ //public static final int DEFAULTED = 1 << 7; /** - * Traversal event detail field value indicating that no + * Traversal event detail field value indicating that no * traversal action should be taken * (value is 0). */ public static final int TRAVERSE_NONE = 0; - + /** - * Traversal event detail field value indicating that the + * Traversal event detail field value indicating that the * key which designates that a dialog should be cancelled was * pressed; typically, this is the ESC key * (value is 1<<1). @@ -963,7 +964,7 @@ public static final int TRAVERSE_RETURN = 1 << 2; /** - * Traversal event detail field value indicating that the + * Traversal event detail field value indicating that the * key which designates that focus should be given to the * previous tab group was pressed; typically, this is the * SHIFT-TAB key sequence @@ -972,7 +973,7 @@ public static final int TRAVERSE_TAB_PREVIOUS = 1 << 3; /** - * Traversal event detail field value indicating that the + * Traversal event detail field value indicating that the * key which designates that focus should be given to the * next tab group was pressed; typically, this is the * TAB key @@ -981,7 +982,7 @@ public static final int TRAVERSE_TAB_NEXT = 1 << 4; /** - * Traversal event detail field value indicating that the + * Traversal event detail field value indicating that the * key which designates that focus should be given to the * previous tab item was pressed; typically, this is either * the LEFT-ARROW or UP-ARROW keys @@ -990,7 +991,7 @@ public static final int TRAVERSE_ARROW_PREVIOUS = 1 << 5; /** - * Traversal event detail field value indicating that the + * Traversal event detail field value indicating that the * key which designates that focus should be given to the * previous tab item was pressed; typically, this is either * the RIGHT-ARROW or DOWN-ARROW keys @@ -999,23 +1000,23 @@ public static final int TRAVERSE_ARROW_NEXT = 1 << 6; /** - * Traversal event detail field value indicating that a + * Traversal event detail field value indicating that a * mnemonic key sequence was pressed * (value is 1<<7). */ public static final int TRAVERSE_MNEMONIC = 1 << 7; /** - * Traversal event detail field value indicating that the + * Traversal event detail field value indicating that the * key which designates that the previous page of a multi-page * window should be shown was pressed; typically, this * is the CTRL-PAGEUP key sequence * (value is 1<<8). */ public static final int TRAVERSE_PAGE_PREVIOUS = 1 << 8; - + /** - * Traversal event detail field value indicating that the + * Traversal event detail field value indicating that the * key which designates that the next page of a multi-page * window should be shown was pressed; typically, this * is the CTRL-PAGEDOWN key sequence @@ -1026,91 +1027,91 @@ /** * Gesture event detail field value indicating that a continuous * gesture is about to begin. - * + * * @since 3.7 */ public static final int GESTURE_BEGIN = 1 << 1; /** - * Gesture event detail field value indicating that a continuous + * Gesture event detail field value indicating that a continuous * gesture has ended. - * + * * @since 3.7 */ public static final int GESTURE_END = 1 << 2; /** - * Gesture event detail field value indicating that a + * Gesture event detail field value indicating that a * rotation gesture has happened. Only the rotation field * of the event is valid. - * + * * @since 3.7 */ public static final int GESTURE_ROTATE = 1 << 3; - + /** - * Gesture event detail field value indicating that a + * Gesture event detail field value indicating that a * swipe gesture has happened. - * + * * @since 3.7 */ public static final int GESTURE_SWIPE = 1 << 4; - + /** - * Gesture event detail field value indicating that a + * Gesture event detail field value indicating that a * magnification gesture has happened. - * + * * @since 3.7 */ public static final int GESTURE_MAGNIFY = 1 << 5; - + /** - * Gesture event detail field value indicating that a + * Gesture event detail field value indicating that a * panning (two-finger scroll) gesture has happened. - * + * * @since 3.7 */ public static final int GESTURE_PAN = 1 << 6; - + /** - * A constant indicating that a finger touched the device. - * + * A constant indicating that a finger touched the device. + * * @see org.eclipse.swt.widgets.Touch#state - * + * * @since 3.7 */ public static final int TOUCHSTATE_DOWN = 1 << 0; /** * A constant indicating that a finger moved on the device. - * + * * @see org.eclipse.swt.widgets.Touch#state - * + * * @since 3.7 */ public static final int TOUCHSTATE_MOVE = 1 << 1; /** - * A constant indicating that a finger was lifted from the device. - * + * A constant indicating that a finger was lifted from the device. + * * @see org.eclipse.swt.widgets.Touch#state - * + * * @since 3.7 */ public static final int TOUCHSTATE_UP = 1 << 2; - + /** * MenuDetect event detail value indicating that a context menu * was requested by a mouse or other pointing device (value is 0). - * + * * @since 3.8 */ public static final int MENU_MOUSE = 0; - + /** * MenuDetect event detail value indicating that a context menu * was requested by a keyboard or other focus-based device (value is 1). - * + * * @since 3.8 */ public static final int MENU_KEYBOARD = 1; @@ -1118,13 +1119,13 @@ /** * A constant indicating that widgets have changed. * (value is 1<<1). - * + * * <p><b>Used By:</b><ul> * <li><code>Composite</code> layout</li> * </ul></p> - * + * * @see org.eclipse.swt.widgets.Composite#layout(org.eclipse.swt.widgets.Control[], int) - * + * * @since 3.6 */ public static final int CHANGED = 1 << 1; @@ -1132,13 +1133,13 @@ /** * A constant indicating that a given operation should be deferred. * (value is 1<<2). - * + * * <p><b>Used By:</b><ul> * <li><code>Composite</code> layout</li> * </ul></p> - * + * * @see org.eclipse.swt.widgets.Composite#layout(org.eclipse.swt.widgets.Control[], int) - * + * * @since 3.6 */ public static final int DEFER = 1 << 2; @@ -1148,13 +1149,13 @@ * which take bit flags to indicate that "no bits are set". */ public static final int NONE = 0; - + /** * A constant known to be zero (0), used in operations which * take pointers to indicate a null argument. */ public static final int NULL = 0; - + /** * Indicates that a default should be used (value is -1). */ @@ -1162,28 +1163,28 @@ /** * Indicates that a property is off (value is 0). - * + * * @since 3.1 */ public static final int OFF = 0; - + /** * Indicates that a property is on (value is 1). - * + * * @since 3.1 */ public static final int ON = 1; /** * Indicates low quality (value is 1). - * + * * @since 3.1 */ public static final int LOW = 1; /** * Indicates high quality (value is 2). - * + * * @since 3.1 */ public static final int HIGH = 2; @@ -1343,7 +1344,7 @@ * <p><b>Used By:</b><ul> * <li><code>Text</code></li> * </ul></p> - * + * * @since 3.3 */ public static final int SEARCH = 1 << 7; @@ -1362,11 +1363,11 @@ * <p><b>Used By:</b><ul> * <li><code>Text</code></li> * </ul></p> - * + * * @since 3.0 */ public static final int PASSWORD = 1 << 22; - + /** * Style constant for shadow in behavior (value is 1<<2). * <br>Note that this is a <em>HINT</em>. @@ -1423,7 +1424,7 @@ * </ul></p> */ public static final int INDETERMINATE = 1 << 1; - + /** * Style constant for tool window behavior (value is 1<<2). * <p> @@ -1435,7 +1436,7 @@ * <li><code>Decorations</code> and subclasses</li> * </ul></p> */ - public static final int TOOL = 1 << 2; + public static final int TOOL = 1 << 2; /** * Style constant to ensure no trimmings are used (value is 1<<3). @@ -1445,7 +1446,7 @@ * </ul></p> */ public static final int NO_TRIM = 1 << 3; - + /** * Style constant for resize box trim (value is 1<<4). * <p><b>Used By:</b><ul> @@ -1498,6 +1499,18 @@ public static final int MAX = 1 << 10; /** + * Style constant for the no move behavior (value is 1<<23). + * Creates the title trim when no other trim style is specified. + * Doesn't create the title trim when NO_TRIM is specified. + * <p>Note that this is a <em>HINT</em>. + * <p><b>Used By:</b><ul> + * <li><code>Shell</code></li> + * </ul></p> + * @since 3.105 + */ + public static final int NO_MOVE = 1 << 23; + + /** * Style constant for horizontal scrollbar behavior (value is 1<<8). * <p><b>Used By:</b><ul> * <li><code>Scrollable</code> and subclasses</li> @@ -1520,7 +1533,7 @@ * are free to create the default scroll bars for the control. * Using NO_SCROLL overrides the default and forces the control * to have no scroll bars. - * + * * <b>Used By:</b><ul> * <li><code>Tree</code></li> * <li><code>Table</code></li> @@ -1529,7 +1542,7 @@ * @since 3.4 */ public static final int NO_SCROLL = 1 << 4; - + /** * Style constant for bordered behavior (value is 1<<11). * <br>Note that this is a <em>HINT</em>. @@ -1547,7 +1560,7 @@ * <li><code>Control</code> and subclasses</li> * </ul></p> */ - public static final int CLIP_CHILDREN = 1 << 12; + public static final int CLIP_CHILDREN = 1 << 12; /** * Style constant indicating that the window manager should clip @@ -1567,7 +1580,7 @@ * </ul></p> */ public static final int ON_TOP = 1 << 14; - + /** * Style constant for sheet window behavior (value is 1<<28). * <p> @@ -1582,7 +1595,7 @@ * <li><code>Dialog</code> and subclasses</li> * <li><code>Shell</code> and subclasses</li> * </ul></p> - * + * * @since 3.5 */ public static final int SHEET = 1 << 28; @@ -1655,15 +1668,15 @@ public static final int HIDE_SELECTION = 1 << 15; /** - * Style constant for full row selection behavior and - * selection constant indicating that a full line should be + * Style constant for full row selection behavior and + * selection constant indicating that a full line should be * drawn. (value is 1<<16). * <br>Note that for some widgets this is a <em>HINT</em>. * <p><b>Used By:</b><ul> * <li><code>Table</code></li> * <li><code>Tree</code></li> * <li><code>StyledText</code></li> - * <li><code>TextLayout</code></li> + * <li><code>TextLayout</code></li> * </ul></p> */ public static final int FULL_SELECTION = 1 << 16; @@ -1710,7 +1723,7 @@ * tool bars and sashes, don't normally take focus when the mouse is clicked * or accept focus when assigned from within the program. This style allows * Composites to implement "no focus" mouse behavior. - * + * * <br>Note that this is a <em>HINT</em>. * </p> * <p><b>Used By:</b><ul> @@ -1727,7 +1740,7 @@ * the SWT.Paint event is not sent. When it gets bigger, an SWT.Paint event is * sent with a GC clipped to only the new areas to be painted. Without this * style, the entire client area will be repainted. - * + * * <br>Note that this is a <em>HINT</em>. * </p><p><b>Used By:</b><ul> * <li><code>Composite</code></li> @@ -1737,7 +1750,7 @@ /** * Style constant for no paint event merging behavior (value is 1<<21). - * + * * <br>Note that this is a <em>HINT</em>. * <p><b>Used By:</b><ul> * <li><code>Composite</code></li> @@ -1753,7 +1766,7 @@ * </ul></p> */ public static final int NO_RADIO_GROUP = 1 << 22; - + /** * Style constant for left to right orientation (value is 1<<25). * <p> @@ -1767,13 +1780,13 @@ * <p><b>Used By:</b><ul> * <li><code>Control</code></li> * <li><code>Menu</code></li> - * <li><code>GC</code></li> + * <li><code>GC</code></li> * </ul></p> - * + * * @since 2.1.2 */ public static final int LEFT_TO_RIGHT = 1 << 25; - + /** * Style constant for right to left orientation (value is 1<<26). * <p> @@ -1787,41 +1800,41 @@ * <p><b>Used By:</b><ul> * <li><code>Control</code></li> * <li><code>Menu</code></li> - * <li><code>GC</code></li> + * <li><code>GC</code></li> * </ul></p> - * + * * @since 2.1.2 */ public static final int RIGHT_TO_LEFT = 1 << 26; - + /** * Style constant to indicate coordinate mirroring (value is 1<<27). * <p><b>Used By:</b><ul> * <li><code>Control</code></li> * <li><code>Menu</code></li> * </ul></p> - * + * * @since 2.1.2 */ public static final int MIRRORED = 1 << 27; - + /** * Style constant to allow embedding (value is 1<<24). * <p><b>Used By:</b><ul> * <li><code>Composite</code></li> * </ul></p> - * + * * @since 3.0 */ public static final int EMBEDDED = 1 << 24; - + /** * Style constant to allow virtual data (value is 1<<28). * <p><b>Used By:</b><ul> * <li><code>Table</code></li> * <li><code>Tree</code></li> * </ul></p> - * + * * @since 3.0 */ public static final int VIRTUAL = 1 << 28; @@ -1831,11 +1844,11 @@ * <p><b>Used By:</b><ul> * <li><code>Control</code></li> * </ul></p> - * + * * @since 3.1 */ public static final int DOUBLE_BUFFERED = 1 << 29; - + /** * Style constant for transparent behavior (value is 1<<30). * <p> @@ -1847,11 +1860,11 @@ * </ul></p> * * @since 3.4 - * + * * WARNING: THIS API IS UNDER CONSTRUCTION AND SHOULD NOT BE USED */ public static final int TRANSPARENT = 1 << 30; - + /** * Style constant to indicate base text direction (value is 1<<31). * <p> @@ -1861,32 +1874,51 @@ * <p><b>Used By:</b><ul> * <li><code>Control</code></li> * </ul></p> - * + * * @see org.eclipse.swt.widgets.Control#setTextDirection(int) * @see org.eclipse.swt.widgets.Control#getTextDirection() - * + * * @since 3.102 */ public static final int FLIP_TEXT_DIRECTION = 1 << 31; /** - * Style constant for align up behavior (value is 1<<7, - * since align UP and align TOP are considered the same). + * A bit mask to indicate Bidi "auto" text direction. + * <p> + * When the bit is set, text direction is derived from the direction of the + * first strong Bidi character. + * </p> + * <br>Note that this is a <em>HINT</em> and it works on Windows only. * <p><b>Used By:</b><ul> - * <li><code>Button</code> with <code>ARROW</code> style</li> - * <li><code>Tracker</code></li> - * <li><code>Table</code></li> - * <li><code>Tree</code></li> + * <li><code>Control</code></li> + * <li><code>TextLayout</code></li> + * </ul></p> + * + * @see org.eclipse.swt.widgets.Control#setTextDirection(int) + * @see org.eclipse.swt.graphics.TextLayout#setTextDirection(int) + * + * @since 3.105 + */ + public static final int AUTO_TEXT_DIRECTION = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT; + + /** + * Style constant for align up behavior (value is 1<<7, + * since align UP and align TOP are considered the same). + * <p><b>Used By:</b><ul> + * <li><code>Button</code> with <code>ARROW</code> style</li> + * <li><code>Tracker</code></li> + * <li><code>Table</code></li> + * <li><code>Tree</code></li> * </ul></p> */ public static final int UP = 1 << 7; - + /** * Style constant to indicate single underline (value is 0). * <p><b>Used By:</b><ul> * <li><code>TextStyle</code></li> * </ul></p> - * + * * @since 3.4 */ public static final int UNDERLINE_SINGLE = 0; @@ -1896,31 +1928,31 @@ * <p><b>Used By:</b><ul> * <li><code>TextStyle</code></li> * </ul></p> - * + * * @since 3.4 */ public static final int UNDERLINE_DOUBLE = 1; - + /** * Style constant to indicate error underline (value is 2). * <p><b>Used By:</b><ul> * <li><code>TextStyle</code></li> * </ul></p> - * + * * @since 3.4 */ public static final int UNDERLINE_ERROR = 2; - + /** * Style constant to indicate squiggle underline (value is 3). * <p><b>Used By:</b><ul> * <li><code>TextStyle</code></li> * </ul></p> - * + * * @since 3.4 */ public static final int UNDERLINE_SQUIGGLE = 3; - + /** * Style constant to indicate link underline (value is 0). * <p> @@ -1934,7 +1966,7 @@ * <p><b>Used By:</b><ul> * <li><code>TextStyle</code></li> * </ul></p> - * + * * @since 3.5 */ public static final int UNDERLINE_LINK = 4; @@ -1944,7 +1976,7 @@ * <p><b>Used By:</b><ul> * <li><code>TextStyle</code></li> * </ul></p> - * + * * @since 3.4 */ public static final int BORDER_SOLID = 1; @@ -1954,21 +1986,21 @@ * <p><b>Used By:</b><ul> * <li><code>TextStyle</code></li> * </ul></p> - * + * * @since 3.4 */ public static final int BORDER_DASH = 2; - + /** * Style constant to indicate dotted border (value is 4). * <p><b>Used By:</b><ul> * <li><code>TextStyle</code></li> * </ul></p> - * + * * @since 3.4 */ public static final int BORDER_DOT = 4; - + /** * Style constant for align top behavior (value is 1<<7, * since align UP and align TOP are considered the same). @@ -2011,18 +2043,18 @@ * <li><code>Tracker</code></li> * <li><code>FormAttachment</code> in a <code>FormLayout</code></li> * </ul></p> - * + * * @since 2.1.2 */ public static final int LEAD = 1 << 14; - + /** * Style constant for align left behavior (value is 1<<14). * This is a synonym for {@link #LEAD} (value is 1<<14). Newer * applications should use {@link #LEAD} instead of {@link #LEFT} to make code more * understandable on right-to-left platforms. * <p> - * This constant can also be used to representing the left keyboard + * This constant can also be used to representing the left keyboard * location during a key event. * </p> */ @@ -2039,18 +2071,18 @@ * <li><code>Tracker</code></li> * <li><code>FormAttachment</code> in a <code>FormLayout</code></li> * </ul></p> - * + * * @since 2.1.2 */ public static final int TRAIL = 1 << 17; - + /** * Style constant for align right behavior (value is 1<<17). * This is a synonym for {@link #TRAIL} (value is 1<<17). Newer * applications should use {@link #TRAIL} instead of {@link #RIGHT} to make code more * understandable on right-to-left platforms. * <p> - * This constant can also be used to representing the right keyboard + * This constant can also be used to representing the right keyboard * location during a key event. * </p> */ @@ -2105,7 +2137,7 @@ * <p><b>Used By:</b><ul> * <li><code>DateTime</code></li> * </ul></p> - * + * * @since 3.3 */ public static final int DATE = 1 << 5; @@ -2115,17 +2147,17 @@ * <p><b>Used By:</b><ul> * <li><code>DateTime</code></li> * </ul></p> - * + * * @since 3.3 */ public static final int TIME = 1 << 7; - + /** * Style constant for calendar display (value is 1<<10). * <p><b>Used By:</b><ul> * <li><code>DateTime</code></li> * </ul></p> - * + * * @since 3.3 */ public static final int CALENDAR = 1 << 10; @@ -2140,7 +2172,7 @@ * <p><b>Used By:</b><ul> * <li><code>DateTime</code></li> * </ul></p> - * + * * @since 3.3 */ public static final int SHORT = 1 << 15; @@ -2155,7 +2187,7 @@ * <p><b>Used By:</b><ul> * <li><code>DateTime</code></li> * </ul></p> - * + * * @since 3.3 */ public static final int MEDIUM = 1 << 16; @@ -2171,7 +2203,7 @@ * <p><b>Used By:</b><ul> * <li><code>DateTime</code></li> * </ul></p> - * + * * @since 3.3 */ public static final int LONG = 1 << 28; @@ -2183,7 +2215,7 @@ * <p><b>Used By:</b><ul> * <li><code>Browser</code></li> * </ul></p> - * + * * @since 3.3 */ public static final int MOZILLA = 1 << 15; @@ -2195,7 +2227,7 @@ * <p><b>Used By:</b><ul> * <li><code>Browser</code></li> * </ul></p> - * + * * @since 3.7 */ public static final int WEBKIT = 1 << 16; @@ -2207,9 +2239,9 @@ * </ul></p> * * @since 3.2 - */ + */ public static final int BALLOON = 1 << 12; - + /** * Style constant for vertical alignment or orientation behavior (value is 1). * <p><b>Used By:</b><ul> @@ -2217,7 +2249,7 @@ * </ul></p> */ public static final int BEGINNING = 1; - + /** * Style constant for vertical alignment or orientation behavior (value is 4). * <p><b>Used By:</b><ul> @@ -2225,7 +2257,7 @@ * </ul></p> */ public static final int FILL = 4; - + /** * Input Method Editor style constant for double byte * input behavior (value is 1<<1). @@ -2273,7 +2305,7 @@ * (value is the <code>char</code> with value 127). */ public static final char DEL = 0x7F; - + /** * ASCII character convenience constant for the escape character * (value is the <code>char</code> with value 27). @@ -2289,33 +2321,33 @@ /** * ASCII character convenience constant for the tab character * (value is the <code>char</code> '\t'). - * + * * @since 2.1 */ public static final char TAB = '\t'; - + /** * ASCII character convenience constant for the space character * (value is the <code>char</code> ' '). - * + * * @since 3.7 */ public static final char SPACE = ' '; - + /** * keyboard and/or mouse event mask indicating that the ALT key * was pushed on the keyboard when the event was generated * (value is 1<<16). */ public static final int ALT = 1 << 16; - + /** * Keyboard and/or mouse event mask indicating that the SHIFT key * was pushed on the keyboard when the event was generated * (value is 1<<17). */ public static final int SHIFT = 1 << 17; - + /** * Keyboard and/or mouse event mask indicating that the CTRL key * was pushed on the keyboard when the event was generated @@ -2334,27 +2366,27 @@ * Keyboard and/or mouse event mask indicating that the COMMAND key * was pushed on the keyboard when the event was generated * (value is 1<<22). - * + * * @since 2.1 */ public static final int COMMAND = 1 << 22; - + /** * Keyboard and/or mouse event mask indicating all possible * keyboard modifiers. - * - * To allow for the future, this mask is intended to be used in - * place of code that references each individual keyboard mask. - * For example, the following expression will determine whether - * any modifier is pressed and will continue to work as new modifier + * + * To allow for the future, this mask is intended to be used in + * place of code that references each individual keyboard mask. + * For example, the following expression will determine whether + * any modifier is pressed and will continue to work as new modifier * masks are added. - * + * * <code>(stateMask & SWT.MODIFIER_MASK) != 0</code>. - * + * * @since 2.1 */ public static final int MODIFIER_MASK; - + /** * Keyboard and/or mouse event mask indicating that mouse button one (usually 'left') * was pushed when the event was generated. (value is 1<<19). @@ -2376,7 +2408,7 @@ /** * Keyboard and/or mouse event mask indicating that mouse button four * was pushed when the event was generated. (value is 1<<23). - * + * * @since 3.1 */ public static final int BUTTON4 = 1 << 23; @@ -2384,7 +2416,7 @@ /** * Keyboard and/or mouse event mask indicating that mouse button five * was pushed when the event was generated. (value is 1<<25). - * + * * @since 3.1 */ public static final int BUTTON5 = 1 << 25; @@ -2392,41 +2424,41 @@ /** * Keyboard and/or mouse event mask indicating all possible * mouse buttons. - * - * To allow for the future, this mask is intended to be used - * in place of code that references each individual button mask. + * + * To allow for the future, this mask is intended to be used + * in place of code that references each individual button mask. * For example, the following expression will determine whether - * any button is pressed and will continue to work as new button + * any button is pressed and will continue to work as new button * masks are added. - * + * * <code>(stateMask & SWT.BUTTON_MASK) != 0</code>. - * + * * @since 2.1 */ public static final int BUTTON_MASK; - + /** * Keyboard and/or mouse event mask indicating that the MOD1 key * was pushed on the keyboard when the event was generated. - * + * * This is the primary keyboard modifier for the platform. * <p> * {@link #CTRL} on most platforms ({@link #COMMAND} on the Mac). * </p> - * + * * @since 2.1 */ public static final int MOD1; - + /** * Keyboard and/or mouse event mask indicating that the MOD2 key * was pushed on the keyboard when the event was generated. - * + * * This is the secondary keyboard modifier for the platform. * <p> * {@link #SHIFT} on most platforms. * </p> - * + * * @since 2.1 */ public static final int MOD2; @@ -2437,7 +2469,7 @@ * <p> * {@link #ALT} on most platforms. * </p> - * + * * @since 2.1 */ public static final int MOD3; @@ -2448,17 +2480,17 @@ * <p> * Undefined on most platforms ({@link #CTRL} on the Mac). * </p> - * + * * @since 2.1 */ public static final int MOD4; - + /** * Constants to indicate line scrolling (value is 1). * <p><b>Used By:</b><ul> * <li><code>Control</code></li> * </ul></p> - * + * * @since 3.1 */ public static final int SCROLL_LINE = 1; @@ -2468,46 +2500,46 @@ * <p><b>Used By:</b><ul> * <li><code>Control</code></li> * </ul></p> - * + * * @since 3.1 */ public static final int SCROLL_PAGE = 2; - + /** * Accelerator constant used to differentiate a key code from a * unicode character. - * + * * If this bit is set, then the key stroke * portion of an accelerator represents a key code. If this bit * is not set, then the key stroke portion of an accelerator is * a unicode character. - * + * * The following expression is false: - * + * * <code>((SWT.MOD1 | SWT.MOD2 | 'T') & SWT.KEYCODE_BIT) != 0</code>. - * + * * The following expression is true: - * + * * <code>((SWT.MOD3 | SWT.F2) & SWT.KEYCODE_BIT) != 0</code>. - * + * * (value is (1<<24)) - * + * * @since 2.1 - */ + */ public static final int KEYCODE_BIT = (1 << 24); /** * Accelerator constant used to extract the key stroke portion of * an accelerator. - * + * * The key stroke may be a key code or a unicode * value. If the key stroke is a key code <code>KEYCODE_BIT</code> * will be set. - * + * * @since 2.1 - */ + */ public static final int KEY_MASK = KEYCODE_BIT + 0xFFFF; - + /** * Keyboard event constant representing the UP ARROW key * (value is (1<<24)+1). @@ -2567,67 +2599,67 @@ * (value is (1<<24)+10). */ public static final int F1 = KEYCODE_BIT + 10; - + /** * Keyboard event constant representing the F2 key * (value is (1<<24)+11). */ public static final int F2 = KEYCODE_BIT + 11; - + /** * Keyboard event constant representing the F3 key * (value is (1<<24)+12). */ public static final int F3 = KEYCODE_BIT + 12; - + /** * Keyboard event constant representing the F4 key * (value is (1<<24)+13). */ public static final int F4 = KEYCODE_BIT + 13; - + /** * Keyboard event constant representing the F5 key * (value is (1<<24)+14). */ public static final int F5 = KEYCODE_BIT + 14; - + /** * Keyboard event constant representing the F6 key * (value is (1<<24)+15). */ public static final int F6 = KEYCODE_BIT + 15; - + /** * Keyboard event constant representing the F7 key * (value is (1<<24)+16). */ public static final int F7 = KEYCODE_BIT + 16; - + /** * Keyboard event constant representing the F8 key * (value is (1<<24)+17). */ public static final int F8 = KEYCODE_BIT + 17; - + /** * Keyboard event constant representing the F9 key * (value is (1<<24)+18). */ public static final int F9 = KEYCODE_BIT + 18; - + /** * Keyboard event constant representing the F10 key * (value is (1<<24)+19). */ public static final int F10 = KEYCODE_BIT + 19; - + /** * Keyboard event constant representing the F11 key * (value is (1<<24)+20). */ public static final int F11 = KEYCODE_BIT + 20; - + /** * Keyboard event constant representing the F12 key * (value is (1<<24)+21). @@ -2637,98 +2669,98 @@ /** * Keyboard event constant representing the F13 key * (value is (1<<24)+22). - * + * * @since 3.0 */ public static final int F13 = KEYCODE_BIT + 22; - + /** * Keyboard event constant representing the F14 key * (value is (1<<24)+23). - * + * * @since 3.0 */ public static final int F14 = KEYCODE_BIT + 23; - + /** * Keyboard event constant representing the F15 key * (value is (1<<24)+24). - * + * * @since 3.0 */ public static final int F15 = KEYCODE_BIT + 24; - + /** * Keyboard event constant representing the F16 key * (value is (1<<25)+25). - * + * * @since 3.6 */ public static final int F16 = KEYCODE_BIT + 25; - + /** * Keyboard event constant representing the F17 key * (value is (1<<26)+26). - * + * * @since 3.6 */ public static final int F17 = KEYCODE_BIT + 26; - + /** * Keyboard event constant representing the F18 key * (value is (1<<27)+27). - * + * * @since 3.6 */ public static final int F18 = KEYCODE_BIT + 27; - + /** * Keyboard event constant representing the F19 key * (value is (1<<28)+28). - * + * * @since 3.6 */ public static final int F19 = KEYCODE_BIT + 28; - + /** * Keyboard event constant representing the F20 key * (value is (1<<29)+29). - * + * * @since 3.6 */ public static final int F20 = KEYCODE_BIT + 29; - + /** * Keyboard event constant representing the keypad location. * (value is 1<<1). - * + * * @since 3.6 */ public static final int KEYPAD = 1 << 1; - + /** * Keyboard event constant representing the numeric key * pad multiply key (value is (1<<24)+42). - * + * * @since 3.0 */ public static final int KEYPAD_MULTIPLY = KEYCODE_BIT + 42; - + /** * Keyboard event constant representing the numeric key * pad add key (value is (1<<24)+43). - * + * * @since 3.0 */ public static final int KEYPAD_ADD = KEYCODE_BIT + 43; - + /** * Keyboard event constant representing the numeric key * pad subtract key (value is (1<<24)+45). - * + * * @since 3.0 */ public static final int KEYPAD_SUBTRACT = KEYCODE_BIT + 45; @@ -2736,7 +2768,7 @@ /** * Keyboard event constant representing the numeric key * pad decimal key (value is (1<<24)+46). - * + * * @since 3.0 */ public static final int KEYPAD_DECIMAL = KEYCODE_BIT + 46; @@ -2744,7 +2776,7 @@ /** * Keyboard event constant representing the numeric key * pad divide key (value is (1<<24)+47). - * + * * @since 3.0 */ public static final int KEYPAD_DIVIDE = KEYCODE_BIT + 47; @@ -2752,7 +2784,7 @@ /** * Keyboard event constant representing the numeric key * pad zero key (value is (1<<24)+48). - * + * * @since 3.0 */ public static final int KEYPAD_0 = KEYCODE_BIT + 48; @@ -2760,7 +2792,7 @@ /** * Keyboard event constant representing the numeric key * pad one key (value is (1<<24)+49). - * + * * @since 3.0 */ public static final int KEYPAD_1 = KEYCODE_BIT + 49; @@ -2768,7 +2800,7 @@ /** * Keyboard event constant representing the numeric key * pad two key (value is (1<<24)+50). - * + * * @since 3.0 */ public static final int KEYPAD_2 = KEYCODE_BIT + 50; @@ -2776,7 +2808,7 @@ /** * Keyboard event constant representing the numeric key * pad three key (value is (1<<24)+51). - * + * * @since 3.0 */ public static final int KEYPAD_3 = KEYCODE_BIT + 51; @@ -2784,23 +2816,23 @@ /** * Keyboard event constant representing the numeric key * pad four key (value is (1<<24)+52). - * + * * @since 3.0 */ public static final int KEYPAD_4 = KEYCODE_BIT + 52; - + /** * Keyboard event constant representing the numeric key * pad five key (value is (1<<24)+53). - * + * * @since 3.0 */ public static final int KEYPAD_5 = KEYCODE_BIT + 53; - + /** * Keyboard event constant representing the numeric key * pad six key (value is (1<<24)+54). - * + * * @since 3.0 */ public static final int KEYPAD_6 = KEYCODE_BIT + 54; @@ -2808,7 +2840,7 @@ /** * Keyboard event constant representing the numeric key * pad seven key (value is (1<<24)+55). - * + * * @since 3.0 */ public static final int KEYPAD_7 = KEYCODE_BIT + 55; @@ -2816,15 +2848,15 @@ /** * Keyboard event constant representing the numeric key * pad eight key (value is (1<<24)+56). - * + * * @since 3.0 */ public static final int KEYPAD_8 = KEYCODE_BIT + 56; - + /** * Keyboard event constant representing the numeric key * pad nine key (value is (1<<24)+57). - * + * * @since 3.0 */ public static final int KEYPAD_9 = KEYCODE_BIT + 57; @@ -2832,82 +2864,82 @@ /** * Keyboard event constant representing the numeric key * pad equal key (value is (1<<24)+61). - * + * * @since 3.0 */ public static final int KEYPAD_EQUAL = KEYCODE_BIT + 61; - + /** * Keyboard event constant representing the numeric key * pad enter key (value is (1<<24)+80). - * + * * @since 3.0 */ public static final int KEYPAD_CR = KEYCODE_BIT + 80; - + /** * Keyboard event constant representing the help * key (value is (1<<24)+81). - * + * * NOTE: The HELP key maps to the key labeled "help", * not "F1". If your keyboard does not have a HELP key, * you will never see this key press. To listen for * help on a control, use SWT.Help. - * + * * @since 3.0 - * + * * @see SWT#Help */ public static final int HELP = KEYCODE_BIT + 81; - + /** * Keyboard event constant representing the caps * lock key (value is (1<<24)+82). - * + * * @since 3.0 */ public static final int CAPS_LOCK = KEYCODE_BIT + 82; - + /** * Keyboard event constant representing the num * lock key (value is (1<<24)+83). - * + * * @since 3.0 */ public static final int NUM_LOCK = KEYCODE_BIT + 83; - + /** * Keyboard event constant representing the scroll * lock key (value is (1<<24)+84). - * + * * @since 3.0 */ public static final int SCROLL_LOCK = KEYCODE_BIT + 84; - + /** * Keyboard event constant representing the pause * key (value is (1<<24)+85). - * + * * @since 3.0 */ public static final int PAUSE = KEYCODE_BIT + 85; - + /** * Keyboard event constant representing the break * key (value is (1<<24)+86). - * + * * @since 3.0 */ public static final int BREAK = KEYCODE_BIT + 86; - + /** * Keyboard event constant representing the print screen * key (value is (1<<24)+87). - * + * * @since 3.0 */ public static final int PRINT_SCREEN = KEYCODE_BIT + 87; - + /** * The <code>MessageBox</code> style constant for error icon * behavior (value is 1). @@ -2937,41 +2969,41 @@ * behavior (value is 1<<4). */ public static final int ICON_WORKING = 1 << 4; - + /** - * The style constant for "search" icon. This style constant is + * The style constant for "search" icon. This style constant is * used with <code>Text</code> in combination with <code>SWT.SEARCH * </code> (value is 1<<9). - * <br>Note that this is a <em>HINT</em>. - * + * <br>Note that this is a <em>HINT</em>. + * * <p><b>Used By:</b><ul> * <li><code>Text</code></li> * </ul></p> - * + * * @see #SEARCH * @see #ICON_CANCEL - * + * * @since 3.5 */ public static final int ICON_SEARCH = 1 << 9; - + /** - * The style constant for "cancel" icon. This style constant is + * The style constant for "cancel" icon. This style constant is * used with <code>Text</code> in combination with <code>SWT.SEARCH * </code> (value is 1<<8). - * <br>Note that this is a <em>HINT</em>. - * + * <br>Note that this is a <em>HINT</em>. + * * <p><b>Used By:</b><ul> * <li><code>Text</code></li> * </ul></p> - * + * * @see #SEARCH * @see #ICON_SEARCH - * + * * @since 3.5 */ public static final int ICON_CANCEL = 1 << 8; - + /** * The <code>MessageBox</code> style constant for an OK button; @@ -2998,7 +3030,7 @@ * The <code>MessageBox</code> style constant for a CANCEL button; * valid combinations are OK|CANCEL, YES|NO|CANCEL, RETRY|CANCEL * (value is 1<<8). - * + * * <p><b>Used By:</b><ul> * <li><code>MessageBox</code></li> * </ul></p> @@ -3046,7 +3078,7 @@ * @since 3.2 */ public static final int INHERIT_NONE = 0; - + /** * The <code>Composite</code> constant to indicate that * an attribute (such as background) is inherited by @@ -3058,7 +3090,7 @@ * @since 3.2 */ public static final int INHERIT_DEFAULT = 1; - + /** * The <code>Composite</code> constant to indicate that * an attribute (such as background) is inherited by @@ -3067,7 +3099,7 @@ * @since 3.2 */ public static final int INHERIT_FORCE = 2; - + /** * Default color white (value is 1). */ @@ -3147,7 +3179,7 @@ * Default color dark gray (value is 16). */ public static final int COLOR_DARK_GRAY = 16; - + /* * System Colors * @@ -3163,7 +3195,7 @@ * It is expected that the list of supported colors * will grow over time. */ - + /** * System color used to paint dark shadow areas (value is 17). */ @@ -3228,7 +3260,7 @@ * System color used to paint tooltip background areas (value is 29). */ public static final int COLOR_INFO_BACKGROUND = 29; - + /** * System color used to paint title text (value is 30). */ @@ -3243,7 +3275,7 @@ * System color used to paint title background gradient (value is 32). */ public static final int COLOR_TITLE_BACKGROUND_GRADIENT = 32; - + /** * System color used to paint inactive title text (value is 33). */ @@ -3261,11 +3293,11 @@ /** * System color used to paint link text (value is 36). - * + * * @since 3.102 */ public static final int COLOR_LINK_FOREGROUND = 36; - + /** * System color used to paint with alpha 0 (value is 37). * <p> @@ -3282,11 +3314,11 @@ * background on Windows only whereas {@link org.eclipse.swt.widgets.Table * Table} supports transparent background on GTK3 only.</li> * </ul> - * + * * @since 3.104 */ public static final int COLOR_TRANSPARENT = 37; - + /** * Draw constant indicating whether the drawing operation * should fill the background (value is 1<<0). @@ -3309,164 +3341,164 @@ * Draw constant indicating whether the string drawing operation * should handle mnemonics (value is 1<<3). */ - public static final int DRAW_MNEMONIC = 1 << 3; + public static final int DRAW_MNEMONIC = 1 << 3; + - /** - * Selection constant indicating that a line delimiter should be + * Selection constant indicating that a line delimiter should be * drawn (value is 1<<17). - * + * * <p><b>Used By:</b><ul> * <li><code>TextLayout</code></li> * </ul></p> * * @see #FULL_SELECTION * @see #LAST_LINE_SELECTION - * + * * @since 3.3 */ public static final int DELIMITER_SELECTION = 1 << 17; - + /** * Selection constant indicating that the last line is selected - * to the end and should be drawn using either a line delimiter + * to the end and should be drawn using either a line delimiter * or full line selection (value is 1<<20). - * + * * <p><b>Used By:</b><ul> * <li><code>TextLayout</code></li> * </ul></p> - * + * * @see #DELIMITER_SELECTION * @see #FULL_SELECTION - * + * * @since 3.3 */ public static final int LAST_LINE_SELECTION = 1 << 20; - - /** + + /** * SWT error constant indicating that no error number was specified * (value is 1). */ public static final int ERROR_UNSPECIFIED = 1; - - /** + + /** * SWT error constant indicating that no more handles for an * operating system resource are available * (value is 2). */ public static final int ERROR_NO_HANDLES = 2; - - /** + + /** * SWT error constant indicating that no more callback resources are available * (value is 3). */ public static final int ERROR_NO_MORE_CALLBACKS = 3; - - /** + + /** * SWT error constant indicating that a null argument was passed in - * (value is 4). + * (value is 4). */ public static final int ERROR_NULL_ARGUMENT = 4; - - /** + + /** * SWT error constant indicating that an invalid argument was passed in * (value is 5). */ public static final int ERROR_INVALID_ARGUMENT = 5; - - /** + + /** * SWT error constant indicating that a value was found to be * outside the allowable range * (value is 6). */ public static final int ERROR_INVALID_RANGE = 6; - - /** - * SWT error constant indicating that a value which can not be + + /** + * SWT error constant indicating that a value which can not be * zero was found to be * (value is 7). */ public static final int ERROR_CANNOT_BE_ZERO = 7; - - /** + + /** * SWT error constant indicating that the underlying operating * system was unable to provide the value of an item * (value is 8). */ public static final int ERROR_CANNOT_GET_ITEM = 8; - - /** + + /** * SWT error constant indicating that the underlying operating * system was unable to provide the selection * (value is 9). */ public static final int ERROR_CANNOT_GET_SELECTION = 9; - /** + /** * SWT error constant indicating that the matrix is not invertible * (value is 10). - * + * * @since 3.1 */ public static final int ERROR_CANNOT_INVERT_MATRIX = 10; - /** + /** * SWT error constant indicating that the underlying operating * system was unable to provide the height of an item * (value is 11). */ public static final int ERROR_CANNOT_GET_ITEM_HEIGHT = 11; - /** + /** * SWT error constant indicating that the underlying operating * system was unable to provide the text of a widget * (value is 12). */ public static final int ERROR_CANNOT_GET_TEXT = 12; - /** + /** * SWT error constant indicating that the underlying operating * system was unable to set the text of a widget * (value is 13). */ public static final int ERROR_CANNOT_SET_TEXT = 13; - /** + /** * SWT error constant indicating that the underlying operating * system was unable to add an item * (value is 14). */ public static final int ERROR_ITEM_NOT_ADDED = 14; - /** + /** * SWT error constant indicating that the underlying operating * system was unable to remove an item * (value is 15). */ public static final int ERROR_ITEM_NOT_REMOVED = 15; - /** + /** * SWT error constant indicating that the graphics library * is not available * (value is 16). */ public static final int ERROR_NO_GRAPHICS_LIBRARY = 16; - /** + /** * SWT error constant indicating that a particular feature has * not been implemented on this platform * (value is 20). */ public static final int ERROR_NOT_IMPLEMENTED = 20; - /** + /** * SWT error constant indicating that a menu which needed * to have the drop down style had some other style instead * (value is 21). */ public static final int ERROR_MENU_NOT_DROP_DOWN = 21; - /** + /** * SWT error constant indicating that an attempt was made to * invoke an SWT operation which can only be executed by the * user-interface thread from some other thread @@ -3474,99 +3506,99 @@ */ public static final int ERROR_THREAD_INVALID_ACCESS = 22; - /** + /** * SWT error constant indicating that an attempt was made to * invoke an SWT operation using a widget which had already * been disposed - * (value is 24). + * (value is 24). */ public static final int ERROR_WIDGET_DISPOSED = 24; - /** + /** * SWT error constant indicating that a menu item which needed * to have the cascade style had some other style instead * (value is 27). */ public static final int ERROR_MENUITEM_NOT_CASCADE = 27; - /** + /** * SWT error constant indicating that the underlying operating * system was unable to set the selection of a widget * (value is 28). */ public static final int ERROR_CANNOT_SET_SELECTION = 28; - /** + /** * SWT error constant indicating that the underlying operating * system was unable to set the menu * (value is 29). */ public static final int ERROR_CANNOT_SET_MENU = 29; - /** + /** * SWT error constant indicating that the underlying operating * system was unable to set the enabled state * (value is 30). */ public static final int ERROR_CANNOT_SET_ENABLED = 30; - /** + /** * SWT error constant indicating that the underlying operating * system was unable to provide enabled/disabled state information * (value is 31). */ public static final int ERROR_CANNOT_GET_ENABLED = 31; - /** + /** * SWT error constant indicating that a provided widget can * not be used as a parent in the current operation * (value is 32). */ public static final int ERROR_INVALID_PARENT = 32; - - /** + + /** * SWT error constant indicating that a menu which needed * to have the menu bar style had some other style instead * (value is 33). */ public static final int ERROR_MENU_NOT_BAR = 33; - /** + /** * SWT error constant indicating that the underlying operating * system was unable to provide count information * (value is 36). */ public static final int ERROR_CANNOT_GET_COUNT = 36; - /** + /** * SWT error constant indicating that a menu which needed * to have the pop up menu style had some other style instead * (value is 37). */ public static final int ERROR_MENU_NOT_POP_UP = 37; - /** + /** * SWT error constant indicating that a graphics operation * was attempted with an image of an unsupported depth * (value is 38). */ public static final int ERROR_UNSUPPORTED_DEPTH = 38; - /** + /** * SWT error constant indicating that an input/output operation * failed during the execution of an SWT operation * (value is 39). */ public static final int ERROR_IO = 39; - /** + /** * SWT error constant indicating that a graphics operation * was attempted with an image having an invalid format * (value is 40). */ public static final int ERROR_INVALID_IMAGE = 40; - /** + /** * SWT error constant indicating that a graphics operation * was attempted with an image having a valid but unsupported * format @@ -3574,100 +3606,100 @@ */ public static final int ERROR_UNSUPPORTED_FORMAT = 42; - /** + /** * SWT error constant indicating that an attempt was made * to subclass an SWT widget class without implementing the * <code>checkSubclass()</code> method * (value is 43). - * - * For additional information see the comment in + * + * For additional information see the comment in * <code>Widget.checkSubclass()</code>. * * @see org.eclipse.swt.widgets.Widget#checkSubclass */ public static final int ERROR_INVALID_SUBCLASS = 43; - /** + /** * SWT error constant indicating that an attempt was made to * invoke an SWT operation using a graphics object which had * already been disposed * (value is 44). */ public static final int ERROR_GRAPHIC_DISPOSED = 44; - - /** + + /** * SWT error constant indicating that an attempt was made to * invoke an SWT operation using a device which had already * been disposed - * (value is 45). + * (value is 45). */ public static final int ERROR_DEVICE_DISPOSED = 45; - - /** + + /** * SWT error constant indicating that an exception happened * when executing a runnable * (value is 46). */ public static final int ERROR_FAILED_EXEC = 46; - - /** + + /** * SWT error constant indicating that an unsatisfied link * error occurred while attempting to load a library * (value is 47). - * + * * @since 3.1 */ public static final int ERROR_FAILED_LOAD_LIBRARY = 47; - /** + /** * SWT error constant indicating that a font is not valid * (value is 48). - * + * * @since 3.1 */ public static final int ERROR_INVALID_FONT = 48; - /** + /** * SWT error constant indicating that an attempt was made to * use an BrowserFunction object which had already been disposed * (value is 49). - * + * * @since 3.5 */ public static final int ERROR_FUNCTION_DISPOSED = 49; - /** + /** * SWT error constant indicating that an exception happened * when evaluating a javascript expression * (value is 50). - * + * * @since 3.5 */ public static final int ERROR_FAILED_EVALUATE = 50; - /** + /** * SWT error constant indicating that an invalid value was returned * (value is 51). - * + * * @since 3.5 */ public static final int ERROR_INVALID_RETURN_VALUE = 51; /** * Constant indicating that an image or operation is of type bitmap (value is 0). - */ + */ public static final int BITMAP = 0; /** * Constant indicating that an image or operation is of type icon (value is 1). - */ + */ public static final int ICON = 1; /** * The <code>Image</code> constructor argument indicating that * the new image should be a copy of the image provided as * an argument (value is 0). - */ + */ public static final int IMAGE_COPY = 0; /** @@ -3675,36 +3707,36 @@ * the new image should have the appearance of a "disabled" * (using the platform's rules for how this should look) * copy of the image provided as an argument (value is 1). - */ + */ public static final int IMAGE_DISABLE = 1; - + /** * The <code>Image</code> constructor argument indicating that * the new image should have the appearance of a "gray scaled" * copy of the image provided as an argument (value is 2). - */ + */ public static final int IMAGE_GRAY = 2; - + /** * Constant to indicate an error state (value is 1). * <p><b>Used By:</b><ul> * <li><code>ProgressBar</code></li> * </ul></p> - * + * * @since 3.4 */ public static final int ERROR = 1; - + /** * Constant to a indicate a paused state (value is 4). * <p><b>Used By:</b><ul> * <li><code>ProgressBar</code></li> * </ul></p> - * + * * @since 3.4 */ public static final int PAUSED = 1 << 2; - + /** * The font style constant indicating a normal weight, non-italic font * (value is 0). This constant is also used with <code>ProgressBar</code> @@ -3714,185 +3746,185 @@ * </ul></p> */ public static final int NORMAL = 0; - + /** * The font style constant indicating a bold weight font * (value is 1<<0). */ public static final int BOLD = 1 << 0; - + /** * The font style constant indicating an italic font * (value is 1<<1). */ public static final int ITALIC = 1 << 1; - + /** * System arrow cursor (value is 0). */ public static final int CURSOR_ARROW = 0; - + /** * System wait cursor (value is 1). */ public static final int CURSOR_WAIT = 1; - + /** * System cross hair cursor (value is 2). */ public static final int CURSOR_CROSS = 2; - + /** * System app startup cursor (value is 3). */ public static final int CURSOR_APPSTARTING = 3; - + /** * System help cursor (value is 4). */ public static final int CURSOR_HELP = 4; - + /** * System resize all directions cursor (value is 5). */ public static final int CURSOR_SIZEALL = 5; - + /** * System resize north-east-south-west cursor (value is 6). */ public static final int CURSOR_SIZENESW = 6; - + /** * System resize north-south cursor (value is 7). */ public static final int CURSOR_SIZENS = 7; - + /** * System resize north-west-south-east cursor (value is 8). */ public static final int CURSOR_SIZENWSE = 8; - + /** * System resize west-east cursor (value is 9). */ public static final int CURSOR_SIZEWE = 9; - + /** * System resize north cursor (value is 10). */ public static final int CURSOR_SIZEN = 10; - + /** * System resize south cursor (value is 11). */ public static final int CURSOR_SIZES = 11; - + /** * System resize east cursor (value is 12). */ public static final int CURSOR_SIZEE = 12; - + /** * System resize west cursor (value is 13). */ public static final int CURSOR_SIZEW = 13; - + /** * System resize north-east cursor (value is 14). */ public static final int CURSOR_SIZENE = 14; - + /** * System resize south-east cursor (value is 15). */ public static final int CURSOR_SIZESE = 15; - + /** * System resize south-west cursor (value is 16). */ public static final int CURSOR_SIZESW = 16; - + /** * System resize north-west cursor (value is 17). */ public static final int CURSOR_SIZENW = 17; - + /** * System up arrow cursor (value is 18). */ public static final int CURSOR_UPARROW = 18; - + /** * System i-beam cursor (value is 19). */ public static final int CURSOR_IBEAM = 19; - + /** * System "not allowed" cursor (value is 20). */ public static final int CURSOR_NO = 20; - + /** * System hand cursor (value is 21). */ public static final int CURSOR_HAND = 21; - + /** * Line drawing style for flat end caps (value is 1). - * + * * @see org.eclipse.swt.graphics.GC#setLineCap(int) * @see org.eclipse.swt.graphics.GC#getLineCap() - * + * * @since 3.1 */ public static final int CAP_FLAT = 1; /** * Line drawing style for rounded end caps (value is 2). - * + * * @see org.eclipse.swt.graphics.GC#setLineCap(int) * @see org.eclipse.swt.graphics.GC#getLineCap() - * + * * @since 3.1 */ public static final int CAP_ROUND = 2; /** * Line drawing style for square end caps (value is 3). - * + * * @see org.eclipse.swt.graphics.GC#setLineCap(int) * @see org.eclipse.swt.graphics.GC#getLineCap() - * + * * @since 3.1 */ public static final int CAP_SQUARE = 3; /** * Line drawing style for miter joins (value is 1). - * + * * @see org.eclipse.swt.graphics.GC#setLineJoin(int) * @see org.eclipse.swt.graphics.GC#getLineJoin() - * + * * @since 3.1 */ public static final int JOIN_MITER = 1; /** * Line drawing style for rounded joins (value is 2). - * + * * @see org.eclipse.swt.graphics.GC#setLineJoin(int) * @see org.eclipse.swt.graphics.GC#getLineJoin() - * + * * @since 3.1 */ public static final int JOIN_ROUND = 2; /** * Line drawing style for bevel joins (value is 3). - * + * * @see org.eclipse.swt.graphics.GC#setLineJoin(int) * @see org.eclipse.swt.graphics.GC#getLineJoin() - * + * * @since 3.1 */ public static final int JOIN_BEVEL = 3; @@ -3901,22 +3933,22 @@ * Line drawing style for solid lines (value is 1). */ public static final int LINE_SOLID = 1; - + /** * Line drawing style for dashed lines (value is 2). */ public static final int LINE_DASH = 2; - + /** * Line drawing style for dotted lines (value is 3). */ public static final int LINE_DOT = 3; - + /** * Line drawing style for alternating dash-dot lines (value is 4). */ public static final int LINE_DASHDOT = 4; - + /** * Line drawing style for dash-dot-dot lines (value is 5). */ @@ -3924,59 +3956,59 @@ /** * Line drawing style for custom dashed lines (value is 6). - * + * * @see org.eclipse.swt.graphics.GC#setLineDash(int[]) * @see org.eclipse.swt.graphics.GC#getLineDash() - * + * * @since 3.1 */ public static final int LINE_CUSTOM = 6; - + /** * Path constant that represents a "move to" operation (value is 1). - * + * * @since 3.1 */ public static final int PATH_MOVE_TO = 1; /** * Path constant that represents a "line to" operation (value is 2). - * + * * @since 3.1 */ public static final int PATH_LINE_TO = 2; /** * Path constant that represents a "quadratic curve to" operation (value is 3). - * + * * @since 3.1 */ public static final int PATH_QUAD_TO = 3; /** * Path constant that represents a "cubic curve to" operation (value is 4). - * + * * @since 3.1 */ public static final int PATH_CUBIC_TO = 4; /** * Path constant that represents a "close" operation (value is 5). - * + * * @since 3.1 */ public static final int PATH_CLOSE = 5; /** * Even odd rule for filling operations (value is 1). - * + * * @since 3.1 */ public static final int FILL_EVEN_ODD = 1; /** * Winding rule for filling operations (value is 2). - * + * * @since 3.1 */ public static final int FILL_WINDING = 2; @@ -3992,7 +4024,7 @@ public static final int IMAGE_BMP = 0; /** - * Image format constant indicating a run-length encoded + * Image format constant indicating a run-length encoded * Windows BMP format image (value is 1). */ public static final int IMAGE_BMP_RLE = 1; @@ -4035,7 +4067,7 @@ /** * GIF image disposal method constants indicating that the - * disposal method is to do nothing; that is, to leave the + * disposal method is to do nothing; that is, to leave the * previous image in place (value is 1). */ public static final int DM_FILL_NONE = 0x1; @@ -4053,25 +4085,25 @@ * (value is 3). */ public static final int DM_FILL_PREVIOUS = 0x3; - + /** * Image transparency constant indicating that the image * contains no transparency information (value is 0). */ public static final int TRANSPARENCY_NONE = 0x0; - + /** * Image transparency constant indicating that the image * contains alpha transparency information (value is 1<<0). */ public static final int TRANSPARENCY_ALPHA = 1 << 0; - + /** * Image transparency constant indicating that the image * contains a transparency mask (value is 1<<1). */ public static final int TRANSPARENCY_MASK = 1 << 1; - + /** * Image transparency constant indicating that the image * contains a transparent pixel (value is 1<<2). @@ -4081,24 +4113,24 @@ /** * The character movement type (value is 1<<0). * This constant is used to move a text offset over a character. - * + * * @see org.eclipse.swt.graphics.TextLayout#getNextOffset(int, int) * @see org.eclipse.swt.graphics.TextLayout#getPreviousOffset(int, int) - * + * * @since 3.0 - */ + */ public static final int MOVEMENT_CHAR = 1 << 0; /** * The cluster movement type (value is 1<<1). * This constant is used to move a text offset over a cluster. - * A cluster groups one or more characters. A cluster is + * A cluster groups one or more characters. A cluster is * undivisible, this means that a caret offset can not be placed in the - * middle of a cluster. - * + * middle of a cluster. + * * @see org.eclipse.swt.graphics.TextLayout#getNextOffset(int, int) * @see org.eclipse.swt.graphics.TextLayout#getPreviousOffset(int, int) - * + * * @since 3.0 */ public static final int MOVEMENT_CLUSTER = 1 << 1; @@ -4106,138 +4138,148 @@ /** * The word movement type (value is 1<<2). * This constant is used to move a text offset over a word. - * The behavior of this constant depends on the platform and on the - * direction of the movement. For example, on Windows the stop is - * always at the start of the word. On GTK and Mac the stop is at the end - * of the word if the direction is next and at the start of the word if the + * The behavior of this constant depends on the platform and on the + * direction of the movement. For example, on Windows the stop is + * always at the start of the word. On GTK and Mac the stop is at the end + * of the word if the direction is next and at the start of the word if the * direction is previous. - * + * * @see org.eclipse.swt.graphics.TextLayout#getNextOffset(int, int) * @see org.eclipse.swt.graphics.TextLayout#getPreviousOffset(int, int) - * + * * @since 3.0 - */ + */ public static final int MOVEMENT_WORD = 1 << 2; /** * The word end movement type (value is 1<<3). * This constant is used to move a text offset to the next or previous - * word end. The behavior of this constant does not depend on the platform. - * - * + * word end. The behavior of this constant does not depend on the platform. + * + * * @see org.eclipse.swt.graphics.TextLayout#getNextOffset(int, int) * @see org.eclipse.swt.graphics.TextLayout#getPreviousOffset(int, int) - * + * * @since 3.3 - */ + */ public static final int MOVEMENT_WORD_END = 1 << 3; /** * The word start movement type (value is 1<<4). * This constant is used to move a text offset to the next or previous - * word start. The behavior of this constant does not depend on the platform. - * + * word start. The behavior of this constant does not depend on the platform. + * * @see org.eclipse.swt.graphics.TextLayout#getNextOffset(int, int) * @see org.eclipse.swt.graphics.TextLayout#getPreviousOffset(int, int) - * + * * @since 3.3 - */ + */ public static final int MOVEMENT_WORD_START = 1 << 4; /** * A constant indicating that a given operation should be performed on * all widgets (value is 1<<0). - * + * * <p><b>Used By:</b><ul> * <li><code>Composite</code> layout</li> * </ul></p> - * + * * @see org.eclipse.swt.widgets.Composite#layout(org.eclipse.swt.widgets.Control[], int) - * + * * @since 3.6 */ public static final int ALL = 1 << 0; - + /** * ID for the About menu item (value is -1). - * + * * @see org.eclipse.swt.widgets.MenuItem#setID(int) * @see org.eclipse.swt.widgets.MenuItem#getID() - * + * * @since 3.7 */ public static final int ID_ABOUT = -1; /** * ID for the Preferences menu item (value is -2). - * + * * @see org.eclipse.swt.widgets.MenuItem#setID(int) * @see org.eclipse.swt.widgets.MenuItem#getID() - * + * * @since 3.7 */ public static final int ID_PREFERENCES = -2; /** * ID for the Hide menu item (value is -3). - * + * * @see org.eclipse.swt.widgets.MenuItem#setID(int) * @see org.eclipse.swt.widgets.MenuItem#getID() - * + * * @since 3.7 */ public static final int ID_HIDE = -3; /** * ID for the Hide Others menu item (value is -4). - * + * * @see org.eclipse.swt.widgets.MenuItem#setID(int) * @see org.eclipse.swt.widgets.MenuItem#getID() - * + * * @since 3.7 */ public static final int ID_HIDE_OTHERS = -4; - + /** * ID for the Show All menu item (value is -5). - * + * * @see org.eclipse.swt.widgets.MenuItem#setID(int) * @see org.eclipse.swt.widgets.MenuItem#getID() - * + * * @since 3.7 */ public static final int ID_SHOW_ALL = -5; - + /** * ID for the Quit menu item (value is -6). - * + * * @see org.eclipse.swt.widgets.MenuItem#setID(int) * @see org.eclipse.swt.widgets.MenuItem#getID() - * + * * @since 3.7 */ public static final int ID_QUIT = -6; /** - * Key value for setting and getting the skin class of a widget. - * + * Key name for setting and getting the skin class of a widget. + * <p> + * Note: SWT currently doesn't read or process this property. The only + * effect of setting this property is to trigger a call to + * {@link Widget#reskin(int) Widget#reskin(SWT.ALL)}. + * </p> + * * @see org.eclipse.swt.widgets.Widget#getData(String) * @see org.eclipse.swt.widgets.Widget#setData(String, Object) - * + * * @since 3.6 */ public static final String SKIN_CLASS = "org.eclipse.swt.skin.class"; //$NON-NLS-1$ /** - * Key value for setting and getting the skin id of a widget. - * + * Key name for setting and getting the skin id of a widget. + * <p> + * Note: SWT currently doesn't read or process this property. The only + * effect of setting this property is to trigger a call to + * {@link Widget#reskin(int) Widget#reskin(SWT.ALL)}. + * </p> + * * @see org.eclipse.swt.widgets.Widget#getData(String) * @see org.eclipse.swt.widgets.Widget#setData(String, Object) - * + * * @since 3.6 */ public static final String SKIN_ID = "org.eclipse.swt.skin.id"; //$NON-NLS-1$ - + /** * The <code>Scrollable</code> constant to indicate that * the receiver is using overlay scrollbars. (value is 1) @@ -4245,7 +4287,7 @@ * @since 3.8 */ public static final int SCROLLBAR_OVERLAY = 1 << 1; - + /** * Returns a boolean indicating whether this SWT implementation can @@ -4319,10 +4361,10 @@ /** * Returns the NLS'ed message for the given argument. - * + * * @param key the key to look up * @return the message for the given key - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the key is null</li> * </ul> @@ -4333,15 +4375,15 @@ /** * Returns the NLS'ed message for the given arguments. - * + * * @param key the key to look up * @param args the parameters to insert into the message * @return the message for the given parameterized key - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the key or args are null</li> * </ul> - * + * * @since 3.8 */ public static String getMessage(String key, Object[] args) { @@ -4431,14 +4473,14 @@ * @see SWTError * @see SWTException * @see IllegalArgumentException - * + * * @since 3.0 */ public static void error (int code, Throwable throwable, String detail) { /* * This code prevents the creation of "chains" of SWTErrors and - * SWTExceptions which in turn contain other SWTErrors and + * SWTExceptions which in turn contain other SWTErrors and * SWTExceptions as their throwable. This can occur when low level * code throws an exception past a point where a higher layer is * being "safe" and catching all exceptions. (Note that, this is @@ -4446,7 +4488,7 @@ * * On the theory that the low level code is closest to the * original problem, we simply re-throw the original exception here. - * + * * NOTE: Exceptions thrown in syncExec and asyncExec must be * wrapped. */ @@ -4458,20 +4500,20 @@ String message = findErrorText (code); if (detail != null) message += detail; switch (code) { - + /* Illegal Arguments (non-fatal) */ - case ERROR_NULL_ARGUMENT: + case ERROR_NULL_ARGUMENT: case ERROR_CANNOT_BE_ZERO: case ERROR_INVALID_ARGUMENT: case ERROR_MENU_NOT_BAR: case ERROR_MENU_NOT_DROP_DOWN: case ERROR_MENU_NOT_POP_UP: case ERROR_MENUITEM_NOT_CASCADE: - case ERROR_INVALID_PARENT: + case ERROR_INVALID_PARENT: case ERROR_INVALID_RANGE: { throw new IllegalArgumentException (message); } - + /* SWT Exceptions (non-fatal) */ case ERROR_INVALID_SUBCLASS: case ERROR_THREAD_INVALID_ACCESS: @@ -4492,7 +4534,7 @@ exception.throwable = throwable; throw exception; } - + /* Operation System Errors (fatal, may occur only on some platforms) */ case ERROR_CANNOT_GET_COUNT: case ERROR_CANNOT_GET_ENABLED: @@ -4508,7 +4550,7 @@ case ERROR_ITEM_NOT_REMOVED: case ERROR_NO_HANDLES: //FALL THROUGH - + /* SWT Errors (fatal, may occur only on some platforms) */ case ERROR_FAILED_LOAD_LIBRARY: case ERROR_NO_MORE_CALLBACKS: @@ -4519,7 +4561,7 @@ throw error; } } - + /* Unknown/Undefined Error */ SWTError error = new SWTError (code, message); error.throwable = throwable; @@ -4534,7 +4576,7 @@ */ BUTTON_MASK = BUTTON1 | BUTTON2 | BUTTON3 | BUTTON4 | BUTTON5; MODIFIER_MASK = ALT | SHIFT | CTRL | COMMAND; - + /* * These values can be different on different platforms. * Therefore they are not initialized in the declaration diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Button.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Button.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Button.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Button.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -50,6 +50,7 @@ ImageList imageList; Image image; String text; + GdkRGBA background; static final int INNER_BORDER = 1; static final int DEFAULT_BORDER = 1; @@ -127,6 +128,14 @@ return gtkBorder; } +@Override +GdkColor getContextBackground () { + if (background != null) { + return display.toGdkColor (background); + } + return display.COLOR_WIDGET_BACKGROUND; +} + /** * Adds the listener to the collection of listeners who will * be notified when the control is selected by the user, by sending @@ -166,7 +175,7 @@ } @Override -public Point computeSize (int wHint, int hHint, boolean changed) { +Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; @@ -799,20 +808,24 @@ void setBackgroundColor (int /*long*/ context, int /*long*/ handle, GdkRGBA rgba) { /* Note: this function is called on Gtk3 only */ + background = rgba; //Pre Gtk 3.10 doesn't handle CSS background color very well for Gtk Check/Radio button. // 3.10.3 as it was the latest to affect themeing in button. if (OS.GTK_VERSION < OS.VERSION(3, 10, 3) && (style & (SWT.CHECK | SWT.RADIO)) != 0) { super.setBackgroundColor (context, handle, rgba); return; } - - String css ="* {\n"; - if (rgba != null) { - String color = gtk_rgba_to_css_string (rgba); - css += "background: " + color + ";\n"; - } - css += "}\n"; - gtk_css_provider_load_from_css (context, css); + // Form background CSS string + String css ="* {background : "; + String color = display.gtk_rgba_to_css_string (rgba); + css += color + ";}"; + + // Cache background color + cssBackground = css; + + // Apply background color and any cached foreground color + String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND); + gtk_css_provider_load_from_css (context, finalCss); } @Override @@ -907,16 +920,49 @@ @Override void setForegroundColor (GdkColor color) { super.setForegroundColor (color); - setForegroundColor (fixedHandle, color); - if (labelHandle != 0) setForegroundColor (labelHandle, color); - if (imageHandle != 0) setForegroundColor (imageHandle, color); - - //Pre 3.10 CSS didn't work. In 3.16 everything will be CSS controlled - //and themes should control check/radio border color then. - if (OS.GTK_VERSION >= OS.VERSION(3, 10, 0) && OS.GTK_VERSION < OS.VERSION (3, 16, 0) && - (style & (SWT.CHECK | SWT.RADIO)) != 0) { - gtk_swt_set_border_color (color); + if (OS.GTK_VERSION >= OS.VERSION (3, 16, 0)) { + GdkRGBA rgba = null; + if (color != null) { + rgba = display.toGdkRGBA (color); + } + setForegroundColor (fixedHandle, rgba); + if (labelHandle != 0) setForegroundColor (labelHandle, rgba); + if (imageHandle != 0) setForegroundColor (imageHandle, rgba); + //Pre 3.10 CSS didn't work. In 3.16 everything will be CSS controlled + //and themes should control check/radio border color then. + } else { + setForegroundColor (fixedHandle, color); + if (labelHandle != 0) setForegroundColor (labelHandle, color); + if (imageHandle != 0) setForegroundColor (imageHandle, color); + if (OS.GTK_VERSION >= OS.VERSION(3, 10, 0) && OS.GTK_VERSION < OS.VERSION (3, 16, 0) && + (style & (SWT.CHECK | SWT.RADIO)) != 0) { + gtk_swt_set_border_color (color); + } + } +} + +@Override +void setForegroundColor (int /*long*/ handle, GdkRGBA rgba) { + GdkRGBA toSet; + if (rgba != null) { + toSet = rgba; + } else { + GdkColor defaultForeground = display.COLOR_WIDGET_FOREGROUND; + toSet = display.toGdkRGBA (defaultForeground); } + int /*long*/ context = OS.gtk_widget_get_style_context (handle); + + // Form foreground string + String color = display.gtk_rgba_to_css_string(toSet); + String name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "button" : "GtkButton"; + String css = name + " {color: " + color + ";}"; + + // Cache foreground color + cssForeground = css; + + // Apply foreground color and any cached background color + String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.FOREGROUND); + gtk_css_provider_load_from_css(context, finalCss); } //GtkCheckButton & it's descendant GtkRadioButton are often invisible or @@ -927,11 +973,7 @@ //TODO : Reactor in future commit. This and widget:setForegroundColor have duplicate code. GdkRGBA rgba = null; if (color != null) { - rgba = new GdkRGBA (); - rgba.alpha = 1; - rgba.red = (color.red & 0xFFFF) / (float) 0xFFFF; - rgba.green = (color.green & 0xFFFF) / (float) 0xFFFF; - rgba.blue = (color.blue & 0xFFFF) / (float) 0xFFFF; + rgba = display.toGdkRGBA (color); } //Construct CSS String @@ -940,7 +982,7 @@ // ideally we should have a 'constructCssString(..) that accepts attribute-value pairs. String css_string = "* {\n"; if (rgba != null) { - String css_color = gtk_rgba_to_css_string (rgba); + String css_color = display.gtk_rgba_to_css_string (rgba); css_string += "border-color: " + css_color + ";\n"; } css_string += "}\n"; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Canvas.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Canvas.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Canvas.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Canvas.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -13,6 +13,7 @@ import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.cairo.*; import org.eclipse.swt.internal.gtk.*; @@ -259,6 +260,12 @@ public void scroll (int destX, int destY, int x, int y, int width, int height, boolean all) { checkWidget(); if (width <= 0 || height <= 0) return; + Point destination = DPIUtil.autoScaleUp (new Point (destX, destY)); + Rectangle srcRect = DPIUtil.autoScaleUp (new Rectangle (x, y, width, height)); + scrollInPixels(destination.x, destination.y, srcRect.x, srcRect.y, srcRect.width, srcRect.height, all); +} + +void scrollInPixels (int destX, int destY, int x, int y, int width, int height, boolean all) { if ((style & SWT.MIRRORED) != 0) { int clientWidth = getClientWidth (); x = clientWidth - width - x; @@ -279,6 +286,33 @@ GdkRectangle srcRect = new GdkRectangle (); srcRect.x = x; srcRect.y = y; + /* + * Feature in GTK: for 3.16+ the "visible" region in Canvas includes + * the scrollbar dimensions in its calculations. This means the "previous" + * location the scrollbars are re-painted when scrolling, causing the + * hopping effect. See bug 480458. + */ + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + int /*long*/ hBarHandle = 0; + int /*long*/ vBarHandle = 0; + if (OS.GTK_IS_SCROLLED_WINDOW(scrolledHandle)) { + hBarHandle = OS.gtk_scrolled_window_get_hscrollbar (scrolledHandle); + vBarHandle = OS.gtk_scrolled_window_get_vscrollbar (scrolledHandle); + } + GtkRequisition requisition = new GtkRequisition(); + if (hBarHandle != 0) { + gtk_widget_get_preferred_size (hBarHandle, requisition); + if (requisition.height > 0) { + srcRect.y = y - requisition.height; + } + } + if (vBarHandle != 0) { + gtk_widget_get_preferred_size (vBarHandle, requisition); + if (requisition.width > 0) { + srcRect.x = x - requisition.width; + } + } + } srcRect.width = width; srcRect.height = height; int /*long*/ copyRegion = OS.gdk_region_rectangle (srcRect); @@ -357,10 +391,10 @@ Control [] children = _getChildren (); for (int i=0; i<children.length; i++) { Control child = children [i]; - Rectangle rect = child.getBounds (); + Rectangle rect = child.getBoundsInPixels (); if (Math.min(x + width, rect.x + rect.width) >= Math.max (x, rect.x) && Math.min(y + height, rect.y + rect.height) >= Math.max (y, rect.y)) { - child.setLocation (rect.x + deltaX, rect.y + deltaY); + child.setLocationInPixels (rect.x + deltaX, rect.y + deltaY); } } } @@ -383,6 +417,20 @@ return result; } +@Override +void setForegroundColor (int /*long*/ handle, GdkRGBA rgba) { + /* For CSS foreground colors (GTK3.16+) we need to make sure the default + * background color stays set if no background color is specified. If no + * background color has been set, set cssBackground to be COLOR_WIDGET_BACKGROUND. + */ + if (cssBackground == null) { + GdkRGBA defaultBackground = display.toGdkRGBA (display.COLOR_WIDGET_BACKGROUND); + cssBackground = "SwtFixed {background-color: " + + display.gtk_rgba_to_css_string(defaultBackground) + ";}"; + } + super.setForegroundColor (handle, rgba); +} + /** * Sets the receiver's caret. * <p> diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Caret.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Caret.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Caret.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Caret.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -12,9 +12,10 @@ import org.eclipse.swt.*; +import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.cairo.*; import org.eclipse.swt.internal.gtk.*; -import org.eclipse.swt.graphics.*; /** * Instances of this class provide an i-beam that is typically used @@ -171,8 +172,13 @@ */ public Rectangle getBounds () { checkWidget(); + return DPIUtil.autoScaleDown(getBoundsInPixels()); +} + +Rectangle getBoundsInPixels () { + checkWidget(); if (image != null) { - Rectangle rect = image.getBounds (); + Rectangle rect = image.getBoundsInPixels (); return new Rectangle (x, y, rect.width, rect.height); } else { if (width == 0) { @@ -226,6 +232,11 @@ */ public Point getLocation () { checkWidget(); + return DPIUtil.autoScaleDown(getLocationInPixels()); +} + +Point getLocationInPixels () { + checkWidget(); return new Point (x, y); } @@ -256,8 +267,13 @@ */ public Point getSize () { checkWidget(); + return DPIUtil.autoScaleDown(getSizeInPixels()); +} + +Point getSizeInPixels () { + checkWidget(); if (image != null) { - Rectangle rect = image.getBounds (); + Rectangle rect = image.getBoundsInPixels (); return new Point (rect.width, rect.height); } else { if (width == 0) { @@ -359,6 +375,11 @@ */ public void setBounds (int x, int y, int width, int height) { checkWidget(); + setBounds (new Rectangle (x, y, width, height)); +} + +void setBoundsInPixels (int x, int y, int width, int height) { + checkWidget(); if (this.x == x && this.y == y && this.width == width && this.height == height) return; boolean isFocus = isFocusCaret (); if (isFocus && isVisible) hideCaret (); @@ -383,8 +404,14 @@ */ public void setBounds (Rectangle rect) { checkWidget(); + rect = DPIUtil.autoScaleUp(rect); + setBoundsInPixels(rect); +} + +void setBoundsInPixels (Rectangle rect) { + checkWidget(); if (rect == null) error (SWT.ERROR_NULL_ARGUMENT); - setBounds (rect.x, rect.y, rect.width, rect.height); + setBoundsInPixels (rect.x, rect.y, rect.width, rect.height); } void setFocus () { @@ -457,7 +484,12 @@ */ public void setLocation (int x, int y) { checkWidget(); - setBounds (x, y, width, height); + setLocation (new Point (x, y)); +} + +void setLocationInPixels (int x, int y) { + checkWidget(); + setBoundsInPixels (x, y, width, height); } /** @@ -474,8 +506,13 @@ */ public void setLocation (Point location) { checkWidget(); + setLocationInPixels (DPIUtil.autoScaleUp (location)); +} + +void setLocationInPixels (Point location) { + checkWidget(); if (location == null) error (SWT.ERROR_NULL_ARGUMENT); - setLocation (location.x, location.y); + setLocationInPixels (location.x, location.y); } /** @@ -491,7 +528,12 @@ */ public void setSize (int width, int height) { checkWidget(); - setBounds (x, y, width, height); + setSize (new Point (width,height)); +} + +void setSizeInPixels (int width, int height) { + checkWidget(); + setBoundsInPixels (x, y, width, height); } /** @@ -509,8 +551,13 @@ */ public void setSize (Point size) { checkWidget(); + setSizeInPixels(DPIUtil.autoScaleUp (size)); +} + +void setSizeInPixels (Point size) { + checkWidget(); if (size == null) error (SWT.ERROR_NULL_ARGUMENT); - setSize (size.x, size.y); + setSizeInPixels (size.x, size.y); } /** diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/ColorDialog.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/ColorDialog.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/ColorDialog.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/ColorDialog.java 2016-07-06 19:11:33.000000000 +0000 @@ -12,9 +12,9 @@ import org.eclipse.swt.*; +import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; -import org.eclipse.swt.graphics.*; /** * Instances of this class allow the user to select a color @@ -163,34 +163,59 @@ rgba.red = (double) rgb.red / 255; rgba.green = (double) rgb.green / 255; rgba.blue = (double) rgb.blue / 255; + rgba.alpha = 1; } - OS.gtk_color_chooser_set_use_alpha (handle, false); OS.gtk_color_chooser_set_rgba (handle, rgba); } - if (rgbs != null) { - int /*long*/ colors = OS.g_malloc(GdkColor.sizeof * rgbs.length); - for (int i=0; i<rgbs.length; i++) { - RGB rgb = rgbs[i]; - if (rgb != null) { - color.red = (short)((rgb.red & 0xFF) | ((rgb.red & 0xFF) << 8)); - color.green = (short)((rgb.green & 0xFF) | ((rgb.green & 0xFF) << 8)); - color.blue = (short)((rgb.blue & 0xFF) | ((rgb.blue & 0xFF) << 8)); - OS.memmove (colors + i * GdkColor.sizeof, color, GdkColor.sizeof); + if (OS.GTK_VERSION >= OS.VERSION (3, 4, 0)) { + int colorsPerRow = 9; + int /*long*/ gdkRGBAS = OS.g_malloc(GdkRGBA.sizeof * rgbs.length); + for (int i=0; i<rgbs.length; i++) { + RGB rgbS = rgbs[i]; + if (rgbS != null) { + rgba.red = (double) rgbS.red / 255; + rgba.green = (double) rgbS.green / 255; + rgba.blue = (double) rgbS.blue / 255; + OS.memmove (gdkRGBAS + i * GdkRGBA.sizeof, rgba, GdkRGBA.sizeof); + } + } + OS.gtk_color_chooser_add_palette(handle, OS.GTK_ORIENTATION_HORIZONTAL, colorsPerRow, + rgbs.length, gdkRGBAS); + OS.gtk_color_chooser_set_rgba (handle, rgba); + + + if (OS.gtk_color_chooser_get_use_alpha(handle)) { + OS.gtk_color_chooser_set_use_alpha (handle, false); + } + OS.g_free (gdkRGBAS); + } else { + int /*long*/ gdkColors = OS.g_malloc(GdkColor.sizeof * rgbs.length); + for (int i=0; i<rgbs.length; i++) { + RGB rgb = rgbs[i]; + if (rgb != null) { + color.red = (short)((rgb.red & 0xFF) | ((rgb.red & 0xFF) << 8)); + color.green = (short)((rgb.green & 0xFF) | ((rgb.green & 0xFF) << 8)); + color.blue = (short)((rgb.blue & 0xFF) | ((rgb.blue & 0xFF) << 8)); + OS.memmove (gdkColors + i * GdkColor.sizeof, color, GdkColor.sizeof); + } + } + int /*long*/ strPtr = OS.gtk_color_selection_palette_to_string(gdkColors, rgbs.length); + int length = OS.strlen (strPtr); + + buffer = new byte [length]; + OS.memmove (buffer, strPtr, length); + String paletteString = new String (Converter.mbcsToWcs (null, buffer)); + buffer = Converter.wcsToMbcs (null, paletteString, true); + OS.g_free (gdkColors); + int /*long*/ settings = OS.gtk_settings_get_default (); + if (settings != 0) { + OS.gtk_settings_set_string_property(settings, OS.gtk_color_palette, buffer, Converter.wcsToMbcs (null, "gtk_color_selection_palette_to_string", true)); + } - } - int /*long*/ strPtr = OS.gtk_color_selection_palette_to_string(colors, rgbs.length); - int length = OS.strlen (strPtr); - buffer = new byte [length]; - OS.memmove (buffer, strPtr, length); - String paletteString = new String (Converter.mbcsToWcs (null, buffer)); - buffer = Converter.wcsToMbcs (null, paletteString, true); - OS.g_free (colors); - int /*long*/ settings = OS.gtk_settings_get_default (); - if (settings != 0) { - OS.gtk_settings_set_string_property(settings, OS.gtk_color_palette, buffer, Converter.wcsToMbcs (null, "gtk_color_selection_palette_to_string", true)); } } + display.addIdleProc (); Dialog oldModal = null; if (OS.gtk_window_get_modal (handle)) { @@ -203,7 +228,6 @@ signalId = OS.g_signal_lookup (OS.map, OS.GTK_TYPE_WIDGET()); hookId = OS.g_signal_add_emission_hook (signalId, 0, display.emissionProc, handle, 0); } - display.sendPreExternalEventDispatchEvent (); int response = OS.gtk_dialog_run (handle); /* @@ -235,39 +259,43 @@ red = (color.red >> 8) & 0xFF; green = (color.green >> 8) & 0xFF; blue = (color.blue >> 8) & 0xFF; - } - rgb = new RGB (red, green, blue); - } - int /*long*/ settings = OS.gtk_settings_get_default (); - if (settings != 0) { - int /*long*/ [] ptr = new int /*long*/ [1]; - OS.g_object_get (settings, OS.gtk_color_palette, ptr, 0); - if (ptr [0] != 0) { - int length = OS.strlen (ptr [0]); - buffer = new byte [length]; - OS.memmove (buffer, ptr [0], length); - OS.g_free (ptr [0]); - String [] gdkColorStrings = null; - if (length > 0) { - String gtk_color_palette = new String(Converter.mbcsToWcs (null, buffer)); - gdkColorStrings = splitString(gtk_color_palette, ':'); - length = gdkColorStrings.length; - } - rgbs = new RGB [length]; - for (int i=0; i<length; i++) { - String colorString = gdkColorStrings[i]; - buffer = Converter.wcsToMbcs (null, colorString, true); - OS.gdk_color_parse(buffer, color); - int red = (color.red >> 8) & 0xFF; - int green = (color.green >> 8) & 0xFF; - int blue = (color.blue >> 8) & 0xFF; - rgbs [i] = new RGB (red, green, blue); + + int /*long*/ settings = OS.gtk_settings_get_default (); + if (settings != 0) { + + int /*long*/ [] ptr = new int /*long*/ [1]; + OS.g_object_get (settings, OS.gtk_color_palette, ptr, 0); + if (ptr [0] != 0) { + int length = OS.strlen (ptr [0]); + buffer = new byte [length]; + OS.memmove (buffer, ptr [0], length); + OS.g_free (ptr [0]); + String [] gdkColorStrings = null; + if (length > 0) { + String gtk_color_palette = new String(Converter.mbcsToWcs (null, buffer)); + gdkColorStrings = splitString(gtk_color_palette, ':'); + length = gdkColorStrings.length; + } + rgbs = new RGB [length]; + for (int i=0; i<length; i++) { + String colorString = gdkColorStrings[i]; + buffer = Converter.wcsToMbcs (null, colorString, true); + OS.gdk_color_parse(buffer, color); + int redI = (color.red >> 8) & 0xFF; + int greenI = (color.green >> 8) & 0xFF; + int blueI = (color.blue >> 8) & 0xFF; + rgbs [i] = new RGB (redI, greenI, blueI); + } + } } } + rgb = new RGB (red, green, blue); } + display.removeIdleProc (); OS.gtk_widget_destroy (handle); if (!success) return null; + return rgb; } /** @@ -315,3 +343,4 @@ return substrings; } } + diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Combo.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Combo.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Combo.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Combo.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Lars Vogel <Lars.Vogel@vogella.com> - Bug 483540 *******************************************************************************/ package org.eclipse.swt.widgets; @@ -65,6 +66,7 @@ String [] items = new String [0]; boolean selectionAdded; int indexSelected; + GdkRGBA background; /** * the operating system limit for the number of characters * that the text field in an instance of this class can hold @@ -392,7 +394,7 @@ } @Override -public Point computeSize (int wHint, int hHint, boolean changed) { +Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); if ((style & SWT.READ_ONLY) != 0 || OS.GTK3) { return computeNativeSize (handle, wHint, hHint, changed); @@ -606,7 +608,32 @@ * an instance of button. */ int /*long*/ result = 0; - OS.gtk_container_forall (handle, display.allChildrenProc, 0); + int /*long*/ childHandle = handle; + + /* + * The only direct child of GtkComboBox since 3.20 is GtkBox and + * gtk_container_forall iterates over direct children only so handle for the + * GtkBox has to be retrieved first. + * As it's internal child one can't get it in other way. + */ + if (OS.GTK_VERSION >= OS.VERSION(3, 20, 0)) { + OS.gtk_container_forall(handle, display.allChildrenProc, 0); + if (display.allChildren != 0) { + int /*long*/ list = display.allChildren; + while (list != 0) { + int /*long*/ widget = OS.g_list_data(list); + if (widget != 0) { + childHandle = widget; + break; + } + list = OS.g_list_next(list); + } + OS.g_list_free(display.allChildren); + display.allChildren = 0; + } + } + + OS.gtk_container_forall (childHandle, display.allChildrenProc, 0); if (display.allChildren != 0) { int /*long*/ list = display.allChildren; while (list != 0) { @@ -848,6 +875,12 @@ */ public Point getCaretLocation () { checkWidget (); + return DPIUtil.autoScaleDown(getCaretLocationInPixels()); +} + + +Point getCaretLocationInPixels () { + checkWidget (); if ((style & SWT.READ_ONLY) != 0) { return new Point (0, 0); } @@ -858,7 +891,7 @@ int /*long*/ layout = OS.gtk_entry_get_layout (entryHandle); PangoRectangle pos = new PangoRectangle (); OS.pango_layout_index_to_pos (layout, index, pos); - int x = offset_x [0] + OS.PANGO_PIXELS (pos.x) - getBorderWidth (); + int x = offset_x [0] + OS.PANGO_PIXELS (pos.x) - getBorderWidthInPixels (); int y = offset_y [0] + OS.PANGO_PIXELS (pos.y); return new Point (x, y); } @@ -888,6 +921,19 @@ } @Override +GdkColor getContextBackground () { + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + if (background != null) { + return display.toGdkColor (background); + } else { + return display.COLOR_WIDGET_BACKGROUND; + } + } else { + return super.getContextBackground(); + } +} + +@Override GdkColor getForegroundColor () { return getTextColor (); } @@ -1118,6 +1164,12 @@ */ public int getTextHeight () { checkWidget(); + return DPIUtil.autoScaleDown(getTextHeightInPixels()); +} + + +int getTextHeightInPixels () { + checkWidget(); GtkRequisition requisition = new GtkRequisition (); gtk_widget_size_request (handle, requisition); if (OS.GTK3) { @@ -1342,9 +1394,17 @@ GdkEventFocus gdkEventFocus = new GdkEventFocus (); OS.memmove (gdkEventFocus, gdkEvent, GdkEventFocus.sizeof); if (gdkEventFocus.in != 0) { - OS.gtk_combo_box_set_focus_on_click (handle, false); + if (OS.GTK_VERSION >= OS.VERSION(3, 20, 0)) { + OS.gtk_widget_set_focus_on_click(handle, false); + } else { + OS.gtk_combo_box_set_focus_on_click (handle, false); + } } else { - OS.gtk_combo_box_set_focus_on_click (handle, true); + if (OS.GTK_VERSION >= OS.VERSION(3, 20, 0)) { + OS.gtk_widget_set_focus_on_click(handle, true); + } else { + OS.gtk_combo_box_set_focus_on_click (handle, true); + } } } break; @@ -1854,30 +1914,32 @@ @Override void setBackgroundColor (int /*long*/ context, int /*long*/ handle, GdkRGBA rgba) { - //Note, in Gtk3's CSS, we can't access all of the sub-widgets inside GtkComboBox. - //Some have to be themed by the global system theme. - + // CSS to be parsed for various widgets within Combo + background = rgba; + String css = "* {\n"; + if (rgba != null) { + String color = display.gtk_rgba_to_css_string (rgba); + css += "background: " + color + ";\n"; + } + css += "}\n"; + // Cache background color + cssBackground = css; + String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND); if (entryHandle == 0 || (style & SWT.READ_ONLY) != 0) { - int /*long*/ buttonHandle = findButtonHandle (); //get's the GtkEntry handle. - //TODO Refactor this and Button#setBackground, they have similar CSS construction code. - String css = "* {\n"; - if (rgba != null) { - String color = gtk_rgba_to_css_string (rgba); - css += "background: " + color + ";\n"; - } - css += "}\n"; - gtk_css_provider_load_from_css (OS.gtk_widget_get_style_context(buttonHandle), css); //Apply to Entry + // For read only Combos, we can just apply the background CSS to the GtkToggleButton. + gtk_css_provider_load_from_css (OS.gtk_widget_get_style_context(buttonHandle), finalCss); } else { - setBackgroundColorGradient (OS.gtk_widget_get_style_context (entryHandle), handle, rgba); - super.setBackgroundColor (OS.gtk_widget_get_style_context (entryHandle), entryHandle, rgba); - //Note, we can't get to the GtkToggleButton inside GtkComboBoxText, as it's in a private stuct. - //We thus rely on global theme to style it via: GtkToggleButton { background: red} + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + // For GTK3.16+, only the GtkEntry needs to be themed. + gtk_css_provider_load_from_css (OS.gtk_widget_get_style_context(entryHandle), finalCss); + } else { + // Maintain GTK3.14- functionality + setBackgroundColorGradient (OS.gtk_widget_get_style_context (entryHandle), handle, rgba); + super.setBackgroundColor (OS.gtk_widget_get_style_context (entryHandle), entryHandle, rgba); + } } - - //Set the background color of the text of the drop down menu. + // Set the background color of the text of the drop down menu. OS.g_object_set (textRenderer, OS.background_rgba, rgba, 0); - //NOTE: We can't get to the actual menu background, beacuse it is in a private struct in GtkComboBoxText. - //Thus we rely for the underlying theme to theme the menu via : GtkComboBoxText * { background: xzy } } @Override @@ -1897,7 +1959,7 @@ @Override int setBounds (int x, int y, int width, int height, boolean move, boolean resize) { int newHeight = height; - if (resize) newHeight = Math.max (getTextHeight (), height); + if (resize) newHeight = Math.max (getTextHeightInPixels (), height); return super.setBounds (x, y, width, newHeight, move, resize); } @@ -1950,30 +2012,30 @@ @Override void setForegroundColor (GdkColor color) { - super.setForegroundColor (handle, color, false); - if (entryHandle != 0) { - setForegroundColor (entryHandle, color, false); - } - if (OS.GTK3) { - GdkRGBA rgba = gdk_color_to_rgba (color); + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + GdkRGBA rgba = null; + if (color != null) { + rgba = display.toGdkRGBA (color); + } + if (entryHandle != 0) { + setForegroundColor (entryHandle, rgba); + } OS.g_object_set (textRenderer, OS.foreground_rgba, rgba, 0); - } else { - OS.g_object_set (textRenderer, OS.foreground_gdk, color, 0); - } -} - -GdkRGBA gdk_color_to_rgba (GdkColor color) { - GdkRGBA rgba = null; - if (color != null) { - rgba = new GdkRGBA(); - rgba.alpha = 1; //TODO, we are loosing Alpha in Control:setForeground(Color color), - //as alpha is only defined in Color and not GtkColor. - //This function should ideally be factored out to Control, and convert Color to GdkRGBA. - rgba.red = (color.red & 0xFFFF) / (float)0xFFFF; - rgba.green = (color.green & 0xFFFF) / (float)0xFFFF; - rgba.blue = (color.blue & 0xFFFF) / (float)0xFFFF; + } else { + super.setForegroundColor (handle, color, false); + if (entryHandle != 0) { + setForegroundColor (entryHandle, color, false); + } + if (OS.GTK3) { + GdkRGBA rgba = null; + if (color != null) { + rgba = display.toGdkRGBA (color); + } + OS.g_object_set (textRenderer, OS.foreground_rgba, rgba, 0); + } else { + OS.g_object_set (textRenderer, OS.foreground_gdk, color, 0); + } } - return rgba; } /** @@ -2026,7 +2088,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setItems (String [] items) { +public void setItems (String... items) { checkWidget(); if (items == null) error (SWT.ERROR_NULL_ARGUMENT); for (int i=0; i<items.length; i++) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Composite.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Composite.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Composite.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Composite.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -13,6 +13,7 @@ import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.cairo.*; import org.eclipse.swt.internal.gtk.*; @@ -115,15 +116,8 @@ return style; } -//Containers such as Tabfolder have two sets of children, -//e.g TabItems and actual widget children. -//thus we need to pass in different parenting handles depending on which children we want. Control [] _getChildren () { int /*long*/ parentHandle = parentingHandle (); - return _getChildren (parentHandle); -} - -Control [] _getChildren (int /*long*/ parentHandle) { int /*long*/ list = OS.gtk_container_get_children (parentHandle); if (list == 0) return new Control [0]; int count = OS.g_list_length (list); @@ -234,7 +228,7 @@ } @Override -public Point computeSize (int wHint, int hHint, boolean changed) { +Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); display.runSkin(); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; @@ -243,7 +237,7 @@ if (layout != null) { if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) { changed |= (state & LAYOUT_CHANGED) != 0; - size = layout.computeSize (this, wHint, hHint, changed); + size = DPIUtil.autoScaleUp(layout.computeSize (this, DPIUtil.autoScaleDown(wHint), DPIUtil.autoScaleDown(hHint), changed)); state &= ~LAYOUT_CHANGED; } else { size = new Point (wHint, hHint); @@ -255,7 +249,7 @@ } if (wHint != SWT.DEFAULT) size.x = wHint; if (hHint != SWT.DEFAULT) size.y = hHint; - Rectangle trim = computeTrim (0, 0, size.x, size.y); + Rectangle trim = DPIUtil.autoScaleUp (computeTrim (0, 0, DPIUtil.autoScaleDown(size.x), DPIUtil.autoScaleDown(size.y))); return new Point (trim.width, trim.height); } @@ -359,6 +353,21 @@ } @Override +int /*long*/ gtk_draw (int /*long*/ widget, int /*long*/ cairo) { + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + int /*long*/ context = OS.gtk_widget_get_style_context(widget); + GtkAllocation allocation = new GtkAllocation(); + OS.gtk_widget_get_allocation (widget, allocation); + int width = (state & ZERO_WIDTH) != 0 ? 0 : allocation.width; + int height = (state & ZERO_HEIGHT) != 0 ? 0 : allocation.height; + // We specify a 0 value for x & y as we want the whole widget to be + // colored, not some portion of it. + OS.gtk_render_background(context, cairo, 0, 0, width, height); + } + return super.gtk_draw(widget, cairo); +} + +@Override void deregister () { super.deregister (); if (socketHandle != 0) display.removeWidget (socketHandle); @@ -392,6 +401,14 @@ * @since 3.6 */ public void drawBackground (GC gc, int x, int y, int width, int height, int offsetX, int offsetY) { + checkWidget(); + Rectangle rect = DPIUtil.autoScaleUp(new Rectangle (x, y, width, height)); + offsetX = DPIUtil.autoScaleUp(offsetX); + offsetY = DPIUtil.autoScaleUp(offsetY); + drawBackgroundInPixels(gc, rect.x, rect.y, rect.width, rect.height, offsetX, offsetY); +} + +void drawBackgroundInPixels (GC gc, int x, int y, int width, int height, int offsetX, int offsetY) { checkWidget (); if (gc == null) error (SWT.ERROR_NULL_ARGUMENT); if (gc.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT); @@ -402,7 +419,7 @@ if (cairo != 0) { Cairo.cairo_save (cairo); if (control.backgroundImage != null) { - Point pt = display.map (this, control, 0, 0); + Point pt = display.mapInPixels (this, control, 0, 0); Cairo.cairo_translate (cairo, -pt.x - offsetX, -pt.y - offsetY); x += pt.x + offsetX; y += pt.y + offsetY; @@ -435,7 +452,8 @@ Cairo.cairo_pattern_destroy (pattern); } else { GdkColor color = control.getBackgroundColor (); - Cairo.cairo_set_source_rgba (cairo, (color.red & 0xFFFF) / (float)0xFFFF, (color.green & 0xFFFF) / (float)0xFFFF, (color.blue & 0xFFFF) / (float)0xFFFF, data.alpha / (float)0xFF); + GdkRGBA rgba = display.toGdkRGBA (color); + Cairo.cairo_set_source_rgba (cairo, rgba.red, rgba.green, rgba.blue, rgba.alpha); } Cairo.cairo_rectangle (cairo, x, y, width, height); Cairo.cairo_fill (cairo); @@ -445,7 +463,7 @@ GdkGCValues values = new GdkGCValues (); OS.gdk_gc_get_values (gdkGC, values); if (control.backgroundImage != null) { - Point pt = display.map (this, control, 0, 0); + Point pt = display.mapInPixels (this, control, 0, 0); OS.gdk_gc_set_fill (gdkGC, OS.GDK_TILED); OS.gdk_gc_set_ts_origin (gdkGC, -pt.x - offsetX, -pt.y - offsetY); OS.gdk_gc_set_tile (gdkGC, control.backgroundImage.pixmap); @@ -461,7 +479,8 @@ } } } else { - gc.fillRectangle (x, y, width, height); + gc.fillRectangle(DPIUtil.autoScaleDown(new Rectangle(x, y, width, height))); + } } @@ -640,7 +659,7 @@ } @Override -public Rectangle getClientArea () { +Rectangle getClientAreaInPixels () { checkWidget(); if ((state & CANVAS) != 0) { if ((state & ZERO_WIDTH) != 0 && (state & ZERO_HEIGHT) != 0) { @@ -654,7 +673,7 @@ int height = (state & ZERO_HEIGHT) != 0 ? 0 : allocation.height; return new Rectangle (0, 0, width, height); } - return super.getClientArea(); + return super.getClientAreaInPixels(); } /** @@ -761,11 +780,8 @@ for (int i=0; i<n_rectangles[0]; i++) { Event event = new Event (); OS.memmove (rect, rectangles [0] + i * GdkRectangle.sizeof, GdkRectangle.sizeof); - event.x = rect.x; - event.y = rect.y; - event.width = rect.width; - event.height = rect.height; - if ((style & SWT.MIRRORED) != 0) event.x = getClientWidth () - event.width - event.x; + event.setBounds (DPIUtil.autoScaleDown (new Rectangle(rect.x, rect.y, rect.width, rect.height))); + if ((style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown (getClientWidth ()) - event.width - event.x; int /*long*/ damageRgn = OS.gdk_region_new (); OS.gdk_region_union_with_rect (damageRgn, rect); GCData data = new GCData (); @@ -831,7 +847,13 @@ int /*long*/ result = super.gtk_realize (widget); if ((style & SWT.NO_BACKGROUND) != 0) { int /*long*/ window = gtk_widget_get_window (paintHandle ()); - if (window != 0) OS.gdk_window_set_back_pixmap (window, 0, false); + if (window != 0) { + if (OS.GTK3) { + OS.gdk_window_set_background_pattern(window, 0); + } else { + OS.gdk_window_set_back_pixmap (window, 0, false); + } + } } if (socketHandle != 0) { embeddedHandle = OS.gtk_socket_get_id (socketHandle); @@ -914,6 +936,14 @@ * (that is, set the size and location of) the receiver's children. * If the receiver does not have a layout, do nothing. * <p> + * Use of this method is discouraged since it is the least-efficient + * way to trigger a layout. The use of <code>layout(true)</code> + * discards all cached layout information, even from controls which + * have not changed. It is much more efficient to invoke + * {@link Control#requestLayout()} on every control which has changed + * in the layout than it is to invoke this method on the layout itself. + * </p> + * <p> * This is equivalent to calling <code>layout(true)</code>. * </p> * <p> @@ -943,6 +973,13 @@ * children has changed state since the last layout. * If the receiver does not have a layout, do nothing. * <p> + * It is normally more efficient to invoke {@link Control#requestLayout()} + * on every control which has changed in the layout than it is to invoke + * this method on the layout itself. Clients are encouraged to use + * {@link Control#requestLayout()} where possible instead of calling + * this method. + * </p> + * <p> * If a child is resized as a result of a call to layout, the * resize event will invoke the layout of the child. The layout * will cascade down through all child widgets in the receiver's widget @@ -989,6 +1026,13 @@ * (same as <code>layout(false)</code>). * </p> * <p> + * It is normally more efficient to invoke {@link Control#requestLayout()} + * on every control which has changed in the layout than it is to invoke + * this method on the layout itself. Clients are encouraged to use + * {@link Control#requestLayout()} where possible instead of calling + * this method. + * </p> + * <p> * Note: Layout is different from painting. If a child is * moved or resized such that an area in the parent is * exposed, then the parent will paint. If no child is @@ -1021,6 +1065,13 @@ * peers of the changed control have changed state since the last layout. * If an ancestor does not have a layout, skip it. * <p> + * It is normally more efficient to invoke {@link Control#requestLayout()} + * on every control which has changed in the layout than it is to invoke + * this method on the layout itself. Clients are encouraged to use + * {@link Control#requestLayout()} where possible instead of calling + * this method. + * </p> + * <p> * Note: Layout is different from painting. If a child is * moved or resized such that an area in the parent is * exposed, then the parent will paint. If no child is @@ -1296,10 +1347,14 @@ Point minimumSize (int wHint, int hHint, boolean changed) { Control [] children = _getChildren (); - Rectangle clientArea = getClientArea (); + /* + * Since getClientArea can be overridden by subclasses, we cannot + * call getClientAreaInPixels directly. + */ + Rectangle clientArea = DPIUtil.autoScaleUp(getClientArea ()); int width = 0, height = 0; for (int i=0; i<children.length; i++) { - Rectangle rect = children [i].getBounds (); + Rectangle rect = DPIUtil.autoScaleUp(children [i].getBounds ()); width = Math.max (width, rect.x - clientArea.x + rect.width); height = Math.max (height, rect.y - clientArea.y + rect.height); } @@ -1315,23 +1370,24 @@ void printWidget (GC gc, int /*long*/ drawable, int depth, int x, int y) { Region oldClip = new Region (gc.getDevice ()); Region newClip = new Region (gc.getDevice ()); + Point loc = DPIUtil.autoScaleDown(new Point (x, y)); gc.getClipping (oldClip); Rectangle rect = getBounds (); newClip.add (oldClip); - newClip.intersect (x, y, rect.width, rect.height); + newClip.intersect (loc.x, loc.y, rect.width, rect.height); gc.setClipping (newClip); super.printWidget (gc, drawable, depth, x, y); - Rectangle clientRect = getClientArea (); - Point pt = display.map (this, parent, clientRect.x, clientRect.y); + Rectangle clientRect = getClientAreaInPixels (); + Point pt = display.mapInPixels (this, parent, clientRect.x, clientRect.y); clientRect.x = x + pt.x - rect.x; clientRect.y = y + pt.y - rect.y; - newClip.intersect (clientRect); + newClip.intersect (DPIUtil.autoScaleDown(clientRect)); gc.setClipping (newClip); Control [] children = _getChildren (); for (int i=children.length-1; i>=0; --i) { Control child = children [i]; if (child.getVisible ()) { - Point location = child.getLocation (); + Point location = child.getLocationInPixels (); child.printWidget (gc, drawable, depth, x + location.x, y + location.y); } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Control.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Control.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Control.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Control.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stefan Xenos (Google) - bug 468854 - Add a requestLayout method to Control *******************************************************************************/ package org.eclipse.swt.widgets; @@ -58,6 +59,7 @@ Object layoutData; Accessible accessible; Control labelRelation; + String cssBackground, cssForeground = " "; /* these class variables are for the workaround for bug #427776 */ static Callback enterNotifyEventFunc; @@ -129,7 +131,7 @@ Cairo.cairo_clip(cairo); } if (control.backgroundImage != null) { - Point pt = display.map (this, control, 0, 0); + Point pt = display.mapInPixels (this, control, 0, 0); Cairo.cairo_translate (cairo, -pt.x, -pt.y); x += pt.x; y += pt.y; @@ -144,7 +146,8 @@ Cairo.cairo_pattern_destroy (pattern); } else { GdkColor color = control.getBackgroundColor (); - Cairo.cairo_set_source_rgba (cairo, (color.red & 0xFFFF) / (float)0xFFFF, (color.green & 0xFFFF) / (float)0xFFFF, (color.blue & 0xFFFF) / (float)0xFFFF, 1); + GdkRGBA rgba = display.toGdkRGBA (color); + Cairo.cairo_set_source_rgba (cairo, rgba.red, rgba.green, rgba.blue, rgba.alpha); } Cairo.cairo_rectangle (cairo, x, y, width, height); Cairo.cairo_fill (cairo); @@ -154,7 +157,7 @@ int /*long*/ gdkGC = OS.gdk_gc_new (window); if (region != 0) OS.gdk_gc_set_clip_region (gdkGC, region); if (control.backgroundImage != null) { - Point pt = display.map (this, control, 0, 0); + Point pt = display.mapInPixels (this, control, 0, 0); OS.gdk_gc_set_fill (gdkGC, OS.GDK_TILED); OS.gdk_gc_set_ts_origin (gdkGC, -pt.x, -pt.y); OS.gdk_gc_set_tile (gdkGC, control.backgroundImage.pixmap); @@ -559,7 +562,7 @@ } /** - * Returns the preferred size of the receiver. + * Returns the preferred size (in points) of the receiver. * <p> * The <em>preferred size</em> of a control is the size that it would * best be displayed at. The width hint and height hint arguments @@ -589,6 +592,10 @@ return computeSize (wHint, hHint, true); } +Point computeSizeInPixels (int wHint, int hHint) { + return computeSizeInPixels (wHint, hHint, true); +} + Widget computeTabGroup () { if (isTabGroup()) return this; return parent.computeTabGroup (); @@ -652,14 +659,16 @@ * Feature in GTK 3. The widget foreground is inherited from the immediate * parent. This is not the expected behavior for SWT. The fix is to avoid * the inheritance by explicitly setting the default foreground on the widget. + * + * This can be removed on GTK3.16+. */ - if (OS.GTK3) { + if (OS.GTK_VERSION < OS.VERSION(3, 16, 0)) { setForegroundColor (topHandle (), display.COLOR_WIDGET_FOREGROUND); } } void checkBorder () { - if (getBorderWidth () == 0) style &= ~SWT.BORDER; + if (getBorderWidthInPixels () == 0) style &= ~SWT.BORDER; } void checkMirrored () { @@ -688,7 +697,7 @@ } /** - * Returns the preferred size of the receiver. + * Returns the preferred size (in points) of the receiver. * <p> * The <em>preferred size</em> of a control is the size that it would * best be displayed at. The width hint and height hint arguments @@ -725,6 +734,15 @@ checkWidget(); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; + wHint = DPIUtil.autoScaleUp(wHint); + hHint = DPIUtil.autoScaleUp(hHint); + return DPIUtil.autoScaleDown (computeSizeInPixels (wHint, hHint, changed)); +} + +Point computeSizeInPixels (int wHint, int hHint, boolean changed) { + checkWidget(); + if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; + if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; return computeNativeSize (handle, wHint, hHint, changed); } @@ -813,7 +831,7 @@ } /** - * Returns a rectangle describing the receiver's size and location + * Returns a rectangle describing the receiver's size and location in points * relative to its parent (or its display if its parent is null), * unless the receiver is a shell. In this case, the location is * relative to the display. @@ -827,6 +845,11 @@ */ public Rectangle getBounds () { checkWidget(); + return DPIUtil.autoScaleDown(getBoundsInPixels()); +} + +Rectangle getBoundsInPixels () { + checkWidget(); int /*long*/ topHandle = topHandle (); GtkAllocation allocation = new GtkAllocation (); OS.gtk_widget_get_allocation (topHandle, allocation); @@ -839,7 +862,7 @@ } /** - * Sets the receiver's size and location to the rectangular + * Sets the receiver's size and location in points to the rectangular * area specified by the argument. The <code>x</code> and * <code>y</code> fields of the rectangle are relative to * the receiver's parent (or its display if its parent is null). @@ -848,6 +871,11 @@ * receiver to a negative number will cause that * value to be set to zero instead. * </p> + * <p> + * Note: On GTK, attempting to set the width or height of the + * receiver to a number higher or equal 2^14 will cause them to be + * set to (2^14)-1 instead. + * </p> * * @param rect the new bounds for the receiver * @@ -859,11 +887,18 @@ public void setBounds (Rectangle rect) { checkWidget (); if (rect == null) error (SWT.ERROR_NULL_ARGUMENT); + rect = DPIUtil.autoScaleUp(rect); + setBounds (rect.x, rect.y, Math.max (0, rect.width), Math.max (0, rect.height), true, true); +} + +void setBoundsInPixels (Rectangle rect) { + checkWidget (); + if (rect == null) error (SWT.ERROR_NULL_ARGUMENT); setBounds (rect.x, rect.y, Math.max (0, rect.width), Math.max (0, rect.height), true, true); } /** - * Sets the receiver's size and location to the rectangular + * Sets the receiver's size and location in points to the rectangular * area specified by the arguments. The <code>x</code> and * <code>y</code> arguments are relative to the receiver's * parent (or its display if its parent is null), unless @@ -874,6 +909,11 @@ * receiver to a negative number will cause that * value to be set to zero instead. * </p> + * <p> + * Note: On GTK, attempting to set the width or height of the + * receiver to a number higher or equal 2^14 will cause them to be + * set to (2^14)-1 instead. + * </p> * * @param x the new x coordinate for the receiver * @param y the new y coordinate for the receiver @@ -887,6 +927,12 @@ */ public void setBounds (int x, int y, int width, int height) { checkWidget(); + Rectangle rect = DPIUtil.autoScaleUp(new Rectangle (x, y, width, height)); + setBounds (rect.x, rect.y, Math.max (0, rect.width), Math.max (0, rect.height), true, true); +} + +void setBoundsInPixels (int x, int y, int width, int height) { + checkWidget(); setBounds (x, y, Math.max (0, width), Math.max (0, height), true, true); } @@ -942,6 +988,10 @@ } int setBounds (int x, int y, int width, int height, boolean move, boolean resize) { + // bug in GTK2 crashes JVM, in GTK3 the new shell only. See bug 472743 + width = Math.min(width, (2 << 14) - 1); + height = Math.min(height, (2 << 14) - 1); + int /*long*/ topHandle = topHandle (); boolean sendMove = move; GtkAllocation allocation = new GtkAllocation (); @@ -1011,6 +1061,7 @@ */ if (OS.GTK_VERSION >= OS.VERSION (3, 8, 0) && !OS.gtk_widget_get_visible(handle)) { OS.gtk_widget_show(handle); + gtk_widget_get_preferred_size (topHandle, requisition); OS.gtk_widget_size_allocate (topHandle, allocation); OS.gtk_widget_hide(handle); } else { @@ -1058,7 +1109,7 @@ /** * Returns a point describing the receiver's location relative - * to its parent (or its display if its parent is null), unless + * to its parent in points (or its display if its parent is null), unless * the receiver is a shell. In this case, the point is * relative to the display. * @@ -1071,6 +1122,11 @@ */ public Point getLocation () { checkWidget(); + return DPIUtil.autoScaleDown(getLocationInPixels()); +} + +Point getLocationInPixels () { + checkWidget(); int /*long*/ topHandle = topHandle (); GtkAllocation allocation = new GtkAllocation (); OS.gtk_widget_get_allocation (topHandle, allocation); @@ -1100,6 +1156,13 @@ public void setLocation (Point location) { checkWidget (); if (location == null) error (SWT.ERROR_NULL_ARGUMENT); + location = DPIUtil.autoScaleUp(location); + setBounds (location.x, location.y, 0, 0, true, false); +} + +void setLocationInPixels (Point location) { + checkWidget (); + if (location == null) error (SWT.ERROR_NULL_ARGUMENT); setBounds (location.x, location.y, 0, 0, true, false); } @@ -1120,11 +1183,17 @@ */ public void setLocation(int x, int y) { checkWidget(); + Point loc = DPIUtil.autoScaleUp(new Point (x, y)); + setBounds (loc.x, loc.y, 0, 0, true, false); +} + +void setLocationInPixels(int x, int y) { + checkWidget(); setBounds (x, y, 0, 0, true, false); } /** - * Returns a point describing the receiver's size. The + * Returns a point describing the receiver's size in points. The * x coordinate of the result is the width of the receiver. * The y coordinate of the result is the height of the * receiver. @@ -1138,6 +1207,11 @@ */ public Point getSize () { checkWidget(); + return DPIUtil.autoScaleDown(getSizeInPixels()); +} + +Point getSizeInPixels () { + checkWidget(); int /*long*/ topHandle = topHandle (); GtkAllocation allocation = new GtkAllocation (); OS.gtk_widget_get_allocation (topHandle, allocation); @@ -1153,8 +1227,13 @@ * receiver to a negative number will cause them to be * set to zero instead. * </p> + * <p> + * Note: On GTK, attempting to set the width or height of the + * receiver to a number higher or equal 2^14 will cause them to be + * set to (2^14)-1 instead. + * </p> * - * @param size the new size for the receiver + * @param size the new size in points for the receiver * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the point is null</li> @@ -1167,6 +1246,13 @@ public void setSize (Point size) { checkWidget (); if (size == null) error (SWT.ERROR_NULL_ARGUMENT); + size = DPIUtil.autoScaleUp(size); + setBounds (0, 0, Math.max (0, size.x), Math.max (0, size.y), false, true); +} + +void setSizeInPixels (Point size) { + checkWidget (); + if (size == null) error (SWT.ERROR_NULL_ARGUMENT); setBounds (0, 0, Math.max (0, size.x), Math.max (0, size.y), false, true); } @@ -1227,9 +1313,14 @@ * receiver to a negative number will cause that * value to be set to zero instead. * </p> + * <p> + * Note: On GTK, attempting to set the width or height of the + * receiver to a number higher or equal 2^14 will cause them to be + * set to (2^14)-1 instead. + * </p> * - * @param width the new width for the receiver - * @param height the new height for the receiver + * @param width the new width in points for the receiver + * @param height the new height in points for the receiver * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -1238,6 +1329,12 @@ */ public void setSize (int width, int height) { checkWidget(); + Point size = DPIUtil.autoScaleUp(new Point (width, height)); + setBounds (0, 0, Math.max (0, size.x), Math.max (0, size.y), false, true); +} + +void setSizeInPixels (int width, int height) { + checkWidget(); setBounds (0, 0, Math.max (0, width), Math.max (0, height), false, true); } @@ -1387,8 +1484,8 @@ * {@link Display#map(Control, Control, Rectangle)}. * </p> * - * @param x the x coordinate to be translated - * @param y the y coordinate to be translated + * @param x the x coordinate in points to be translated + * @param y the y coordinate in points to be translated * @return the translated coordinates * * @exception SWTException <ul> @@ -1403,9 +1500,9 @@ int /*long*/ window = eventWindow (); int [] origin_x = new int [1], origin_y = new int [1]; OS.gdk_window_get_origin (window, origin_x, origin_y); - x -= origin_x [0]; - y -= origin_y [0]; - if ((style & SWT.MIRRORED) != 0) x = getClientWidth () - x; + x -= DPIUtil.autoScaleDown (origin_x [0]); + y -= DPIUtil.autoScaleDown (origin_y [0]); + if ((style & SWT.MIRRORED) != 0) x = DPIUtil.autoScaleDown (getClientWidth ()) - x; return new Point (x, y); } @@ -1460,6 +1557,17 @@ int /*long*/ window = eventWindow (); int [] origin_x = new int [1], origin_y = new int [1]; OS.gdk_window_get_origin (window, origin_x, origin_y); + if ((style & SWT.MIRRORED) != 0) x = DPIUtil.autoScaleDown (getClientWidth ()) - x; + x += DPIUtil.autoScaleDown (origin_x [0]); + y += DPIUtil.autoScaleDown (origin_y [0]); + return new Point (x, y); +} + +Point toDisplayInPixels (int x, int y) { + checkWidget(); + int /*long*/ window = eventWindow (); + int [] origin_x = new int [1], origin_y = new int [1]; + OS.gdk_window_get_origin (window, origin_x, origin_y); if ((style & SWT.MIRRORED) != 0) x = getClientWidth () - x; x += origin_x [0]; y += origin_y [0]; @@ -1492,6 +1600,11 @@ return toDisplay (point.x, point.y); } +Point toDisplayInPixels (Point point) { + checkWidget(); + if (point == null) error (SWT.ERROR_NULL_ARGUMENT); + return toDisplayInPixels (point.x, point.y); +} /** * Adds the listener to the collection of listeners who will * be notified when the control is moved or resized, by sending @@ -1585,6 +1698,10 @@ * must be invoked on it to specify that gesture events should be * sent instead of touch events. * </p> + * <p> + * <b>Warning</b>: This API is currently only implemented on Windows and Cocoa. + * SWT doesn't send Gesture or Touch events on GTK. + * </p> * * @param listener the listener which should be notified * @@ -1850,6 +1967,10 @@ * specify that touch events should be sent, which will cause gesture * events to not be sent. * </p> + * <p> + * <b>Warning</b>: This API is currently only implemented on Windows and Cocoa. + * SWT doesn't send Gesture or Touch events on GTK. + * </p> * * @param listener the listener which should be notified * @@ -2360,7 +2481,7 @@ Point startPos = null; Point currPos = null; if (OS.GTK3) { - startPos = display.getCursorLocation(); + startPos = display.getCursorLocationInPixels(); } while (!quit) { @@ -2378,7 +2499,7 @@ break; } else { if (OS.GTK3) { //428852 - currPos = display.getCursorLocation(); + currPos = display.getCursorLocationInPixels(); dragging = OS.gtk_drag_check_threshold (handle, startPos.x, startPos.y, currPos.x, currPos.y); if (dragging) break; @@ -2577,29 +2698,33 @@ GdkColor getContextBackground () { int /*long*/ fontHandle = fontHandle (); - int /*long*/ context = OS.gtk_widget_get_style_context (fontHandle); - GdkRGBA rgba = new GdkRGBA (); - OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_NORMAL, rgba); - if (rgba.alpha == 0) { - return display.COLOR_WIDGET_BACKGROUND; + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + if (provider != 0) { + return display.gtk_css_parse_background (provider, null); + } else { + return display.COLOR_WIDGET_BACKGROUND; + } + } else { + int /*long*/ context = OS.gtk_widget_get_style_context (fontHandle); + GdkRGBA rgba = new GdkRGBA (); + OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_NORMAL, rgba); + if (rgba.alpha == 0) { + return display.COLOR_WIDGET_BACKGROUND; + } + return display.toGdkColor (rgba); } - GdkColor color = new GdkColor (); - color.red = (short)(rgba.red * 0xFFFF); - color.green = (short)(rgba.green * 0xFFFF); - color.blue = (short)(rgba.blue * 0xFFFF); - return color; } GdkColor getContextColor () { int /*long*/ fontHandle = fontHandle (); - int /*long*/ context = OS.gtk_widget_get_style_context (fontHandle); - GdkRGBA rgba = new GdkRGBA (); - OS.gtk_style_context_get_color (context, OS.GTK_STATE_FLAG_NORMAL, rgba); - GdkColor color = new GdkColor (); - color.red = (short)(rgba.red * 0xFFFF); - color.green = (short)(rgba.green * 0xFFFF); - color.blue = (short)(rgba.blue * 0xFFFF); - return color; + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + return display.gtk_css_parse_foreground(provider, null); + } else { + int /*long*/ context = OS.gtk_widget_get_style_context (fontHandle); + GdkRGBA rgba = new GdkRGBA (); + rgba = display.styleContextGetColor (context, OS.GTK_STATE_FLAG_NORMAL, rgba); + return display.toGdkColor (rgba); + } } GdkColor getBgColor () { @@ -2630,7 +2755,7 @@ } /** - * Returns the receiver's border width. + * Returns the receiver's border width in points. * * @return the border width * @@ -2640,6 +2765,10 @@ * </ul> */ public int getBorderWidth () { + return DPIUtil.autoScaleDown(getBorderWidthInPixels()); +} + +int getBorderWidthInPixels () { checkWidget(); return 0; } @@ -2729,7 +2858,11 @@ int /*long*/ fontHandle = fontHandle (); if (OS.GTK3) { int /*long*/ context = OS.gtk_widget_get_style_context (fontHandle); - return OS.gtk_style_context_get_font(context, OS.GTK_STATE_FLAG_NORMAL); + if (OS.GTK_VERSION < OS.VERSION(3, 18, 0)) { + return OS.gtk_style_context_get_font(context, OS.GTK_STATE_FLAG_NORMAL); + } else { + return OS.gtk_style_context_get_font(context, OS.gtk_widget_get_state_flags(fontHandle)); + } } OS.gtk_widget_realize (fontHandle); return OS.gtk_style_get_font_desc (OS.gtk_widget_get_style (fontHandle)); @@ -2836,8 +2969,8 @@ int /*long*/ screen = OS.gdk_screen_get_default (); if (screen != 0) { int monitorNumber = OS.gdk_screen_get_monitor_at_window (screen, paintWindow ()); - Monitor[] monitors = display.getMonitors (); - + Monitor[] monitors = display.getMonitors (); + if (monitorNumber >= 0 && monitorNumber < monitors.length) { return monitors [monitorNumber]; } @@ -2989,12 +3122,21 @@ int xthickness = 0, ythickness = 0; GtkBorder tmp = new GtkBorder(); int /*long*/ context = OS.gtk_widget_get_style_context (widget); + + if (OS.GTK_VERSION < OS.VERSION(3, 18, 0)) { + OS.gtk_style_context_get_padding (context, OS.GTK_STATE_FLAG_NORMAL, tmp); + } else { + OS.gtk_style_context_get_padding (context, OS.gtk_widget_get_state_flags(widget), tmp); + } OS.gtk_style_context_save (context); OS.gtk_style_context_add_class (context, OS.GTK_STYLE_CLASS_FRAME); - OS.gtk_style_context_get_padding (context, OS.GTK_STATE_FLAG_NORMAL, tmp); xthickness += tmp.left; ythickness += tmp.top; - OS.gtk_style_context_get_border (context, OS.GTK_STATE_FLAG_NORMAL, tmp); + if (OS.GTK_VERSION < OS.VERSION(3, 18, 0)) { + OS.gtk_style_context_get_border (context, OS.GTK_STATE_FLAG_NORMAL, tmp); + } else { + OS.gtk_style_context_get_border (context, OS.gtk_widget_get_state_flags(widget), tmp); + } xthickness += tmp.left; ythickness += tmp.top; OS.gtk_style_context_restore (context); @@ -3108,7 +3250,7 @@ } int /*long*/ toolHandle = getShell().handle; OS.gtk_widget_set_tooltip_text (toolHandle, buffer); - + if (display.currentControl == this) return 0; GdkEventCrossing gdkEvent = new GdkEventCrossing (); OS.memmove (gdkEvent, event, GdkEventCrossing.sizeof); @@ -3203,18 +3345,18 @@ OS.gdk_cairo_get_clip_rectangle (cairo, rect); Event event = new Event (); event.count = 1; - event.x = rect.x; - event.y = rect.y; - event.width = rect.width; - event.height = rect.height; - if ((style & SWT.MIRRORED) != 0) event.x = getClientWidth () - event.width - event.x; + Rectangle eventRect = new Rectangle (rect.x, rect.y, rect.width, rect.height); + event.setBounds (DPIUtil.autoScaleDown (eventRect)); + if ((style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown (getClientWidth ()) - event.width - event.x; GCData data = new GCData (); // data.damageRgn = gdkEvent.region; if (OS.GTK_VERSION <= OS.VERSION (3, 9, 0)) { data.cairo = cairo; } GC gc = event.gc = GC.gtk_new (this, data); - gc.setClipping (rect.x, rect.y, rect.width, rect.height); + Rectangle rect2 = DPIUtil.autoScaleDown(new Rectangle(rect.x, rect.y, rect.width, rect.height)); + // Caveat: rect2 is necessary because GC#setClipping(Rectangle) got broken by bug 446075 + gc.setClipping (rect2.x, rect2.y, rect2.width, rect2.height); drawWidget (gc); sendEvent (SWT.Paint, event); gc.dispose (); @@ -3230,11 +3372,9 @@ OS.memmove(gdkEvent, eventPtr, GdkEventExpose.sizeof); Event event = new Event (); event.count = gdkEvent.count; - event.x = gdkEvent.area_x; - event.y = gdkEvent.area_y; - event.width = gdkEvent.area_width; - event.height = gdkEvent.area_height; - if ((style & SWT.MIRRORED) != 0) event.x = getClientWidth () - event.width - event.x; + Rectangle eventRect = new Rectangle (gdkEvent.area_x, gdkEvent.area_y, gdkEvent.area_width, gdkEvent.area_height); + event.setBounds (DPIUtil.autoScaleDown (eventRect)); + if ((style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown (getClientWidth ()) - event.width - event.x; GCData data = new GCData (); data.damageRgn = gdkEvent.region; GC gc = event.gc = GC.gtk_new (this, data); @@ -3385,11 +3525,12 @@ if (OS.GTK3 && this != display.currentControl) { if (display.currentControl != null && !display.currentControl.isDisposed ()) { display.removeMouseHoverTimeout (display.currentControl.handle); - display.currentControl.sendMouseEvent (SWT.MouseExit, 0, gdkEvent.time, x, y, false, state); + Point pt = display.mapInPixels (this, display.currentControl, (int) x, (int) y); + display.currentControl.sendMouseEvent (SWT.MouseExit, 0, gdkEvent.time, pt.x, pt.y, gdkEvent.is_hint != 0, state); } if (!isDisposed ()) { display.currentControl = this; - sendMouseEvent (SWT.MouseEnter, 0, gdkEvent.time, x, y, false, state); + sendMouseEvent (SWT.MouseEnter, 0, gdkEvent.time, x, y, gdkEvent.is_hint != 0, state); } } int result = sendMouseEvent (SWT.MouseMove, 0, gdkEvent.time, x, y, gdkEvent.is_hint != 0, state) ? 0 : 1; @@ -3473,6 +3614,20 @@ return 0; } +String gtk_widget_get_name(int /*long*/ handle) { + int /*long*/ str = OS.gtk_widget_get_name (handle); + String name; + if (str == 0) { + name = "*"; + } else { + int length = OS.strlen (str); + byte [] buffer = new byte [length]; + OS.memmove (buffer, str, length); + name = new String (Converter.mbcsToWcs (null, buffer)); + } + return name; +} + void gtk_widget_size_request (int /*long*/ widget, GtkRequisition requisition) { gtk_widget_get_preferred_size (widget, requisition); } @@ -3492,6 +3647,7 @@ * * @noreference This method is not intended to be referenced by clients. */ +@Override public int /*long*/ internal_new_GC (GCData data) { checkWidget (); int /*long*/ window = paintWindow (); @@ -3546,6 +3702,7 @@ * * @noreference This method is not intended to be referenced by clients. */ +@Override public void internal_dispose_GC (int /*long*/ hDC, GCData data) { checkWidget (); int /*long*/ gc = hDC; @@ -3579,7 +3736,7 @@ if (!isVisible ()) return false; Control control = this; while (control != null) { - Point size = control.getSize (); + Point size = control.getSizeInPixels (); if (size.x == 0 || size.y == 0) { return false; } @@ -3697,6 +3854,25 @@ } /** + * Requests that this control and all of its ancestors be repositioned by + * their layouts at the earliest opportunity. This should be invoked after + * modifying the control in order to inform any dependent layouts of + * the change. + * <p> + * The control will not be repositioned synchronously. This method is + * fast-running and only marks the control for future participation in + * a deferred layout. + * <p> + * Invoking this method multiple times before the layout occurs is an + * inexpensive no-op. + * + * @since 3.105 + */ +public void requestLayout () { + getShell ().layout (new Control[] {this}, SWT.DEFER); +} + +/** * Causes the entire bounds of the receiver to be marked * as needing to be redrawn. The next time a paint request * is processed, the control will be completely painted, @@ -3758,6 +3934,12 @@ */ public void redraw (int x, int y, int width, int height, boolean all) { checkWidget(); + Rectangle rect = DPIUtil.autoScaleUp(new Rectangle(x, y, width, height)); + redrawInPixels(rect.x, rect.y, rect.width, rect.height, all); +} + +void redrawInPixels (int x, int y, int width, int height, boolean all) { + checkWidget(); if (!OS.gtk_widget_get_visible (topHandle ())) return; if ((style & SWT.MIRRORED) != 0) x = getClientWidth () - width - x; redrawWidget (x, y, width, height, false, all, false); @@ -3858,9 +4040,9 @@ boolean sendDragEvent (int button, int stateMask, int x, int y, boolean isStateMask) { Event event = new Event (); event.button = button; - event.x = x; - event.y = y; - if ((style & SWT.MIRRORED) != 0) event.x = getClientWidth () - event.x; + Rectangle eventRect = new Rectangle (x, y, 0, 0); + event.setBounds (eventRect); + if ((style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown(getClientWidth ()) - event.x; if (isStateMask) { event.stateMask = stateMask; } else { @@ -3927,16 +4109,17 @@ event.detail = detail; event.count = count; if (is_hint) { - event.x = (int)x; - event.y = (int)y; + // coordinates are already window-relative, see #gtk_motion_notify_event(..) and bug 94502 + Rectangle eventRect = new Rectangle ((int)x, (int)y, 0, 0); + event.setBounds (DPIUtil.autoScaleDown (eventRect)); } else { int /*long*/ window = eventWindow (); int [] origin_x = new int [1], origin_y = new int [1]; OS.gdk_window_get_origin (window, origin_x, origin_y); - event.x = (int)x - origin_x [0]; - event.y = (int)y - origin_y [0]; + Rectangle eventRect = new Rectangle ((int)x - origin_x [0], (int)y - origin_y [0], 0, 0); + event.setBounds (DPIUtil.autoScaleDown (eventRect)); } - if ((style & SWT.MIRRORED) != 0) event.x = getClientWidth () - event.x; + if ((style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown (getClientWidth ()) - event.x; setInputState (event, state); if (send) { sendEvent (type, event); @@ -4031,19 +4214,38 @@ } void setBackgroundColor (int /*long*/ context, int /*long*/ handle, GdkRGBA rgba) { - OS.gtk_widget_override_background_color (handle, OS.GTK_STATE_FLAG_NORMAL, rgba); + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + // Form background string + String name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? display.gtk_widget_class_get_css_name(handle) + : display.gtk_widget_get_name(handle); + String css = name + " {background-color: " + display.gtk_rgba_to_css_string (rgba) + ";}"; + + // Cache background + cssBackground = css; + + // Apply background color and any cached foreground color + String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND); + gtk_css_provider_load_from_css (context, finalCss); + } else { + OS.gtk_widget_override_background_color (handle, OS.GTK_STATE_FLAG_NORMAL, rgba); + } } void setBackgroundColorGradient (int /*long*/ context, int /*long*/ handle, GdkRGBA rgba) { String css ="* {\n"; if (rgba != null) { - String color = gtk_rgba_to_css_string (rgba); + String color = display.gtk_rgba_to_css_string (rgba); //Note, use 'background-image' CSS class with caution. Not all themes/widgets support it. (e.g button doesn't). //Use 'background' CSS class where possible instead unless 'background-image' is explicidly supported. css += "background-image: -gtk-gradient (linear, 0 0, 0 1, color-stop(0, " + color + "), color-stop(1, " + color + "));\n"; } css += "}\n"; - gtk_css_provider_load_from_css (context, css); + //Cache background color + cssBackground = css; + + // Apply background color and any cached foreground color + String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND); + gtk_css_provider_load_from_css (context, finalCss); } void gtk_css_provider_load_from_css (int /*long*/ context, String css) { @@ -4058,21 +4260,10 @@ OS.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (null, css, true), -1, null); } -String gtk_rgba_to_css_string (GdkRGBA rgba) { - /* - * In GdkRGBA, values are a double between 0-1.<br> - * In CSS, values are typically integers between 0-255.<br> - * I.e, note, there is a slight loss of precision. - * Thus setting/getting color *might* return slight differences. - */ - String color = "rgba(" + (int)(rgba.red * 255) + "," + (int)(rgba.green * 255) + "," + (int)(rgba.blue * 255) + "," + (int)(rgba.alpha * 255) + ")"; - return color; -} - void setBackgroundColor (int /*long*/ handle, GdkColor color) { if (OS.GTK3) { GdkRGBA rgba = null; - double alpha = 1; + double alpha = 1.0; if (color == null) { if ((state & PARENT_BACKGROUND) != 0) { alpha = 0; @@ -4085,11 +4276,8 @@ alpha = backgroundAlpha; } if (color != null) { - rgba = new GdkRGBA (); + rgba = display.toGdkRGBA (color); rgba.alpha = alpha / (float)255; - rgba.red = (color.red & 0xFFFF) / (float)0xFFFF; - rgba.green = (color.green & 0xFFFF) / (float)0xFFFF; - rgba.blue = (color.blue & 0xFFFF) / (float)0xFFFF; } int /*long*/ context = OS.gtk_widget_get_style_context (handle); setBackgroundColor (context, handle, rgba); @@ -4509,7 +4697,41 @@ } void setForegroundColor (GdkColor color) { - setForegroundColor (handle, color); + GdkRGBA rgba = null; + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + if (color != null) { + rgba = display.toGdkRGBA (color); + } + setForegroundColor(handle, rgba); + } else { + setForegroundColor (handle, color); + } +} + +void setForegroundColor (int /*long*/ handle, GdkRGBA rgba) { + GdkRGBA toSet = new GdkRGBA(); + if (rgba != null) { + toSet = rgba; + } else { + GdkColor defaultForeground = display.COLOR_WIDGET_FOREGROUND; + toSet = display.toGdkRGBA (defaultForeground); + } + int /*long*/ context = OS.gtk_widget_get_style_context (handle); + // Form foreground string + String color = display.gtk_rgba_to_css_string(toSet); + String name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? display.gtk_widget_class_get_css_name(handle) + : display.gtk_widget_get_name(handle); + GdkRGBA selectedForeground = display.toGdkRGBA(getDisplay().COLOR_LIST_SELECTION_TEXT); + String selection = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? " selection" : ":selected"; + String css = "* {color: " + color + ";}\n" + + name + selection + " {color: " + display.gtk_rgba_to_css_string(selectedForeground) + ";}"; + + // Cache foreground color + cssForeground = css; + + // Apply foreground color and any cached background color + String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.FOREGROUND); + gtk_css_provider_load_from_css(context, finalCss); } void setInitialBounds () { @@ -4737,7 +4959,7 @@ if (drawCount++ == 0) { if (gtk_widget_get_realized (handle)) { int /*long*/ window = paintWindow (); - Rectangle rect = getBounds (); + Rectangle rect = getBoundsInPixels (); GdkWindowAttr attributes = new GdkWindowAttr (); attributes.width = rect.width; attributes.height = rect.height; @@ -4751,7 +4973,11 @@ OS.GDK_BUTTON_MOTION_MASK | OS.GDK_BUTTON1_MOTION_MASK | OS.GDK_BUTTON2_MOTION_MASK | OS.GDK_BUTTON3_MOTION_MASK; OS.gdk_window_set_events (window, OS.gdk_window_get_events (window) & ~mouseMask); - OS.gdk_window_set_back_pixmap (redrawWindow, 0, false); + if (OS.GTK3) { + OS.gdk_window_set_background_pattern(redrawWindow, 0); + } else { + OS.gdk_window_set_back_pixmap (redrawWindow, 0, false); + } OS.gdk_window_show (redrawWindow); } } @@ -4768,10 +4994,7 @@ /** * Sets the base text direction (a.k.a. "paragraph direction") of the receiver, * which must be one of the constants <code>SWT.LEFT_TO_RIGHT</code>, - * <code>SWT.RIGHT_TO_LEFT</code>, or a bitwise disjunction - * <code>SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT</code>. The latter stands for an - * "auto" direction, which implies that a control containing text derives the - * direction from the directionality of the first strong bidi character. + * <code>SWT.RIGHT_TO_LEFT</code>, or <code>SWT.AUTO_TEXT_DIRECTION</code>. * <p> * <code>setOrientation</code> would override this value with the text direction * that is consistent with the new orientation. @@ -4790,6 +5013,7 @@ * * @see SWT#LEFT_TO_RIGHT * @see SWT#RIGHT_TO_LEFT + * @see SWT#AUTO_TEXT_DIRECTION * @see SWT#FLIP_TEXT_DIRECTION * * @since 3.102 @@ -5058,8 +5282,8 @@ boolean showMenu (int x, int y, int detail) { Event event = new Event (); - event.x = x; - event.y = y; + Rectangle eventRect = new Rectangle (x, y, 0, 0); + event.setBounds (DPIUtil.autoScaleDown (eventRect)); event.detail = detail; sendEvent (SWT.MenuDetect, event); //widget could be disposed at this point @@ -5068,8 +5292,9 @@ if (menu != null && !menu.isDisposed ()) { boolean hooksKeys = hooks (SWT.KeyDown) || hooks (SWT.KeyUp); menu.createIMMenu (hooksKeys ? imHandle() : 0); - if (event.x != x || event.y != y) { - menu.setLocation (event.x, event.y); + Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ()); + if (rect.x != x || rect.y != y) { + menu.setLocationInPixels (rect.x, rect.y); } menu.setVisible (true); return true; @@ -5527,7 +5752,7 @@ int /*long*/ window = paintWindow (); if (flush) display.flushExposes (window, all); /* - * Do not send expose events on GTK 3.16.0+ + * Do not send expose events on GTK 3.16.0+ * It's worth checking whether can be removed on all GTK 3 versions. */ if (OS.GTK_VERSION < OS.VERSION(3, 16, 0)) { @@ -5559,7 +5784,11 @@ if (OS.GTK3 && !draw && (state & CANVAS) != 0) { GdkRGBA rgba = new GdkRGBA(); int /*long*/ context = OS.gtk_widget_get_style_context (handle); - OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_NORMAL, rgba); + if (OS.GTK_VERSION < OS.VERSION(3, 18, 0)) { + OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_NORMAL, rgba); + } else { + OS.gtk_style_context_get_background_color (context, OS.gtk_widget_get_state_flags(handle), rgba); + } draw = rgba.alpha == 0; } if (draw) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/CoolBar.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/CoolBar.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/CoolBar.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/CoolBar.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -36,7 +36,7 @@ * </p><p> * IMPORTANT: This class is <em>not</em> intended to be subclassed. * </p> - * + * * @see <a href="http://www.eclipse.org/swt/snippets/#coolbar">CoolBar snippets</a> * @see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: ControlExample</a> * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> @@ -54,14 +54,14 @@ static final int CLICK_DISTANCE = 3; static final int DEFAULT_COOLBAR_WIDTH = 0; static final int DEFAULT_COOLBAR_HEIGHT = 0; - + /** * Constructs a new instance of this class given its parent * and a style value describing its behavior and appearance. * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -97,6 +97,7 @@ } dragCursor = new Cursor(display, SWT.CURSOR_SIZEALL); Listener listener = new Listener() { + @Override public void handleEvent(Event event) { switch (event.type) { case SWT.Dispose: onDispose(event); break; @@ -110,18 +111,18 @@ } } }; - int[] events = new int[] { - SWT.Dispose, + int[] events = new int[] { + SWT.Dispose, SWT.MouseDown, - SWT.MouseExit, - SWT.MouseMove, - SWT.MouseUp, + SWT.MouseExit, + SWT.MouseMove, + SWT.MouseUp, SWT.MouseDoubleClick, SWT.Paint, SWT.Resize }; for (int i = 0; i < events.length; i++) { - addListener(events[i], listener); + addListener(events[i], listener); } } static int checkStyle (int style) { @@ -171,9 +172,9 @@ if (bounds.x > x) break; if (bounds.y > y) return null; if (bounds.contains(x, y)) { - return item; - } - } + return item; + } + } } return null; } @@ -198,7 +199,7 @@ if (index < 0) error (SWT.ERROR_INVALID_RANGE); for (int row = 0; row < items.length; row++) { if (items[row].length > index) { - return items[row][index]; + return items[row][index]; } else { index -= items[row].length; } @@ -226,7 +227,7 @@ * <p> * Note: This is not the actual structure used by the receiver * to maintain its list of items, so modifying the array will - * not affect the receiver. + * not affect the receiver. * </p> * * @return the receiver's items in their current visual order @@ -249,7 +250,7 @@ Point findItem (CoolItem item) { for (int row = 0; row < items.length; row++) { for (int i = 0; i < items[row].length; i++) { - if (items[row][i].equals(item)) return new Point(i, row); + if (items[row][i].equals(item)) return new Point(i, row); } } return new Point(-1, -1); @@ -271,7 +272,7 @@ if ((style & SWT.VERTICAL) != 0) { return new Point(y, x); } - return new Point(x, y); + return new Point(x, y); } /** * Searches the receiver's items in the order they are currently @@ -299,7 +300,7 @@ for (int row = 0; row < items.length; row++) { for (int i = 0; i < items[row].length; i++) { if (items[row][i].equals(item)) { - return answer; + return answer; } else { answer++; } @@ -324,13 +325,13 @@ item.wrap = true; return true; } - + int barWidth = getWidth(); Rectangle bounds = items[rowIndex][0].internalGetBounds(); int rowY = bounds.y; int oldRowHeight = bounds.height; int x = Math.max(0, Math.abs(x_root - toDisplay(new Point(0, 0)).x)); - + /* Find the insertion index and add the item. */ int index; for (index = 0; index < items[rowIndex].length; index++) { @@ -359,7 +360,7 @@ left.setBounds(leftBounds.x, leftBounds.y, newWidth, leftBounds.height); left.requestedWidth = newWidth; } - + /* Set the item's bounds. */ int width = 0, height = item.preferredHeight; if (index < items[rowIndex].length - 1) { @@ -374,7 +375,7 @@ } else { width = Math.max(item.internalGetMinimumWidth(), barWidth - x); item.setBounds(x, rowY, width, height); - if (x + width > barWidth) moveLeft(item, x + width - barWidth); + if (x + width > barWidth) moveLeft(item, x + width - barWidth); } bounds = item.internalGetBounds(); item.requestedWidth = bounds.width; @@ -393,7 +394,7 @@ if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_INVALID_RANGE); if (items.length == 0) { items = new CoolItem[1][1]; - items[0][0] = item; + items[0][0] = item; } else { int i = index; /* find the row to insert into */ @@ -401,13 +402,13 @@ while (i > items[row].length) { i -= items[row].length; row++; - } + } } else { row = items.length - 1; - i = items[row].length; + i = items[row].length; } - - // Set the last item in the row to the preferred size + + // Set the last item in the row to the preferred size // and add the new one just to it's right int lastIndex = items[row].length - 1; CoolItem lastItem = items[row][lastIndex]; @@ -416,7 +417,7 @@ bounds.width = lastItem.preferredWidth; bounds.height = lastItem.preferredHeight; lastItem.requestedWidth = lastItem.preferredWidth; - lastItem.setBounds(bounds.x, bounds.y, bounds.width, bounds.height); + lastItem.setBounds(bounds.x, bounds.y, bounds.width, bounds.height); } if (i == 0) { item.wrap = true; @@ -430,7 +431,7 @@ items[row] = newRow; } item.requestedWidth = CoolItem.MINIMUM_WIDTH; - + int length = originalItems.length; CoolItem [] newOriginals = new CoolItem [length + 1]; System.arraycopy (originalItems, 0, newOriginals, 0, index); @@ -446,7 +447,7 @@ if (row == -1) return; Rectangle bounds = item.internalGetBounds(); removeItemFromRow(item, row, true); - + int index = 0; while (index < originalItems.length) { if (originalItems [index] == item) break; @@ -457,7 +458,7 @@ System.arraycopy (originalItems, 0, newOriginals, 0, index); System.arraycopy (originalItems, index + 1, newOriginals, index, length - index); originalItems = newOriginals; - + internalRedraw(bounds.x, bounds.y, CoolItem.MINIMUM_WIDTH, bounds.height); relayout(); } @@ -482,7 +483,7 @@ Point point = findItem(item); int row = point.y; int index = point.x; - if (index == 0) return; + if (index == 0) return; Rectangle bounds = item.internalGetBounds(); int minSpaceOnLeft = 0; for (int i = 0; i < index; i++) { @@ -512,14 +513,14 @@ Point point = findItem(item); int row = point.y; int index = point.x; - if (index == 0) return; + if (index == 0) return; Rectangle bounds = item.internalGetBounds(); int minSpaceOnRight = 0; for (int i = index; i < items[row].length; i++) { - minSpaceOnRight += items[row][i].internalGetMinimumWidth(); + minSpaceOnRight += items[row][i].internalGetMinimumWidth(); } int max = getWidth() - minSpaceOnRight; - int x = Math.min(max, bounds.x + pixels); + int x = Math.min(max, bounds.x + pixels); int width = 0; if (index + 1 == items[row].length) { width = getWidth() - x; @@ -540,7 +541,7 @@ int leftWidth = x - leftBounds.x; left.setBounds(leftBounds.x, leftBounds.y, leftWidth, leftBounds.height); left.requestedWidth = leftWidth; - + int damagedWidth = x - bounds.x + CoolItem.MINIMUM_WIDTH + CoolItem.MARGIN_WIDTH; if (x - bounds.x > 0) { internalRedraw(bounds.x - CoolItem.MARGIN_WIDTH, bounds.y, damagedWidth, bounds.height); @@ -616,12 +617,12 @@ int distance = event.x - Math.max(mouseXOffset, bounds.x + itemXOffset); if (distance > 0) moveRight(dragging, distance); } - mouseXOffset = event.x; + mouseXOffset = event.x; } else { if (grabbed != null) { _setCursor(hoverCursor); } else { - _setCursor(null); + _setCursor(null); } } fixEvent(event); @@ -632,11 +633,11 @@ if (grabbed != null) { _setCursor(hoverCursor); } else { - _setCursor(null); + _setCursor(null); } } void onMouseDoubleClick(Event event) { - if (isLocked) return; + if (isLocked) return; dragging = null; fixEvent(event); CoolItem target = getGrabbedItem(event.x, event.y); @@ -651,7 +652,7 @@ int maxSize = getWidth (); for (int i = 0; i < items[row].length; i++) { if (i != index) { - maxSize -= items[row][i].internalGetMinimumWidth(); + maxSize -= items[row][i].internalGetMinimumWidth(); } } if (bounds.width == maxSize) { @@ -670,7 +671,7 @@ int distance = target.preferredWidth - bounds.width; if (index + 1 < items[row].length) { CoolItem right = items[row][index + 1]; - moveRight(right, distance); + moveRight(right, distance); distance = target.preferredWidth - target.internalGetBounds().width; } if (distance > 0) { @@ -681,7 +682,7 @@ for (int i = 0; i < items[row].length; i++) { if (i != index) { CoolItem item = items[row][i]; - item.requestedWidth = Math.max(item.internalGetMinimumWidth(), CoolItem.MINIMUM_WIDTH); + item.requestedWidth = Math.max(item.internalGetMinimumWidth(), CoolItem.MINIMUM_WIDTH); } } target.requestedWidth = maxSize; @@ -709,37 +710,37 @@ rect = fixRectangle(bounds.x, bounds.y, bounds.width, bounds.height); if (!clipping.intersects(rect)) continue; boolean nativeGripper = false; - + /* Draw gripper. */ if (!isLocked) { rect = fixRectangle(bounds.x, bounds.y, CoolItem.MINIMUM_WIDTH, bounds.height); if (!flat) nativeGripper = drawGripper(gc, rect.x, rect.y, rect.width, rect.height, vertical); if (!nativeGripper) { - int grabberTrim = 2; + int grabberTrim = 2; int grabberHeight = bounds.height - (2 * grabberTrim) - 1; gc.setForeground(shadowColor); rect = fixRectangle( - bounds.x + CoolItem.MARGIN_WIDTH, - bounds.y + grabberTrim, - 2, + bounds.x + CoolItem.MARGIN_WIDTH, + bounds.y + grabberTrim, + 2, grabberHeight); gc.drawRectangle(rect); gc.setForeground(highlightColor); rect = fixRectangle( - bounds.x + CoolItem.MARGIN_WIDTH, - bounds.y + grabberTrim + 1, - bounds.x + CoolItem.MARGIN_WIDTH, + bounds.x + CoolItem.MARGIN_WIDTH, + bounds.y + grabberTrim + 1, + bounds.x + CoolItem.MARGIN_WIDTH, bounds.y + grabberTrim + grabberHeight - 1); gc.drawLine(rect.x, rect.y, rect.width, rect.height); rect = fixRectangle( - bounds.x + CoolItem.MARGIN_WIDTH, - bounds.y + grabberTrim, - bounds.x + CoolItem.MARGIN_WIDTH + 1, + bounds.x + CoolItem.MARGIN_WIDTH, + bounds.y + grabberTrim, + bounds.x + CoolItem.MARGIN_WIDTH + 1, bounds.y + grabberTrim); gc.drawLine(rect.x, rect.y, rect.width, rect.height); } } - + /* Draw separator. */ if (!flat && !nativeGripper && i != 0) { gc.setForeground(shadowColor); @@ -755,7 +756,7 @@ int separatorY = bounds.y + bounds.height; gc.setForeground(shadowColor); rect = fixRectangle(0, separatorY, stopX, separatorY); - gc.drawLine(rect.x, rect.y, rect.width, rect.height); + gc.drawLine(rect.x, rect.y, rect.width, rect.height); gc.setForeground(highlightColor); rect = fixRectangle(0, separatorY + 1, stopX, separatorY + 1); gc.drawLine(rect.x, rect.y, rect.width, rect.height); @@ -826,12 +827,12 @@ int layoutItems () { int y = 0, width; if ((style&SWT.VERTICAL) != 0) { - width = getClientArea().height; + width = getClientArea().height; } else { width = getClientArea().width; } wrapItems(width); - int rowSpacing = (style & SWT.FLAT) != 0 ? 0 : ROW_SPACING; + int rowSpacing = (style & SWT.FLAT) != 0 ? 0 : ROW_SPACING; for (int row = 0; row < items.length; row++) { int count = items[row].length; int x = 0; @@ -842,10 +843,10 @@ for (int i = 0; i < count; i++) { CoolItem item = items[row][i]; rowHeight = Math.max(rowHeight, item.preferredHeight); - available -= item.internalGetMinimumWidth(); + available -= item.internalGetMinimumWidth(); } if (row > 0) y += rowSpacing; - + /* lay the items out */ for (int i = 0; i < count; i++) { CoolItem child = items[row][i]; @@ -867,7 +868,7 @@ damage.y -= rowSpacing; damage.height += 2 * rowSpacing; } else if (oldBounds.height != newBounds.height) { - /* + /* * Draw from the bottom of the gripper to the bottom of the new area. * (Bottom of the gripper is -3 from the bottom of the item). */ @@ -898,7 +899,7 @@ if (height != size.x) super.setSize(trim.width, size.y); } else { Rectangle trim = computeTrim (0, 0, 0, height); - if (height != size.y) super.setSize(size.x, trim.height); + if (height != size.y) super.setSize(size.x, trim.height); } } /** @@ -912,7 +913,7 @@ * </p><p> * Note: This is not the actual structure used by the receiver * to maintain its list of items, so modifying the array will - * not affect the receiver. + * not affect the receiver. * </p> * * @return the current visual order of the receiver's items @@ -933,7 +934,7 @@ int index = 0; while (index<originalItems.length) { if (originalItems [index] == item) break; - index++; + index++; } if (index == originalItems.length) error (SWT.ERROR_CANNOT_GET_ITEM); indices [count++] = index; @@ -946,7 +947,7 @@ int count = originalItems.length; if (itemOrder.length != count) error(SWT.ERROR_INVALID_ARGUMENT); - /* Ensure that itemOrder does not contain any duplicates. */ + /* Ensure that itemOrder does not contain any duplicates. */ boolean [] set = new boolean [count]; for (int i = 0; i < set.length; i++) set [i] = false; for (int i = 0; i < itemOrder.length; i++) { @@ -954,7 +955,7 @@ if (set [itemOrder [i]]) error (SWT.ERROR_INVALID_ARGUMENT); set [itemOrder [i]] = true; } - + CoolItem[] row = new CoolItem[count]; for (int i = 0; i < count; i++) { row[i] = originalItems[itemOrder[i]]; @@ -1001,7 +1002,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 2.0 */ public boolean getLocked () { @@ -1010,7 +1011,7 @@ } int getWidth () { if ((style & SWT.VERTICAL) != 0) return getSize().y; - return getSize().x; + return getSize().x; } /** * Returns an array of ints that describe the zero-relative @@ -1051,7 +1052,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 2.0 */ public void setLocked (boolean locked) { @@ -1060,7 +1061,7 @@ redraw(); } isLocked = locked; - + } /** * Sets the indices of all item(s) in the receiver that will @@ -1158,7 +1159,7 @@ checkWidget(); setItemOrder(itemOrder); setWrapIndices(wrapIndices); - setItemSizes(sizes); + setItemSizes(sizes); relayout(); } @Override @@ -1203,7 +1204,7 @@ start = i; rowWidth = itemWidth; } - rowCount++; + rowCount++; } else { rowWidth += itemWidth; } @@ -1212,7 +1213,7 @@ int count = itemCount - start; newItems[rowCount] = new CoolItem[count]; System.arraycopy(itemsVisual, start, newItems[rowCount], 0, count); - rowCount++; + rowCount++; } if (newItems.length != rowCount) { CoolItem[][] tmp = new CoolItem[rowCount][]; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/CoolItem.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/CoolItem.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/CoolItem.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/CoolItem.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -14,7 +14,7 @@ import org.eclipse.swt.*; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; - + /** * Instances of this class are selectable user interface * objects that represent the dynamically positionable @@ -28,7 +28,7 @@ * <p> * IMPORTANT: This class is <em>not</em> intended to be subclassed. * </p> - * + * * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> * @noextend This class is not intended to be subclassed by clients. */ @@ -38,20 +38,20 @@ boolean ideal; int preferredWidth, preferredHeight, minimumWidth, minimumHeight, requestedWidth; Rectangle itemBounds = new Rectangle(0, 0, 0, 0); - + static final int MARGIN_WIDTH = 4; static final int GRABBER_WIDTH = 2; static final int MINIMUM_WIDTH = (2 * MARGIN_WIDTH) + GRABBER_WIDTH; - + private int CHEVRON_HORIZONTAL_TRIM = -1; //platform dependent values - private int CHEVRON_VERTICAL_TRIM = -1; + private int CHEVRON_VERTICAL_TRIM = -1; private static final int CHEVRON_LEFT_MARGIN = 2; private static final int CHEVRON_IMAGE_WIDTH = 8; //Width to draw the double arrow - + ToolBar chevron; boolean wrap; Image arrowImage = null; - + /** * Constructs a new instance of this class given its parent * (which must be a <code>CoolBar</code>) and a style value @@ -60,7 +60,7 @@ * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -96,7 +96,7 @@ * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -153,7 +153,7 @@ * @see SelectionListener * @see #removeSelectionListener * @see SelectionEvent - * + * * @since 2.0 */ public void addSelectionListener(SelectionListener listener) { @@ -167,7 +167,7 @@ protected void checkSubclass () { if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS); } -/* +/* * Find the trim size of the Toolbar widget in the current platform. */ void calculateChevronTrim () { @@ -190,8 +190,8 @@ * it would best be displayed at. The width hint and height hint arguments * allow the caller to ask the instance questions such as "Given a particular * width, how high does it need to be to show all of the contents?" - * To indicate that the caller does not wish to constrain a particular - * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint. + * To indicate that the caller does not wish to constrain a particular + * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint. * </p> * * @param wHint the width hint (can be <code>SWT.DEFAULT</code>) @@ -219,13 +219,13 @@ height += MINIMUM_WIDTH; } else { width += MINIMUM_WIDTH; - } + } return new Point (width, height); } @Override public void dispose () { if (isDisposed()) return; - + /* * Must call parent.destroyItem() before super.dispose(), since it needs to * query the bounds to properly remove the item. @@ -234,10 +234,10 @@ super.dispose (); parent = null; control = null; - - /* + + /* * Although the parent for the chevron is the CoolBar (CoolItem can not be the parent) - * it has to be disposed with the item + * it has to be disposed with the item */ if (chevron != null && !chevron.isDisposed()) chevron.dispose(); chevron = null; @@ -252,23 +252,23 @@ Color foreground = parent.getForeground (); Color black = display.getSystemColor (SWT.COLOR_BLACK); Color background = parent.getBackground (); - + PaletteData palette = new PaletteData (new RGB[]{foreground.getRGB(), background.getRGB(), black.getRGB()}); ImageData imageData = new ImageData (width, height, 4, palette); imageData.transparentPixel = 1; Image image = new Image (display, imageData); - + GC gc = new GC (image, parent.getStyle() & SWT.RIGHT_TO_LEFT); gc.setBackground (background); gc.fillRectangle (0, 0, width, height); gc.setForeground (black); - + int startX = 0 ; if ((parent.style & SWT.VERTICAL) != 0) { startX = width - CHEVRON_IMAGE_WIDTH; } - int startY = height / 6; - int step = 2; + int startY = height / 6; + int step = 2; gc.drawLine (startX, startY, startX + step, startY + step); gc.drawLine (startX, startY + (2 * step), startX + step, startY + step); startX++; @@ -318,14 +318,14 @@ /** * Returns the minimum size that the cool item can * be resized to using the cool item's gripper. - * + * * @return a point containing the minimum width and height of the cool item, in pixels - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 2.0 */ public Point getMinimumSize () { @@ -419,7 +419,7 @@ * * @see SelectionListener * @see #addSelectionListener - * + * * @since 2.0 */ public void removeSelectionListener(SelectionListener listener) { @@ -427,7 +427,7 @@ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); if (eventTable == null) return; eventTable.unhook (SWT.Selection, listener); - eventTable.unhook (SWT.DefaultSelection,listener); + eventTable.unhook (SWT.DefaultSelection,listener); } void setBounds (int x, int y, int width, int height) { itemBounds.x = x; @@ -454,7 +454,7 @@ * @param control the new control that will be contained by the receiver * * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li> + * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li> * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree</li> * </ul> * @exception SWTException <ul> @@ -480,15 +480,15 @@ /** * Sets the minimum size that the cool item can be resized to * using the cool item's gripper, to the point specified by the arguments. - * + * * @param width the minimum width of the cool item, in pixels * @param height the minimum height of the cool item, in pixels - * + * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 2.0 */ public void setMinimumSize (int width, int height) { @@ -500,9 +500,9 @@ /** * Sets the minimum size that the cool item can be resized to * using the cool item's gripper, to the point specified by the argument. - * + * * @param size a point representing the minimum width and height of the cool item, in pixels - * + * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the point is null</li> * </ul> @@ -510,7 +510,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 2.0 */ public void setMinimumSize (Point size) { @@ -622,6 +622,7 @@ chevron = new ToolBar (parent, SWT.FLAT | SWT.NO_FOCUS); ToolItem toolItem = new ToolItem (chevron, SWT.PUSH); toolItem.addListener (SWT.Selection, new Listener() { + @Override public void handleEvent (Event event) { CoolItem.this.onSelection (event); } @@ -634,9 +635,9 @@ } else { controlHeight = control.getSize ().y; if (arrowImage != null) currentImageHeight = arrowImage.getBounds().height; - } + } int height = Math.min (controlHeight, itemBounds.height); - int imageHeight = Math.max(1, height - CHEVRON_VERTICAL_TRIM); + int imageHeight = Math.max(1, height - CHEVRON_VERTICAL_TRIM); if (currentImageHeight != imageHeight) { Image image = createArrowImage (CHEVRON_IMAGE_WIDTH, imageHeight); chevron.getItem (0).setImage (image); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/DateTime.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/DateTime.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/DateTime.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/DateTime.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -148,6 +148,7 @@ createDropDownButton (); createPopupShell (-1, -1, -1); addListener (SWT.Resize, new Listener () { + @Override public void handleEvent (Event event) { setDropDownButtonSize (); } @@ -158,8 +159,8 @@ if (isDateWithDropDownButton ()) { //Date w/ drop down button is in containers. //first time round we set the bounds manually for correct Right_to_left behaviour - Point size = computeSize (SWT.DEFAULT, SWT.DEFAULT); - setBounds (0, 0, size.x, size.y); + Point size = computeSizeInPixels (SWT.DEFAULT, SWT.DEFAULT); + setBoundsInPixels (0, 0, size.x, size.y); } } @@ -235,7 +236,7 @@ } @Override -public Point computeSize (int wHint, int hHint, boolean changed) { +Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); int width = 0, height = 0; @@ -253,9 +254,9 @@ height = size.y; } else { Point textSize = computeNativeSize (textEntryHandle, wHint, hHint, changed); - Rectangle trim = computeTrim (0,0, textSize.x,textSize.y); + Rectangle trim = computeTrimInPixels (0,0, textSize.x,textSize.y); if (isDateWithDropDownButton ()){ - Point buttonSize = down.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed); + Point buttonSize = down.computeSizeInPixels (SWT.DEFAULT, SWT.DEFAULT, changed); width = trim.width + buttonSize.x; height = Math.max (trim.height, buttonSize.y); } else if (isDate () || isTime ()) { @@ -274,7 +275,7 @@ if (height == 0) height = DEFAULT_HEIGHT; if (wHint != SWT.DEFAULT) width = wHint; if (hHint != SWT.DEFAULT) height = hHint; - int borderWidth = getBorderWidth (); + int borderWidth = getBorderWidthInPixels (); if (prefferedSize == null && (isDateWithDropDownButton () && OS.GTK3)) { prefferedSize = new Point (width + 2*borderWidth, height+ 2*borderWidth); @@ -285,24 +286,32 @@ } @Override -public Rectangle computeTrim (int x, int y, int width, int height) { +Rectangle computeTrimInPixels (int x, int y, int width, int height) { if (isCalendar ()) { - return super.computeTrim (x, y, width, height); + return super.computeTrimInPixels (x, y, width, height); } checkWidget (); - Rectangle trim = super.computeTrim (x, y, width, height); + Rectangle trim = super.computeTrimInPixels (x, y, width, height); int xborder = 0, yborder = 0; if (OS.GTK3) { GtkBorder tmp = new GtkBorder (); int /*long*/ context = OS.gtk_widget_get_style_context (textEntryHandle); - OS.gtk_style_context_get_padding (context, OS.GTK_STATE_FLAG_NORMAL, tmp); + if (OS.GTK_VERSION < OS.VERSION(3, 18, 0)) { + OS.gtk_style_context_get_padding (context, OS.GTK_STATE_FLAG_NORMAL, tmp); + } else { + OS.gtk_style_context_get_padding (context, OS.gtk_widget_get_state_flags(textEntryHandle), tmp); + } trim.x -= tmp.left; trim.y -= tmp.top; trim.width += tmp.left + tmp.right; trim.height += tmp.top + tmp.bottom; if ((style & SWT.BORDER) != 0) { - OS.gtk_style_context_get_border (context, OS.GTK_STATE_FLAG_NORMAL, tmp); + if (OS.GTK_VERSION < OS.VERSION(3, 18, 0)) { + OS.gtk_style_context_get_border (context, OS.GTK_STATE_FLAG_NORMAL, tmp); + } else { + OS.gtk_style_context_get_border (context, OS.gtk_widget_get_state_flags(textEntryHandle), tmp); + } trim.x -= tmp.left; trim.y -= tmp.top; trim.width += tmp.left + tmp.right; @@ -354,7 +363,9 @@ createHandleForDateTime (); } OS.gtk_editable_set_editable (textEntryHandle, (style & SWT.READ_ONLY) == 0); - OS.gtk_entry_set_has_frame (textEntryHandle, (style & SWT.BORDER) != 0); + if (OS.GTK_VERSION <= OS.VERSION(3, 20, 0)) { + OS.gtk_entry_set_has_frame (textEntryHandle, (style & SWT.BORDER) != 0); + } } } @@ -419,6 +430,7 @@ down = new Button (this, SWT.ARROW | SWT.DOWN); OS.gtk_widget_set_can_focus (down.handle, false); down.addListener (SWT.Selection, new Listener () { + @Override public void handleEvent (Event event) { popupCalendar.calendarDisplayed = !isDropped (); setFocus (); @@ -427,6 +439,7 @@ }); popupListener = new Listener () { + @Override public void handleEvent (Event event) { if (event.widget == popupShell) { popupShellEvent (event); @@ -442,6 +455,7 @@ } if (event.widget == getShell ()) { getDisplay ().asyncExec (new Runnable () { + @Override public void run () { if (isDisposed ()) return; handleFocus (SWT.FocusOut); @@ -451,6 +465,7 @@ } }; popupFilter = new Listener () { + @Override public void handleEvent (Event event) { Shell shell = ((Control)event.widget).getShell (); if (shell == DateTime.this.getShell ()) { @@ -468,6 +483,7 @@ if (bg != null) popupCalendar.setBackground (bg); mouseEventListener = new Listener () { + @Override public void handleEvent (Event event) { if (event.widget instanceof Control) { Control c = (Control)event.widget; @@ -545,11 +561,11 @@ } //This is the x/y/width/height of the container of DateTime - Point containerBounds = getSize (); - Point calendarSize = popupCalendar.computeSize (SWT.DEFAULT, SWT.DEFAULT, false); + Point containerBounds = getSizeInPixels (); + Point calendarSize = popupCalendar.computeSizeInPixels (SWT.DEFAULT, SWT.DEFAULT, false); //Set the inner calendar pos/size. (not the popup shell pos/size) - popupCalendar.setBounds (1, 1, Math.max (containerBounds.x - 2, calendarSize.x), calendarSize.y); + popupCalendar.setBoundsInPixels (1, 1, Math.max (containerBounds.x - 2, calendarSize.x), calendarSize.y); //Set Date & focus current day popupCalendar.setDate (savedYear, savedMonth, savedDay); @@ -558,8 +574,8 @@ Display display = getDisplay (); //To display popup calendar, we need to know where the parent is relative to the whole screen. - Rectangle coordsRelativeToScreen = display.map (getParent (), null, getBounds ()); - Rectangle displayRect = getMonitor ().getClientArea (); + Rectangle coordsRelativeToScreen = display.mapInPixels (getParent (), null, getBoundsInPixels ()); + Rectangle displayRect = DPIUtil.autoScaleUp(getMonitor ().getClientArea ()); showPopupShell (containerBounds, calendarSize, coordsRelativeToScreen, displayRect); @@ -573,7 +589,7 @@ int y = calculateCalendarYpos (containerBounds, coordsRelativeToScreen, height, displayRect); int x = calculateCalendarXpos (calendarSize, coordsRelativeToScreen, displayRect, width); - popupShell.setBounds (x, y, width, height); + popupShell.setBoundsInPixels (x, y, width, height); popupShell.setVisible (true); if (isFocusControl ()) { popupCalendar.setFocus (); @@ -1311,6 +1327,7 @@ } currentField = index; display.syncExec (new Runnable () { + @Override public void run () { if (textEntryHandle != 0) { String value = getText (getText (),start, end - 1); @@ -1361,7 +1378,12 @@ if (isCalendar () && !OS.GTK3) { OS.gtk_widget_modify_base (containerHandle, 0, color); } else { - super.setBackgroundColor (color); + if (isCalendar() && (OS.GTK_VERSION >= OS.VERSION(3, 16, 0))) { + super.setBackgroundColor (calendarHandle, color); + } else { + super.setBackgroundColor (color); + } + } } @@ -1382,7 +1404,15 @@ @Override void setForegroundColor (GdkColor color) { - setForegroundColor (containerHandle, color, false); + if (OS.GTK_VERSION >= OS.VERSION (3, 16, 0)) { + GdkRGBA rgba = null; + if (color != null) { + rgba = display.toGdkRGBA (color); + } + setForegroundColor (containerHandle, rgba); + } else { + setForegroundColor (containerHandle, color, false); + } } @Override @@ -1671,7 +1701,7 @@ } @Override -public void setBounds (int x, int y, int width, int height) { +void setBoundsInPixels (int x, int y, int width, int height) { //Date with Drop down is in container. Needs extra handling. if (isDateWithDropDownButton () && OS.GTK3) { @@ -1679,7 +1709,7 @@ OS.gtk_widget_get_preferred_size (textEntryHandle, null, requisition); int oldHeight = requisition.height; //Entry should not expand vertically. It is single liner. - int newWidth = width - (down.getSize ().x + getGtkBorderPadding ().right); + int newWidth = width - (down.getSizeInPixels ().x + getGtkBorderPadding ().right); OS.gtk_widget_set_size_request (textEntryHandle, (newWidth >= 0) ? newWidth : 0, oldHeight); } @@ -1698,12 +1728,12 @@ */ int fixedGtkVersion = OS.VERSION (3, 14, 2); if (isCalendar () && OS.GTK3 && (OS.GTK_VERSION < fixedGtkVersion)) { - int calendarPrefferedVerticalSize = computeSize (SWT.DEFAULT, SWT.DEFAULT, true).y; + int calendarPrefferedVerticalSize = computeSizeInPixels (SWT.DEFAULT, SWT.DEFAULT, true).y; if (height > calendarPrefferedVerticalSize) { height = calendarPrefferedVerticalSize; } } - super.setBounds (x, y, width, height); + super.setBoundsInPixels (x, y, width, height); } @@ -1711,10 +1741,10 @@ * Usually called when control is resized or first initialized. */ private void setDropDownButtonSize () { - Rectangle rect = getClientArea (); + Rectangle rect = getClientAreaInPixels (); int parentWidth = rect.width; int parentHeight = rect.height; - Point buttonSize = down.computeSize (SWT.DEFAULT, parentHeight); + Point buttonSize = down.computeSizeInPixels (SWT.DEFAULT, parentHeight); //TAG_GTK3__NO_VERTICAL_FILL_ADJUSTMENT int dateEntryHeight = computeNativeSize (textEntryHandle, SWT.DEFAULT, SWT.DEFAULT, false).y; @@ -1724,7 +1754,7 @@ int newXpos = parentWidth - buttonSize.x; int newYPos = parentHeight/2 - dateEntryHeight/2; - down.setBounds (newXpos, newYPos, buttonSize.x, newHeight); + down.setBoundsInPixels (newXpos, newYPos, buttonSize.x, newHeight); } /** @@ -1738,7 +1768,11 @@ //In Gtk3, acquire border. GtkBorder gtkBorderPadding = new GtkBorder (); int /*long*/ context = OS.gtk_widget_get_style_context (textEntryHandle); - OS.gtk_style_context_get_padding (context, OS.GTK_STATE_FLAG_NORMAL, gtkBorderPadding); + if (OS.GTK_VERSION < OS.VERSION(3, 18 , 0)) { + OS.gtk_style_context_get_padding (context, OS.GTK_STATE_FLAG_NORMAL, gtkBorderPadding); + } else { + OS.gtk_style_context_get_padding (context, OS.gtk_widget_get_state_flags(textEntryHandle), gtkBorderPadding); + } return gtkBorderPadding; } else { //in GTK2 hard code the padding diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Decorations.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Decorations.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Decorations.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Decorations.java 2016-07-06 19:11:33.000000000 +0000 @@ -140,6 +140,7 @@ * @see SWT#RESIZE * @see SWT#TITLE * @see SWT#NO_TRIM + * @see SWT#NO_MOVE * @see SWT#SHELL_TRIM * @see SWT#DIALOG_TRIM * @see SWT#ON_TOP @@ -154,6 +155,8 @@ static int checkStyle (int style) { if ((style & SWT.NO_TRIM) != 0) { style &= ~(SWT.CLOSE | SWT.TITLE | SWT.MIN | SWT.MAX | SWT.RESIZE | SWT.BORDER); + } else if ((style & SWT.NO_MOVE) != 0) { + style |= SWT.TITLE; } if ((style & (SWT.MENU | SWT.MIN | SWT.MAX | SWT.CLOSE)) != 0) { style |= SWT.TITLE; @@ -520,16 +523,6 @@ if (savedFocus != null && savedFocus.isDisposed ()) savedFocus = null; boolean restored = savedFocus != null && savedFocus.setFocus (); savedFocus = null; - /* - * This code is intentionally commented. When no widget - * has been given focus, some platforms give focus to the - * default button. - */ -// if (restored) return true; -// if (defaultButton != null && !defaultButton.isDisposed ()) { -// if (defaultButton.setFocus ()) return true; -// } -// return false; return restored; } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Dialog.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Dialog.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Dialog.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Dialog.java 2016-07-06 19:11:33.000000000 +0000 @@ -27,7 +27,7 @@ * <pre><code> * public class MyDialog extends Dialog { * Object result; - * + * * public MyDialog (Shell parent, int style) { * super (parent, style); * } @@ -54,7 +54,7 @@ * by every subclass on every platform. If a modality style is * not supported, it is "upgraded" to a more restrictive modality * style that is supported. For example, if <code>PRIMARY_MODAL</code> - * is not supported by a particular dialog, it would be upgraded to + * is not supported by a particular dialog, it would be upgraded to * <code>APPLICATION_MODAL</code>. In addition, as is the case * for shells, the window manager for the desktop on which the * instance is visible has ultimate control over the appearance @@ -69,7 +69,7 @@ * Note: Only one of the styles APPLICATION_MODAL, PRIMARY_MODAL, * and SYSTEM_MODAL may be specified. * </p> - * + * * @see Shell * @see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: ControlExample</a> * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> @@ -103,7 +103,7 @@ * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -118,7 +118,7 @@ * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li> * </ul> - * + * * @see SWT#PRIMARY_MODAL * @see SWT#APPLICATION_MODAL * @see SWT#SYSTEM_MODAL @@ -218,7 +218,7 @@ * <p> * Note that, the value which is returned by this method <em>may * not match</em> the value which was provided to the constructor - * when the receiver was created. + * when the receiver was created. * </p> * * @return the style bits @@ -235,7 +235,7 @@ /** * Returns the receiver's text, which is the string that the * window manager will typically display as the receiver's - * <em>title</em>. If the text has not previously been set, + * <em>title</em>. If the text has not previously been set, * returns an empty string. * * @return the text @@ -252,7 +252,7 @@ /** * Sets the receiver's text, which is the string that the * window manager will typically display as the receiver's - * <em>title</em>, to the argument, which must not be null. + * <em>title</em>, to the argument, which must not be null. * * @param string the new text * diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/DirectoryDialog.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/DirectoryDialog.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/DirectoryDialog.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/DirectoryDialog.java 2016-07-06 19:11:33.000000000 +0000 @@ -124,9 +124,17 @@ Display display = parent != null ? parent.getDisplay (): Display.getCurrent (); int /*long*/ handle = 0; if (display.getDismissalAlignment() == SWT.RIGHT) { - handle = OS.gtk_file_chooser_dialog_new (titleBytes, shellHandle, OS.GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, OS.GTK_STOCK_CANCEL (), OS.GTK_RESPONSE_CANCEL, OS.GTK_STOCK_OK (), OS.GTK_RESPONSE_OK, 0); + if (OS.GTK3) { + handle = OS.gtk_file_chooser_dialog_new (titleBytes, shellHandle, OS.GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, OS.GTK_NAMED_LABEL_CANCEL, OS.GTK_RESPONSE_CANCEL, OS.GTK_NAMED_LABEL_OK, OS.GTK_RESPONSE_OK, 0); + } else { + handle = OS.gtk_file_chooser_dialog_new (titleBytes, shellHandle, OS.GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, OS.GTK_STOCK_CANCEL (), OS.GTK_RESPONSE_CANCEL, OS.GTK_STOCK_OK (), OS.GTK_RESPONSE_OK, 0); + } } else { - handle = OS.gtk_file_chooser_dialog_new (titleBytes, shellHandle, OS.GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, OS.GTK_STOCK_OK (), OS.GTK_RESPONSE_OK, OS.GTK_STOCK_CANCEL (), OS.GTK_RESPONSE_CANCEL, 0); + if (OS.GTK3) { + handle = OS.gtk_file_chooser_dialog_new (titleBytes, shellHandle, OS.GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, OS.GTK_NAMED_LABEL_OK, OS.GTK_RESPONSE_OK, OS.GTK_NAMED_LABEL_CANCEL, OS.GTK_RESPONSE_CANCEL, 0); + } else { + handle = OS.gtk_file_chooser_dialog_new (titleBytes, shellHandle, OS.GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, OS.GTK_STOCK_OK (), OS.GTK_RESPONSE_OK, OS.GTK_STOCK_CANCEL (), OS.GTK_RESPONSE_CANCEL, 0); + } } if (handle == 0) error (SWT.ERROR_NO_HANDLES); int /*long*/ group = OS.gtk_window_get_group(0); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Display.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Display.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Display.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Display.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -11,6 +11,11 @@ package org.eclipse.swt.widgets; +import java.io.*; +import java.util.*; +import java.util.regex.*; +import java.util.regex.Pattern; + import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; @@ -274,6 +279,13 @@ GdkColor COLOR_TITLE_FOREGROUND, COLOR_TITLE_BACKGROUND, COLOR_TITLE_BACKGROUND_GRADIENT; GdkColor COLOR_TITLE_INACTIVE_FOREGROUND, COLOR_TITLE_INACTIVE_BACKGROUND, COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT; + /* Initialize color list */ + ArrayList<String> colorList; + + /* Placeholder color ints since SWT system colors is missing them */ + final int SWT_COLOR_LIST_SELECTION_TEXT_INACTIVE = 38; + final int SWT_COLOR_LIST_SELECTION_INACTIVE = 39; + /* Popup Menus */ Menu [] popups; @@ -446,11 +458,48 @@ Object [] values; /* Initial Guesses for Shell Trimmings. */ - int borderTrimWidth = 4, borderTrimHeight = 4; - int resizeTrimWidth = 6, resizeTrimHeight = 6; - int titleBorderTrimWidth = 5, titleBorderTrimHeight = 28; - int titleResizeTrimWidth = 6, titleResizeTrimHeight = 29; - int titleTrimWidth = 0, titleTrimHeight = 23; + static final int TRIM_NONE = 0; + static final int TRIM_BORDER = 1; + static final int TRIM_RESIZE = 2; + static final int TRIM_TITLE_BORDER = 3; + static final int TRIM_TITLE_RESIZE = 4; + static final int TRIM_TITLE = 5; + int [] trimWidths = new int [6]; + int [] trimHeights = new int [6]; + { + trimWidths [TRIM_NONE] = 0; trimHeights [TRIM_NONE] = 0; + trimWidths [TRIM_BORDER] = 4; trimHeights [TRIM_BORDER] = 4; + trimWidths [TRIM_RESIZE] = 6; trimHeights [TRIM_RESIZE] = 6; + trimWidths [TRIM_TITLE_BORDER] = 5; trimHeights [TRIM_TITLE_BORDER] = 28; + trimWidths [TRIM_TITLE_RESIZE] = 6; trimHeights [TRIM_TITLE_RESIZE] = 29; + trimWidths [TRIM_TITLE] = 0; trimHeights [TRIM_TITLE] = 23; + + String path = System.getProperty ("user.home"); //$NON-NLS-1$ + if (path != null) { + File file = new File (path, ".swt/trims.prefs"); + if (file.exists () && file.isFile ()) { + Properties props = new Properties (); + try (FileInputStream fis = new FileInputStream (file)) { + props.load (fis); + String trimWidthsString = props.getProperty ("trimWidths"); + String trimHeightsString = props.getProperty ("trimHeights"); + if (trimWidthsString != null && trimHeightsString != null) { + StringTokenizer tok = new StringTokenizer (trimWidthsString); + for (int i = 0; i < trimWidths.length && tok.hasMoreTokens (); i++) { + trimWidths [i] = Integer.parseInt (tok.nextToken ()); + } + tok = new StringTokenizer (trimHeightsString); + for (int i = 0; i < trimHeights.length && tok.hasMoreTokens (); i++) { + trimHeights [i] = Integer.parseInt (tok.nextToken ()); + } + } + } catch (IOException | NumberFormatException e) { + // use default values + } + } + } + } + boolean ignoreTrim; /* Window Manager */ @@ -463,6 +512,7 @@ */ static { DeviceFinder = new Runnable () { + @Override public void run () { Device device = getCurrent (); if (device == null) { @@ -1415,6 +1465,11 @@ @Override public Rectangle getBounds () { checkDevice (); + return DPIUtil.autoScaleDown (getBoundsInPixels ()); +} + +Rectangle getBoundsInPixels () { + checkDevice (); return new Rectangle (0, 0, OS.gdk_screen_width (), OS.gdk_screen_height ()); } @@ -1578,6 +1633,10 @@ * </ul> */ public Point getCursorLocation () { + return DPIUtil.autoScaleDown(getCursorLocationInPixels()); +} + +Point getCursorLocationInPixels () { checkDevice (); int [] x = new int [1], y = new int [1]; gdk_window_get_device_position (0, x, y, null); @@ -1692,6 +1751,413 @@ return toggle_renderer_type; } +String gtk_css_create_css_color_string (String background, String foreground, int property) { + switch (property) { + case SWT.FOREGROUND: + if (foreground != null && background != null) { + return foreground + "\n" + background; + } else if (foreground != null) { + return foreground; + } else { + return ""; + } + case SWT.BACKGROUND: + if (foreground != null && background != null) { + return background + "\n" + foreground; + } else if (background != null) { + return background; + } else { + return ""; + } + default: + return ""; + } +} + +String gtk_css_default_theme_values (int swt) { + /* + * This method fetches GTK theme values/properties. This is accomplished + * by determining the name of the current system theme loaded, giving that + * name to GTK, and then parsing values from the returned theme contents. + * + * The idea here is that SWT variables that have corresponding GTK theme + * elements can be fetched easily by supplying the SWT variable as an + * parameter to this method. + */ + + // Find CSS theme name + byte [] buffer; + int length; + int /*long*/ settings = OS.gtk_settings_get_default (); + int /*long*/ [] ptr = new int /*long*/ [1]; + int /*long*/ str; + OS.g_object_get (settings, OS.gtk_theme_name, ptr, 0); + if (ptr [0] == 0) { + return ""; + } + length = OS.strlen (ptr [0]); + if (length == 0) { + return ""; + } + buffer = new byte [length]; + OS.memmove (buffer, ptr [0], length); + OS.g_free (ptr [0]); + + // Fetch the actual theme in char/string format + int /*long*/ themeProvider = OS.gtk_css_provider_get_named(buffer, null); + str = OS.gtk_css_provider_to_string (themeProvider); + length = OS.strlen (str); + if (length == 0) { + return ""; + } + buffer = new byte [length]; + OS.memmove (buffer, str, length); + String cssOutput = new String (Converter.mbcsToWcs (null, buffer)); + + // Parse the theme values based on the corresponding SWT value + // i.e. theme_selected_bg_color in GTK is SWT.COLOR_LIST_SELECTION in SWT + int tSelected; + int selected; + /* + * These strings are the GTK named colors we are looking for. Once they are + * found they are sent to a parser which finds the actual values. + */ + String color = ""; + switch (swt) { + case SWT.COLOR_INFO_FOREGROUND: + if (OS.GTK_VERSION >= OS.VERSION(3, 20, 0)) { + tSelected = cssOutput.indexOf ("tooltip * {"); + } else { + tSelected = cssOutput.indexOf (".tooltip {"); + } + selected = cssOutput.indexOf ("@define-color tooltip_fg_color"); + if (tSelected != -1) { + if (OS.GTK_VERSION >= OS.VERSION(3, 20, 0)) { + COLOR_INFO_FOREGROUND = gtk_css_parse_foreground(themeProvider, "tooltip * {"); + } else { + COLOR_INFO_FOREGROUND = gtk_css_parse_foreground(themeProvider, ".tooltip {"); + } + return "parsed"; + } else if (selected != -1) { + color = simple_color_parser(cssOutput, "@define-color tooltip_fg_color", selected); + if (!color.isEmpty()) { + break; + } + } + break; + case SWT.COLOR_INFO_BACKGROUND: + tSelected = cssOutput.indexOf ("tooltip.background {"); + selected = cssOutput.indexOf ("@define-color tooltip_bg_color"); + if (tSelected != -1) { + COLOR_INFO_BACKGROUND = gtk_css_parse_background(themeProvider, "tooltip.background {"); + return "parsed"; + } else if (selected != -1) { + color = simple_color_parser(cssOutput, "@define-color tooltip_bg_color", selected); + if (!color.isEmpty()) { + break; + } + } + break; + case SWT.COLOR_LIST_BACKGROUND: + tSelected = cssOutput.indexOf ("@define-color theme_base_color"); + selected = cssOutput.indexOf ("@define-color base_color"); + if (tSelected != -1) { + color = simple_color_parser(cssOutput, "@define-color theme_base_color", tSelected); + if (!color.isEmpty()) { + break; + } + } else if (selected != -1) { + color = simple_color_parser(cssOutput, "@define-color base_color", selected); + if (!color.isEmpty()) { + break; + } + } + break; + case SWT.COLOR_LIST_FOREGROUND: + tSelected = cssOutput.indexOf ("@define-color theme_text_color"); + selected = cssOutput.indexOf ("@define-color text_color"); + if (tSelected != -1) { + color = simple_color_parser(cssOutput, "@define-color theme_text_color", tSelected); + if (!color.isEmpty()) { + break; + } + } else if (selected != -1) { + color = simple_color_parser(cssOutput, "@define-color text_color", selected); + if (!color.isEmpty()) { + break; + } + } + break; + case SWT.COLOR_LIST_SELECTION: + tSelected = cssOutput.indexOf ("@define-color theme_selected_bg_color"); + selected = cssOutput.indexOf ("@define-color selected_bg_color"); + if (tSelected != -1) { + color = simple_color_parser(cssOutput, "@define-color theme_selected_bg_color", tSelected); + if (!color.isEmpty()) { + break; + } + } else if (selected != -1) { + color = simple_color_parser(cssOutput, "@define-color selected_bg_color", selected); + if (!color.isEmpty()) { + break; + } + } + break; + case SWT_COLOR_LIST_SELECTION_INACTIVE: + tSelected = cssOutput.indexOf ("@define-color theme_unfocused_selected_bg_color"); + if (tSelected != -1) { + color = simple_color_parser(cssOutput, "@define-color theme_unfocused_selected_bg_color", tSelected); + if (!color.isEmpty()) { + break; + } + } + break; + case SWT.COLOR_LIST_SELECTION_TEXT: + tSelected = cssOutput.indexOf ("@define-color theme_selected_fg_color"); + selected = cssOutput.indexOf ("@define-color selected_fg_color"); + if (tSelected != -1) { + color = simple_color_parser(cssOutput, "@define-color theme_selected_fg_color", tSelected); + if (!color.isEmpty()) { + break; + } + } else if (selected != -1) { + color = simple_color_parser(cssOutput, "@define-color selected_fg_color", selected); + if (!color.isEmpty()) { + break; + } + } + break; + case SWT_COLOR_LIST_SELECTION_TEXT_INACTIVE: + tSelected = cssOutput.indexOf ("@define-color theme_unfocused_selected_fg_color"); + if (tSelected != -1) { + color = simple_color_parser(cssOutput, "@define-color theme_unfocused_selected_fg_color", tSelected); + if (!color.isEmpty()) { + break; + } + } + break; + case SWT.COLOR_TITLE_INACTIVE_FOREGROUND: + tSelected = cssOutput.indexOf ("@define-color insensitive_fg_color"); + if (tSelected != -1) { + color = simple_color_parser(cssOutput, "@define-color insensitive_fg_color", tSelected); + if (!color.isEmpty()) { + break; + } + } + break; + case SWT.COLOR_TITLE_INACTIVE_BACKGROUND: + tSelected = cssOutput.indexOf ("@define-color insensitive_bg_color"); + if (tSelected != -1) { + color = simple_color_parser(cssOutput, "@define-color insensitive_bg_color", tSelected); + if (!color.isEmpty()) { + break; + } + } + break; + case SWT.COLOR_WIDGET_BACKGROUND: + tSelected = cssOutput.indexOf ("@define-color theme_bg_color"); + selected = cssOutput.indexOf ("@define-color bg_color"); + if (tSelected != -1) { + color = simple_color_parser(cssOutput, "@define-color theme_bg_color", tSelected); + if (!color.isEmpty()) { + break; + } + } else if (selected != -1) { + color = simple_color_parser(cssOutput, "@define-color bg_color", selected); + if (!color.isEmpty()) { + break; + } + } + break; + case SWT.COLOR_WIDGET_FOREGROUND: + tSelected = cssOutput.indexOf ("@define-color theme_fg_color"); + selected = cssOutput.indexOf ("@define-color fg_color"); + if (tSelected != -1) { + color = simple_color_parser(cssOutput, "@define-color theme_fg_color", tSelected); + if (!color.isEmpty()) { + break; + } + } else if (selected != -1) { + color = simple_color_parser(cssOutput, "@define-color fg_color", selected); + if (!color.isEmpty()) { + break; + } + } + break; + default: + return ""; + } + return color; +} + +GdkColor gtk_css_parse_background (int /*long*/ provider, String precise) { + String shortOutput; + int startIndex; + GdkRGBA rgba = new GdkRGBA (); + // Fetch the CSS in char/string format from the GtkCssProvider. + int /*long*/ str = OS.gtk_css_provider_to_string (provider); + if (str == 0) return COLOR_WIDGET_BACKGROUND; + int length = OS.strlen (str); + byte [] buffer = new byte [length]; + OS.memmove (buffer, str, length); + String cssOutput = new String (Converter.mbcsToWcs (null, buffer)); + String searched = ""; + /* + * This section allows for finer searching: for example + * specifying precise as null will cause the whole GtkCssProvider + * to be searched and return the first background color value. + * + * Specifying a string for precise causes only the subset of the + * GtkCssProvider to be searched, provided that precise is a subset + * of the provider. + */ + if (precise != null) { + if (cssOutput.contains(precise)) { + searched = cssOutput.substring(cssOutput.indexOf(precise)); + } + } else { + searched = cssOutput; + } + if (searched.isEmpty()) { + return COLOR_WIDGET_BACKGROUND; + } + + /* Although we only set the property "background-color", we can handle + * the "background" property as well. We check for either of these cases + * and extract a GdkRGBA object from the parsed CSS string. + */ + if (searched.contains ("background-color:")) { + startIndex = searched.indexOf ("background-color:"); + shortOutput = searched.substring (startIndex + 18); + rgba = gtk_css_property_to_rgba (shortOutput); + } else if (searched.contains ("background:")) { + startIndex = searched.indexOf ("background:"); + shortOutput = searched.substring (startIndex + 13); + rgba = gtk_css_property_to_rgba (shortOutput); + } + return toGdkColor (rgba); +} + +GdkColor gtk_css_parse_foreground (int /*long*/ provider, String precise) { + if (provider == 0) return COLOR_WIDGET_FOREGROUND; + String shortOutput; + int startIndex; + GdkRGBA rgba = new GdkRGBA (); + // Fetch the CSS in char/string format from the provider. + int /*long*/ str = OS.gtk_css_provider_to_string(provider); + if (str == 0) return COLOR_WIDGET_FOREGROUND; + int length = OS.strlen (str); + byte [] buffer = new byte [length]; + OS.memmove (buffer, str, length); + String cssOutput = new String (Converter.mbcsToWcs (null, buffer)); + String searched = ""; + /* + * This section allows for finer searching: for example + * specifying precise as null will cause the whole GtkCssProvider + * to be searched and return the first foreground color value. + * + * Specifying a string for precise causes only the subset of the + * GtkCssProvider to be searched, provided that precise is a subset + * of the provider. + */ + if (precise != null) { + if (cssOutput.contains(precise)) { + searched = cssOutput.substring(cssOutput.indexOf(precise)); + } + } else { + searched = cssOutput; + } + if (searched.isEmpty()) { + return COLOR_WIDGET_FOREGROUND; + } + /* + * Because background-color and color have overlapping characters, + * a simple String.contains() check will not suffice. This means + * that a more encompassing regex is needed to capture "pure" color + * properties and filter out things like background-color, border-color, + * etc. + */ + String pattern = "[^-]color: rgb[a]?\\([0-9]+,[\\s]?[0-9]+,[\\s]?[0-9]+[,[\\s]*[0-9]+]?\\)"; + Pattern r = Pattern.compile(pattern); + Matcher m = r.matcher(searched); + if (m.find()) { + String match = m.group(0); + if (match.contains("color:")) { + startIndex = match.indexOf("color:"); + shortOutput = match.substring(startIndex + 7); + rgba = gtk_css_property_to_rgba(shortOutput); + } + } else { + return COLOR_WIDGET_FOREGROUND; + } + return toGdkColor (rgba); +} + +GdkRGBA gtk_css_property_to_rgba(String property) { + /* Here we convert rgb(...) or rgba(...) properties + * into GdkRGBA objects using gdk_rgba_parse(). Note + * that we still need to remove the ";" character from the + * input string. + */ + GdkRGBA rgba = new GdkRGBA (); + String [] propertyParsed = new String [1]; + propertyParsed = property.split (";"); + OS.gdk_rgba_parse (rgba, Converter.wcsToMbcs (null, propertyParsed[0], true)); + return rgba; +} + +String gtk_rgba_to_css_string (GdkRGBA rgba) { + /* + * In GdkRGBA, values are a double between 0-1. + * In CSS, values are integers between 0-255 for r, g, and b. + * Alpha is still a double between 0-1. + * The final CSS format is: rgba(int, int, int, double) + * Due to this, there is a slight loss of precision. + * Setting/getting with CSS *might* yield slight differences. + */ + GdkRGBA toConvert; + if (rgba != null) { + toConvert = rgba; + } else { + // If we have a null RGBA, set it to the default COLOR_WIDGET_BACKGROUND. + GdkColor defaultGdkColor = getSystemColor(SWT.COLOR_WIDGET_BACKGROUND).handle; + toConvert = toGdkRGBA (defaultGdkColor); + } + int /*long*/ str = OS.gdk_rgba_to_string (toConvert); + int length = OS.strlen (str); + byte [] buffer = new byte [length]; + OS.memmove (buffer, str, length); + return new String (Converter.mbcsToWcs (null, buffer)); +} + +String gtk_widget_get_name(int /*long*/ handle) { + int /*long*/ str = OS.gtk_widget_get_name (handle); + String name; + if (str == 0) { + name = "*"; + } else { + int length = OS.strlen (str); + byte [] buffer = new byte [length]; + OS.memmove (buffer, str, length); + name = new String (Converter.mbcsToWcs (null, buffer)); + } + return name; +} + +String gtk_widget_class_get_css_name(int /*long*/ handle) { + int /*long*/ str = OS.gtk_widget_class_get_css_name (OS.GTK_WIDGET_GET_CLASS(handle)); + String name; + if (str == 0) { + name = "*"; + } else { + int length = OS.strlen (str); + byte [] buffer = new byte [length]; + OS.memmove (buffer, str, length); + name = new String (Converter.mbcsToWcs (null, buffer)); + } + return name; +} + /** * Returns the default display. One is created (making the * thread that invokes this method its user-interface thread) @@ -1931,7 +2397,7 @@ public Monitor [] getMonitors () { checkDevice (); Monitor [] monitors = null; - Rectangle workArea = getWorkArea (); + Rectangle workArea = DPIUtil.autoScaleDown (getWorkArea ()); int /*long*/ screen = OS.gdk_screen_get_default (); if (screen != 0) { int monitorCount = OS.gdk_screen_get_n_monitors (screen); @@ -1942,19 +2408,19 @@ OS.gdk_screen_get_monitor_geometry (screen, i, dest); Monitor monitor = new Monitor (); monitor.handle = i; - monitor.x = dest.x; - monitor.y = dest.y; - monitor.width = dest.width; - monitor.height = dest.height; + monitor.x = DPIUtil.autoScaleDown (dest.x); + monitor.y = DPIUtil.autoScaleDown (dest.y); + monitor.width = DPIUtil.autoScaleDown (dest.width); + monitor.height = DPIUtil.autoScaleDown (dest.height); if (OS.GTK_VERSION >= OS.VERSION (3, 4, 0)) { // workarea was defined in GTK 3.4. If present, it will return the best results // since it takes into account per-monitor trim OS.gdk_screen_get_monitor_workarea (screen, i, dest); - monitor.clientX = dest.x; - monitor.clientY = dest.y; - monitor.clientWidth = dest.width; - monitor.clientHeight = dest.height; + monitor.clientX = DPIUtil.autoScaleDown (dest.x); + monitor.clientY = DPIUtil.autoScaleDown (dest.y); + monitor.clientWidth = DPIUtil.autoScaleDown (dest.width); + monitor.clientHeight = DPIUtil.autoScaleDown (dest.height); } else { // If we're on an older version of gtk without the workarea function, see if we can use // the getWorkArea function. In the case of multi-monitors, this will return something that @@ -2288,6 +2754,15 @@ return null; } +GdkRGBA toGdkRGBA (GdkColor color) { + GdkRGBA rgba = new GdkRGBA (); + rgba.alpha = 1.0; + rgba.red = (color.red & 0xFFFF) / (float)0xFFFF; + rgba.green = (color.green & 0xFFFF) / (float)0xFFFF; + rgba.blue = (color.blue & 0xFFFF) / (float)0xFFFF; + return rgba; +} + GdkColor toGdkColor (GdkRGBA rgba) { GdkColor gdkColor = new GdkColor(); gdkColor.red = (short)(rgba.red * 0xFFFF); @@ -2369,55 +2844,201 @@ COLOR_LINK_FOREGROUND = gdkColor; if (OS.GTK3) { + /* + * Feature in GTK: previously SWT fetched system colors using + * GtkStyleContext machinery. This machinery is largely deprecated + * and will all together stop functioning eventually. Instead, we + * can parse the GTK system theme and use the values stored there to + * generate SWT's system colors. + * + * The functionality works for GTK3.14 and above as follows: + * + * 1) load and parse the system theme + * 2) check to see if the value needed exists in the theme + * 3a) if the value exists, parse it and convert it to a GdkColor object + * 3b) if the value doesn't exist, use the old GtkStyleContext machinery + * to fetch and return it as a GdkColor object + * + * Some colors have multiple different theme values that correspond to + * them, while some colors only have one potential match. Therefore + * some colors will have better theme coverage than others. + */ int /*long*/ context = OS.gtk_widget_get_style_context (tooltipShellHandle); OS.gtk_style_context_add_class (context, OS.GTK_STYLE_CLASS_TOOLTIP); OS.gtk_style_context_invalidate(context); GdkRGBA rgba = new GdkRGBA(); - OS.gtk_style_context_get_color (context, OS.GTK_STATE_FLAG_NORMAL, rgba); - COLOR_INFO_FOREGROUND = toGdkColor (rgba); - getBackgroundColor (context, OS.GTK_STATE_FLAG_NORMAL, rgba); - COLOR_INFO_BACKGROUND = toGdkColor (rgba); + + // Initialize and create a list of X11 named colors + initializeColorList(); + + if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) { + String colorInfoForeground = gtk_css_default_theme_values(SWT.COLOR_INFO_FOREGROUND); + if (!colorInfoForeground.isEmpty()) { + if (colorInfoForeground != "parsed") { + rgba = gtk_css_property_to_rgba (colorInfoForeground); + COLOR_INFO_FOREGROUND = toGdkColor (rgba); + } + } else { + styleContextGetColor (context, OS.GTK_STATE_FLAG_NORMAL, rgba); + COLOR_INFO_FOREGROUND = toGdkColor (rgba); + } + } else { + styleContextGetColor (context, OS.GTK_STATE_FLAG_NORMAL, rgba); + COLOR_INFO_FOREGROUND = toGdkColor (rgba); + } + + if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) { + String colorInfoBackground = gtk_css_default_theme_values(SWT.COLOR_INFO_BACKGROUND); + if (!colorInfoBackground.isEmpty()) { + if (colorInfoBackground != "parsed") { + rgba = gtk_css_property_to_rgba (colorInfoBackground); + COLOR_INFO_BACKGROUND = toGdkColor (rgba); + } + } else { + getBackgroundColor (context, OS.GTK_STATE_FLAG_NORMAL, rgba); + COLOR_INFO_BACKGROUND = toGdkColor (rgba); + } + } else { + getBackgroundColor (context, OS.GTK_STATE_FLAG_NORMAL, rgba); + COLOR_INFO_BACKGROUND = toGdkColor (rgba); + } OS.gtk_widget_destroy (tooltipShellHandle); context = OS.gtk_widget_get_style_context (shellHandle); COLOR_WIDGET_DARK_SHADOW = toGdkColor (new GdkRGBA()); - OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_NORMAL, rgba); - COLOR_WIDGET_LIGHT_SHADOW = toGdkColor (rgba); - COLOR_WIDGET_NORMAL_SHADOW = toGdkColor (rgba, 0.7); - COLOR_WIDGET_HIGHLIGHT_SHADOW = toGdkColor (rgba, 1.3); - OS.gtk_style_context_get_color (context, OS.GTK_STATE_FLAG_NORMAL, rgba); + if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) { + String colorWidgetForeground = gtk_css_default_theme_values(SWT.COLOR_WIDGET_FOREGROUND); + if (!colorWidgetForeground.isEmpty()) { + rgba = gtk_css_property_to_rgba (colorWidgetForeground); + } else { + styleContextGetColor (context, OS.GTK_STATE_FLAG_NORMAL, rgba); + } + } else { + styleContextGetColor (context, OS.GTK_STATE_FLAG_NORMAL, rgba); + } COLOR_WIDGET_FOREGROUND = toGdkColor (rgba); - OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_NORMAL, rgba); + + if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) { + String colorWidgetBackground = gtk_css_default_theme_values(SWT.COLOR_WIDGET_BACKGROUND); + if (!colorWidgetBackground.isEmpty()) { + rgba = gtk_css_property_to_rgba (colorWidgetBackground); + } else { + OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_NORMAL, rgba); + } + } else { + OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_NORMAL, rgba); + } COLOR_WIDGET_BACKGROUND = toGdkColor (rgba); + COLOR_WIDGET_LIGHT_SHADOW = COLOR_WIDGET_BACKGROUND; + COLOR_WIDGET_NORMAL_SHADOW = toGdkColor (rgba, 0.7); + COLOR_WIDGET_HIGHLIGHT_SHADOW = toGdkColor (rgba, 1.3); OS.gtk_style_context_save (context); OS.gtk_style_context_add_class(context, OS.GTK_STYLE_CLASS_VIEW); OS.gtk_style_context_add_class(context, OS.GTK_STYLE_CLASS_CELL); OS.gtk_style_context_invalidate(context); - OS.gtk_style_context_get_color (context, OS.GTK_STATE_FLAG_NORMAL, rgba); + + if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) { + String colorListForeground = gtk_css_default_theme_values(SWT.COLOR_LIST_FOREGROUND); + if (!colorListForeground.isEmpty()) { + rgba = gtk_css_property_to_rgba (colorListForeground); + } else { + styleContextGetColor (context, OS.GTK_STATE_FLAG_NORMAL, rgba); + } + } else { + styleContextGetColor (context, OS.GTK_STATE_FLAG_NORMAL, rgba); + } COLOR_LIST_FOREGROUND = toGdkColor (rgba); - OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_NORMAL, rgba); + + if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) { + String colorListBackground = gtk_css_default_theme_values(SWT.COLOR_LIST_BACKGROUND); + if (!colorListBackground.isEmpty()) { + rgba = gtk_css_property_to_rgba (colorListBackground); + } else { + OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_NORMAL, rgba); + } + } else { + OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_NORMAL, rgba); + } COLOR_LIST_BACKGROUND = toGdkColor (rgba); + OS.gtk_style_context_restore (context); - OS.gtk_style_context_get_color (context, OS.GTK_STATE_FLAG_SELECTED, rgba); - COLOR_LIST_SELECTION_TEXT = toGdkColor (rgba); - OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_SELECTED, rgba); - COLOR_LIST_SELECTION = toGdkColor (rgba); - OS.gtk_style_context_get_color (context, OS.GTK_STATE_FLAG_ACTIVE, rgba); - COLOR_LIST_SELECTION_TEXT_INACTIVE = toGdkColor (rgba); - OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_ACTIVE, rgba); - COLOR_LIST_SELECTION_INACTIVE = toGdkColor (rgba); + if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) { + String colorListSelectionText = gtk_css_default_theme_values(SWT.COLOR_LIST_SELECTION_TEXT); + if (!colorListSelectionText.isEmpty()) { + rgba = gtk_css_property_to_rgba (colorListSelectionText); + } else { + styleContextGetColor (context, OS.GTK_STATE_FLAG_SELECTED, rgba); + } + } else { + styleContextGetColor (context, OS.GTK_STATE_FLAG_SELECTED, rgba); + } + COLOR_LIST_SELECTION_TEXT = toGdkColor (rgba); COLOR_TITLE_FOREGROUND = COLOR_LIST_SELECTION_TEXT; + + if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) { + String colorListSelection = gtk_css_default_theme_values(SWT.COLOR_LIST_SELECTION); + if (!colorListSelection.isEmpty()) { + rgba = gtk_css_property_to_rgba (colorListSelection); + } else { + OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_SELECTED, rgba); + } + } else { + OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_SELECTED, rgba); + } + COLOR_LIST_SELECTION = toGdkColor (rgba); COLOR_TITLE_BACKGROUND = COLOR_LIST_SELECTION; - OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_SELECTED, rgba); COLOR_TITLE_BACKGROUND_GRADIENT = toGdkColor (rgba, 1.3); - OS.gtk_style_context_get_color (context, OS.GTK_STATE_FLAG_INSENSITIVE, rgba); + if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) { + String colorListSelectionTextInactive = gtk_css_default_theme_values(SWT_COLOR_LIST_SELECTION_TEXT_INACTIVE); + if (!colorListSelectionTextInactive.isEmpty()) { + rgba = gtk_css_property_to_rgba (colorListSelectionTextInactive); + } else { + styleContextGetColor (context, OS.GTK_STATE_FLAG_ACTIVE, rgba); + } + } else { + styleContextGetColor (context, OS.GTK_STATE_FLAG_ACTIVE, rgba); + } + COLOR_LIST_SELECTION_TEXT_INACTIVE = toGdkColor (rgba); + + if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) { + String colorListSelectionInactive = gtk_css_default_theme_values(SWT_COLOR_LIST_SELECTION_INACTIVE); + if (!colorListSelectionInactive.isEmpty()) { + rgba = gtk_css_property_to_rgba (colorListSelectionInactive); + } else { + OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_ACTIVE, rgba); + } + } else { + OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_ACTIVE, rgba); + } + COLOR_LIST_SELECTION_INACTIVE = toGdkColor (rgba); + + if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) { + String colorTitleInactiveForeground = gtk_css_default_theme_values(SWT.COLOR_TITLE_INACTIVE_FOREGROUND); + if (!colorTitleInactiveForeground.isEmpty()) { + rgba = gtk_css_property_to_rgba (colorTitleInactiveForeground); + } else { + styleContextGetColor (context, OS.GTK_STATE_FLAG_INSENSITIVE, rgba); + } + } else { + styleContextGetColor (context, OS.GTK_STATE_FLAG_INSENSITIVE, rgba); + } COLOR_TITLE_INACTIVE_FOREGROUND = toGdkColor (rgba); - OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_INSENSITIVE, rgba); + + if (OS.GTK_VERSION >= OS.VERSION(3, 14, 0)) { + String colorTitleInactiveBackground = gtk_css_default_theme_values(SWT.COLOR_TITLE_INACTIVE_BACKGROUND); + if (!colorTitleInactiveBackground.isEmpty()) { + rgba = gtk_css_property_to_rgba (colorTitleInactiveBackground); + } else { + OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_INSENSITIVE, rgba); + } + } else { + OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_INSENSITIVE, rgba); + } COLOR_TITLE_INACTIVE_BACKGROUND = toGdkColor (rgba); COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT = toGdkColor (rgba, 1.3); return; @@ -2497,6 +3118,24 @@ COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT = gdkColor; } +GdkRGBA styleContextGetColor(int /*long*/ context, int flag, GdkRGBA rgba) { + /* + * Feature in GTK: we need to handle calls to gtk_style_context_get_color() + * differently due to changes in GTK3.18+. This solves failing test cases + * which started failing after GTK3.16. See Bug 481122 for more info. + * Reference: https://blogs.gnome.org/mclasen/2015/11/20/a-gtk-update/ + */ + if (OS.GTK_VERSION >= OS.VERSION(3, 18, 0)) { + OS.gtk_style_context_save(context); + OS.gtk_style_context_set_state(context, flag); + OS.gtk_style_context_get_color (context, flag, rgba); + OS.gtk_style_context_restore(context); + } else { + OS.gtk_style_context_get_color (context, flag, rgba); + } + return rgba; +} + /** * Returns the single instance of the system taskBar or null * when there is no system taskBar available for the platform. @@ -2622,6 +3261,7 @@ signalIds [Widget.EVENT] = OS.g_signal_lookup (OS.event, OS.GTK_TYPE_WIDGET ()); signalIds [Widget.EVENT_AFTER] = OS.g_signal_lookup (OS.event_after, OS.GTK_TYPE_WIDGET ()); signalIds [Widget.EXPOSE_EVENT] = OS.g_signal_lookup (OS.GTK3 ? OS.draw : OS.expose_event, OS.GTK_TYPE_WIDGET ()); + signalIds [Widget.EXPOSE_EVENT_INVERSE] = OS.g_signal_lookup (OS.GTK3 ? OS.draw : OS.expose_event, OS.GTK_TYPE_WIDGET ()); signalIds [Widget.FOCUS] = OS.g_signal_lookup (OS.focus, OS.GTK_TYPE_WIDGET ()); signalIds [Widget.FOCUS_IN_EVENT] = OS.g_signal_lookup (OS.focus_in_event, OS.GTK_TYPE_WIDGET ()); signalIds [Widget.FOCUS_OUT_EVENT] = OS.g_signal_lookup (OS.focus_out_event, OS.GTK_TYPE_WIDGET ()); @@ -2819,6 +3459,27 @@ if (idleProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); } +void initializeColorList() { + colorList = new ArrayList<>(); + colorList.add("black"); + colorList.add("darkred"); + colorList.add("darkgreen"); + colorList.add("darkyellow"); + colorList.add("darkblue"); + colorList.add("darkmagenta"); + colorList.add("darkcyan"); + colorList.add("darkgray"); + colorList.add("gray"); + colorList.add("red"); + colorList.add("green"); + colorList.add("yellow"); + colorList.add("blue"); + colorList.add("magenta"); + colorList.add("cyan"); + colorList.add("white"); + +} + void initializeSubclasses () { int /*long*/ pangoLayoutType = OS.PANGO_TYPE_LAYOUT (); int /*long*/ pangoLayoutClass = OS.g_type_class_ref (pangoLayoutType); @@ -3063,6 +3724,27 @@ Point point = new Point (x, y); if (from == to) return point; if (from != null) { + Point origin = DPIUtil.autoScaleDown (from.getWindowOrigin ()); + if ((from.style & SWT.MIRRORED) != 0) point.x = DPIUtil.autoScaleDown (from.getClientWidth ()) - point.x; + point.x += origin.x; + point.y += origin.y; + } + if (to != null) { + Point origin = DPIUtil.autoScaleDown (to.getWindowOrigin ()); + point.x -= origin.x; + point.y -= origin.y; + if ((to.style & SWT.MIRRORED) != 0) point.x = DPIUtil.autoScaleDown (to.getClientWidth ()) - point.x; + } + return point; +} + +Point mapInPixels (Control from, Control to, int x, int y) { + checkDevice (); + if (from != null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); + if (to != null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); + Point point = new Point (x, y); + if (from == to) return point; + if (from != null) { Point origin = from.getWindowOrigin (); if ((from.style & SWT.MIRRORED) != 0) point.x = from.getClientWidth () - point.x; point.x += origin.x; @@ -3119,6 +3801,12 @@ return map (from, to, rectangle.x, rectangle.y, rectangle.width, rectangle.height); } +Rectangle mapInPixels (Control from, Control to, Rectangle rectangle) { + checkDevice(); + if (rectangle == null) error (SWT.ERROR_NULL_ARGUMENT); + return mapInPixels (from, to, rectangle.x, rectangle.y, rectangle.width, rectangle.height); +} + static char mbcsToWcs (char ch) { int key = ch & 0xFFFF; if (key <= 0x7F) return ch; @@ -3188,6 +3876,30 @@ if (from == to) return rect; boolean fromRTL = false, toRTL = false; if (from != null) { + Point origin = DPIUtil.autoScaleDown (from.getWindowOrigin ()); + if (fromRTL = (from.style & SWT.MIRRORED) != 0) rect.x = DPIUtil.autoScaleDown (from.getClientWidth ()) - rect.x; + rect.x += origin.x; + rect.y += origin.y; + } + if (to != null) { + Point origin = DPIUtil.autoScaleDown (to.getWindowOrigin ()); + rect.x -= origin.x; + rect.y -= origin.y; + if (toRTL = (to.style & SWT.MIRRORED) != 0) rect.x = DPIUtil.autoScaleDown (to.getClientWidth ()) - rect.x; + } + + if (fromRTL != toRTL) rect.x -= rect.width; + return rect; +} + +Rectangle mapInPixels (Control from, Control to, int x, int y, int width, int height) { + checkDevice(); + if (from != null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); + if (to != null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); + Rectangle rect = new Rectangle (x, y, width, height); + if (from == to) return rect; + boolean fromRTL = false, toRTL = false; + if (from != null) { Point origin = from.getWindowOrigin (); if (fromRTL = (from.style & SWT.MIRRORED) != 0) rect.x = from.getClientWidth () - rect.x; rect.x += origin.x; @@ -3316,7 +4028,8 @@ case SWT.MouseMove: case SWT.MouseUp: { if (type == SWT.MouseMove) { - OS.XTestFakeMotionEvent (xDisplay, -1, event.x, event.y, 0); + Rectangle loc = DPIUtil.autoScaleUp(event.getBounds ()); + OS.XTestFakeMotionEvent (xDisplay, -1, loc.x, loc.y, 0); } else { int button = event.button; switch (button) { @@ -3674,6 +4387,27 @@ flushRect = null; exposeEvent = null; idleLock = null; + + /* Save window trim caches */ + String userHome = System.getProperty ("user.home"); //$NON-NLS-1$ + if (userHome != null) { + File dir = new File (userHome, ".swt"); + if ((dir.exists () && dir.isDirectory ()) || dir.mkdirs ()) { + File file = new File (dir, "trims.prefs"); + Properties props = new Properties (); + StringBuilder buf = new StringBuilder (); + for (int w : trimWidths) buf.append (w).append (' '); + props.put ("trimWidths", buf.toString ()); + buf = new StringBuilder(); + for (int h : trimHeights) buf.append (h).append (' '); + props.put ("trimHeights", buf.toString ()); + try (FileOutputStream fos = new FileOutputStream (file)){ + props.store (fos, null); + } catch (IOException e) { + // skip saving trim caches + } + } + } } /** @@ -3980,17 +4714,20 @@ * @since 2.1 */ public void setCursorLocation (int x, int y) { - checkDevice (); + setCursorLocation(new Point (x, y)); +} + +void setCursorLocationInPixels (Point location) { if (OS.GTK_VERSION < OS.VERSION(3, 0, 0)) { int /*long*/ xDisplay = OS.gdk_x11_display_get_xdisplay(OS.gdk_display_get_default()); int /*long*/ xWindow = OS.XDefaultRootWindow (xDisplay); - OS.XWarpPointer (xDisplay, OS.None, xWindow, 0, 0, 0, 0, x, y); + OS.XWarpPointer (xDisplay, OS.None, xWindow, 0, 0, 0, 0, location.x, location.y); } else { int /*long*/ gdkDisplay = OS.gdk_display_get_default(); int /*long*/ gdkDeviceManager = OS.gdk_display_get_device_manager(gdkDisplay); int /*long*/ gdkScreen = OS.gdk_screen_get_default(); int /*long*/ gdkPointer = OS.gdk_device_manager_get_client_pointer(gdkDeviceManager); - OS.gdk_device_warp(gdkPointer,gdkScreen,x,y); + OS.gdk_device_warp(gdkPointer, gdkScreen, location.x, location.y); } } @@ -4012,7 +4749,8 @@ public void setCursorLocation (Point point) { checkDevice (); if (point == null) error (SWT.ERROR_NULL_ARGUMENT); - setCursorLocation (point.x, point.y); + point = DPIUtil.autoScaleUp(point); + setCursorLocationInPixels(point); } /** @@ -4210,7 +4948,7 @@ this.synchronizer = synchronizer; } if (oldSynchronizer != null) { - oldSynchronizer.runAsyncMessages(true); + oldSynchronizer.moveAllEventsTo(synchronizer); } } @@ -4241,7 +4979,7 @@ widget.setFontDescription (preeditLabel, control.getFontDescription ()); if (pangoAttrs [0] != 0) OS.gtk_label_set_attributes (preeditLabel, pangoAttrs[0]); OS.gtk_label_set_text (preeditLabel, preeditString [0]); - Point point = control.toDisplay (control.getIMCaretPos ()); + Point point = control.toDisplayInPixels (control.getIMCaretPos ()); OS.gtk_window_move (preeditWindow, point.x, point.y); GtkRequisition requisition = new GtkRequisition (); if (OS.GTK3) { @@ -4545,6 +5283,41 @@ return widget.shellMapProc (handle, arg0, user_data); } +String simple_color_parser (String output, String value, int index) { + /* + * This method takes a color value (rgb(...), #rgb, an X11 color, etc.) + * and makes sure it's input we can handle. We can handle rgb/rgba values, + * X11 colors, or colors in the format #rgb or #rrggbb. + * + * We cannot handle shade/gradient functions or references to other colors. + * Because of this we strip out values that start with "@" and check + * non rgb values against X11 named colors. + * + * The following would be invalid input: + * + * shade(@bg_color, 0,7) + * or + * define-color error_bg_color @bg_color + */ + if (output != null && value != null) { + int position; + String color; + position = index + value.length() + 1; + color = output.substring(position); + // Check for rgb color case + if (color.startsWith("#") || color.startsWith("rgb")) { + return color; + } else if (!color.startsWith("@")) { + // Check for an X11 color + String [] cut = color.split(";"); + if (colorList.contains(cut[0])) { + return color; + } + } + } + return ""; +} + int /*long*/ signalProc (int /*long*/ gobject, int /*long*/ arg1, int /*long*/ user_data) { switch((int)/*64*/user_data) { case STYLE_SET: @@ -4662,7 +5435,7 @@ checkDevice (); flushExposes (0, true); /* - * Do not send expose events on GTK 3.16.0+ + * Do not send expose events on GTK 3.16.0+ * It's worth checking whether can be removed on all GTK 3 versions. */ if (OS.GTK_VERSION < OS.VERSION(3, 16, 0)) { @@ -4763,4 +5536,23 @@ } } +/** + * @noreference This method is not intended to be referenced by clients. + * @nooverride This method is not intended to be re-implemented or extended by clients. + */ +@Override +protected int /*long*/ gsettingsProc (int /*long*/ gobject, int /*long*/ arg1, int /*long*/ user_data) { + switch((int)/*64*/user_data) { + case CHANGE_SCALEFACTOR: + this.scaleFactor = getDeviceZoom (); + DPIUtil.setDeviceZoom (scaleFactor); + Shell[] shells = getShells(); + for (int i = 0; i < shells.length; i++) { + shells[i].layout(true, true); + } + } + return 0; +} + + } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Event.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Event.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Event.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Event.java 2016-07-06 19:11:33.000000000 +0000 @@ -12,6 +12,7 @@ import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.*; /** * Instances of this class provide a description of a particular @@ -22,7 +23,7 @@ * will be filled in. The contents of the fields which are not used * by the event are unspecified. * </p> - * + * * @see Listener * @see org.eclipse.swt.events.TypedEvent * @see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: ControlExample, Listeners</a> @@ -30,19 +31,19 @@ */ public class Event { - + /** * the display where the event occurred - * - * @since 2.0 - */ + * + * @since 2.0 + */ public Display display; - + /** * the widget that issued the event */ public Widget widget; - + /** * the type of event, as defined by the event type constants * in class <code>SWT</code> @@ -50,27 +51,27 @@ * @see org.eclipse.swt.SWT */ public int type; - + /** * the event specific detail field, as defined by the detail constants * in class <code>SWT</code> - * + * * @see org.eclipse.swt.SWT */ public int detail; - + /** * the item that the event occurred in (can be null) */ public Widget item; - + /** * the index of the item where the event occurred - * + * * @since 3.2 */ public int index; - + /** * the graphics context to use when painting * that is configured to use the colors, font and @@ -78,7 +79,7 @@ * only during the paint and must not be disposed */ public GC gc; - + /** * depending on the event type, the x offset of the bounding * rectangle of the region that requires painting or the @@ -86,7 +87,7 @@ * time the mouse button was pressed or released */ public int x; - + /** * depending on the event type, the y offset of the bounding * rectangle of the region that requires painting or the @@ -94,15 +95,15 @@ * time the mouse button was pressed or released */ public int y; - + /** - * the width of the bounding rectangle of the + * the width of the bounding rectangle of the * region that requires painting */ public int width; - + /** - * the height of the bounding rectangle of the + * the height of the bounding rectangle of the * region that requires painting */ public int height; @@ -115,23 +116,23 @@ * mouse has been clicked */ public int count; - + /** * the time that the event occurred. - * + * * NOTE: This field is an unsigned integer and should * be AND'ed with 0xFFFFFFFFL so that it can be treated * as a signed long. - */ + */ public int time; - + /** * the button that was pressed or released; 1 for the * first button, 2 for the second button, and 3 for the * third button, etc. - */ + */ public int button; - + /** * depending on the event, the character represented by the key * that was typed. This is the final character that results @@ -142,7 +143,7 @@ * resulting character will not be correct. */ public char character; - + /** * depending on the event, the key code of the key that was typed, * as defined by the key code constants in class <code>SWT</code>. @@ -151,51 +152,51 @@ * example, typing Ctrl+M or Enter both result in the character '\r' * but the keyCode field will also contain '\r' when Enter was typed * and 'm' when Ctrl+M was typed. - * + * * @see org.eclipse.swt.SWT */ public int keyCode; - + /** - * depending on the event, the location of key specified by the - * keyCode or character. The possible values for this field are + * depending on the event, the location of key specified by the + * keyCode or character. The possible values for this field are * <code>SWT.LEFT</code>, <code>SWT.RIGHT</code>, <code>SWT.KEYPAD</code>, * or <code>SWT.NONE</code> representing the main keyboard area. * <p> - * The location field can be used to differentiate key events that have - * the same key code and character but are generated by different keys + * The location field can be used to differentiate key events that have + * the same key code and character but are generated by different keys * in the keyboard. For example, a key down event with the key code equals - * to SWT.SHIFT can be generated by the left and the right shift keys in the - * keyboard. The location field can only be used to determine the location - * of the key code or character in the current event. It does not + * to SWT.SHIFT can be generated by the left and the right shift keys in the + * keyboard. The location field can only be used to determine the location + * of the key code or character in the current event. It does not * include information about the location of modifiers in state * mask. * </p> - * + * * @see org.eclipse.swt.SWT#LEFT * @see org.eclipse.swt.SWT#RIGHT * @see org.eclipse.swt.SWT#KEYPAD - * + * * @since 3.6 */ public int keyLocation; - + /** * depending on the event, the state of the keyboard modifier * keys and mouse masks at the time the event was generated. - * + * * @see org.eclipse.swt.SWT#MODIFIER_MASK * @see org.eclipse.swt.SWT#BUTTON_MASK */ public int stateMask; - + /** * depending on the event, the range of text being modified. - * Setting these fields only has effect during ImeComposition + * Setting these fields only has effect during ImeComposition * events. */ public int start, end; - + /** * depending on the event, the new text that will be inserted. * Setting this field will change the text that is about to @@ -203,13 +204,13 @@ */ public String text; - /** + /** * Bidi segment offsets * @since 3.8 */ public int[] segments; - - /** + + /** * Characters to be applied on the segment boundaries * @since 3.8 */ @@ -221,19 +222,19 @@ * operation. */ public boolean doit = true; - + /** * a field for application use */ public Object data; - + /** * An array of the touch states for the current touch event. * * @since 3.7 */ public Touch[] touches; - + /** * If nonzero, a positive value indicates a swipe to the right, * and a negative value indicates a swipe to the left. @@ -241,7 +242,7 @@ * @since 3.7 */ public int xDirection; - + /** * If nonzero, a positive value indicates a swipe in the up direction, * and a negative value indicates a swipe in the down direction. @@ -249,35 +250,45 @@ * @since 3.7 */ public int yDirection; - + /** - * The change in magnification. This value should be added to the current + * The change in magnification. This value should be added to the current * scaling of an item to get the new scale factor. * * @since 3.7 */ public double magnification; - + /** * The number of degrees rotated on the track pad. * * @since 3.7 */ public double rotation; - /** * Gets the bounds. - * + * * @return a rectangle that is the bounds. */ public Rectangle getBounds () { return new Rectangle (x, y, width, height); } +Rectangle getBoundsInPixels () { + return DPIUtil.autoScaleUp(getBounds()); +} + +Point getLocation () { + return new Point (x, y); +} + +Point getLocationInPixels () { + return DPIUtil.autoScaleUp(new Point(x, y)); +} /** * Sets the bounds. - * + * * @param rect the new rectangle */ public void setBounds (Rectangle rect) { @@ -287,6 +298,15 @@ this.height = rect.height; } +void setBoundsInPixels (Rectangle rect) { + setBounds(DPIUtil.autoScaleDown(rect)); +} + +void setLocationInPixels (int x, int y) { + this.x = DPIUtil.autoScaleDown(x); + this.y = DPIUtil.autoScaleDown(y); +} + /** * Returns a string containing a concise, human-readable * description of the receiver. diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/EventTable.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/EventTable.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/EventTable.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/EventTable.java 2016-07-06 19:11:33.000000000 +0000 @@ -26,7 +26,7 @@ Listener [] listeners; int level; static final int GROW_SIZE = 4; - + public Listener [] getListeners (int eventType) { if (types == null) return new Listener [0]; int count = 0; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/ExpandBar.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/ExpandBar.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/ExpandBar.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/ExpandBar.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -13,6 +13,7 @@ import org.eclipse.swt.*; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; /** @@ -115,7 +116,7 @@ } @Override -public Point computeSize (int wHint, int hHint, boolean changed) { +Point computeSizeInPixels (int wHint, int hHint, boolean changed) { if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; Point size = computeNativeSize (handle, wHint, hHint, changed); @@ -168,7 +169,7 @@ System.arraycopy (items, index, items, index + 1, itemCount - index); items [index] = item; itemCount++; - item.width = Math.max (0, getClientArea ().width - spacing * 2); + item.width = Math.max (0, getClientAreaInPixels ().width - spacing * 2); layoutItems (index, true); } @@ -302,6 +303,11 @@ */ public int getSpacing () { checkWidget (); + return DPIUtil.autoScaleDown(spacing); +} + +int getSpacingInPixels () { + checkWidget (); return spacing; } @@ -427,6 +433,16 @@ } @Override +void setWidgetBackground () { + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + GdkColor color = (state & BACKGROUND) != 0 ? getBackgroundColor () : null; + super.setBackgroundColor (color); + } else { + super.setWidgetBackground(); + } +} + +@Override void setFontDescription (int /*long*/ font) { super.setFontDescription (font); for (int i = 0; i < itemCount; i++) { @@ -456,7 +472,7 @@ void setScrollbar () { if (itemCount == 0) return; if ((style & SWT.V_SCROLL) == 0) return; - int height = getClientArea ().height; + int height = getClientAreaInPixels ().height; ExpandItem item = items [itemCount - 1]; int maxHeight = item.y + getBandHeight () + spacing; if (item.expanded) maxHeight += item.height; @@ -508,6 +524,11 @@ */ public void setSpacing (int spacing) { checkWidget (); + setSpacingInPixels(DPIUtil.autoScaleUp(spacing)); +} + +void setSpacingInPixels (int spacing) { + checkWidget (); if (spacing < 0) return; if (spacing == this.spacing) return; this.spacing = spacing; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/ExpandItem.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/ExpandItem.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/ExpandItem.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/ExpandItem.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -200,8 +200,8 @@ px+3,py+2, px+4,py+2, px+4,py+1, px+5,py+1, px+5,py, px+6,py}; } gc.setForeground (display.getSystemColor (SWT.COLOR_TITLE_FOREGROUND)); - gc.drawPolyline (polyline1); - gc.drawPolyline (polyline2); + gc.drawPolyline (DPIUtil.autoScaleDown(polyline1)); + gc.drawPolyline (DPIUtil.autoScaleDown(polyline2)); } void drawItem (GC gc, boolean drawFocus) { @@ -283,11 +283,15 @@ */ public int getHeaderHeight () { checkWidget (); + return DPIUtil.autoScaleDown (getHeaderHeightInPixels ()); +} + +int getHeaderHeightInPixels () { + checkWidget (); GtkAllocation allocation = new GtkAllocation (); OS.gtk_widget_get_allocation (handle, allocation); return allocation.height - (expanded ? height : 0); } - /** * Gets the height of the receiver. * @@ -300,6 +304,11 @@ */ public int getHeight () { checkWidget (); + return DPIUtil.autoScaleDown(getHeightInPixels()); +} + +int getHeightInPixels () { + checkWidget (); return height; } @@ -472,8 +481,8 @@ redraw (); } if (control != null && !control.isDisposed ()) { - if (move) control.setLocation (x + BORDER, y + headerHeight); - if (size) control.setSize (Math.max (0, width - 2 * BORDER), Math.max (0, height - BORDER)); + if (move) control.setLocationInPixels (x + BORDER, y + headerHeight); + if (size) control.setSizeInPixels (Math.max (0, width - 2 * BORDER), Math.max (0, height - BORDER)); } } @@ -556,9 +565,19 @@ } void setForegroundColor (GdkColor color) { - setForegroundColor (handle, color); - if (labelHandle != 0) setForegroundColor (labelHandle, color); - if (imageHandle != 0) setForegroundColor (imageHandle, color); + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + GdkRGBA rgba = null; + if (color != null) { + rgba = display.toGdkRGBA (color); + } + parent.setForegroundColor (handle, rgba); + if (labelHandle != 0) parent.setForegroundColor (labelHandle, rgba); + if (imageHandle != 0) parent.setForegroundColor (imageHandle, rgba); + } else { + setForegroundColor (handle, color); + if (labelHandle != 0) setForegroundColor (labelHandle, color); + if (imageHandle != 0) setForegroundColor (imageHandle, color); + } } /** @@ -574,6 +593,11 @@ */ public void setHeight (int height) { checkWidget (); + setHeightInPixels(DPIUtil.autoScaleUp(height)); +} + +void setHeightInPixels (int height) { + checkWidget (); if (height < 0) return; this.height = height; OS.gtk_widget_set_size_request (clientHandle, -1, height); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/FileDialog.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/FileDialog.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/FileDialog.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/FileDialog.java 2016-07-06 19:11:33.000000000 +0000 @@ -307,9 +307,17 @@ int /*long*/ shellHandle = parent.topHandle (); Display display = parent != null ? parent.getDisplay (): Display.getCurrent (); if (display.getDismissalAlignment() == SWT.RIGHT) { - handle = OS.gtk_file_chooser_dialog_new (titleBytes, shellHandle, action, OS.GTK_STOCK_CANCEL (), OS.GTK_RESPONSE_CANCEL, OS.GTK_STOCK_OK (), OS.GTK_RESPONSE_OK, 0); + if (OS.GTK3) { + handle = OS.gtk_file_chooser_dialog_new (titleBytes, shellHandle, action, OS.GTK_NAMED_LABEL_CANCEL, OS.GTK_RESPONSE_CANCEL, OS.GTK_NAMED_LABEL_OK, OS.GTK_RESPONSE_OK, 0); + } else { + handle = OS.gtk_file_chooser_dialog_new (titleBytes, shellHandle, action, OS.GTK_STOCK_CANCEL (), OS.GTK_RESPONSE_CANCEL, OS.GTK_STOCK_OK (), OS.GTK_RESPONSE_OK, 0); + } } else { - handle = OS.gtk_file_chooser_dialog_new (titleBytes, shellHandle, action, OS.GTK_STOCK_OK (), OS.GTK_RESPONSE_OK, OS.GTK_STOCK_CANCEL (), OS.GTK_RESPONSE_CANCEL, 0); + if (OS.GTK3) { + handle = OS.gtk_file_chooser_dialog_new (titleBytes, shellHandle, action, OS.GTK_NAMED_LABEL_OK, OS.GTK_RESPONSE_OK, OS.GTK_NAMED_LABEL_CANCEL, OS.GTK_RESPONSE_CANCEL, 0); + } else { + handle = OS.gtk_file_chooser_dialog_new (titleBytes, shellHandle, action, OS.GTK_STOCK_OK (), OS.GTK_RESPONSE_OK, OS.GTK_STOCK_CANCEL (), OS.GTK_RESPONSE_CANCEL, 0); + } } if (handle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_window_set_modal (handle, true); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Group.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Group.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Group.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Group.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -43,6 +43,8 @@ public class Group extends Composite { int /*long*/ clientHandle, labelHandle; String text = ""; + // We use this to keep track of the foreground color + GdkRGBA foreground; /** * Constructs a new instance of this class given its parent @@ -103,14 +105,14 @@ } @Override -public Point computeSize (int wHint, int hHint, boolean changed) { - Point size = super.computeSize(wHint, hHint, changed); +Point computeSizeInPixels (int wHint, int hHint, boolean changed) { + Point size = super.computeSizeInPixels(wHint, hHint, changed); int width = computeNativeSize (handle, SWT.DEFAULT, SWT.DEFAULT, false).x; size.x = Math.max (size.x, width); return size; } @Override -public Rectangle computeTrim (int x, int y, int width, int height) { +Rectangle computeTrimInPixels (int x, int y, int width, int height) { checkWidget(); forceResize (); GtkAllocation allocation = new GtkAllocation(); @@ -125,8 +127,8 @@ } @Override -public Rectangle getClientArea () { - Rectangle clientRectangle = super.getClientArea (); +Rectangle getClientAreaInPixels () { + Rectangle clientRectangle = super.getClientAreaInPixels (); /* * Bug 453827 Child position fix. * SWT's calls to gtk_widget_size_allocate and gtk_widget_set_allocation @@ -145,6 +147,18 @@ return clientRectangle; } +@Override +GdkColor getContextColor () { + if (OS.GTK_VERSION >= OS.VERSION (3, 16, 0)) { + if (foreground != null) { + return display.toGdkColor (foreground); + } else { + return display.COLOR_WIDGET_FOREGROUND; + } + } else { + return super.getContextColor(); + } +} @Override void createHandle(int index) { @@ -294,10 +308,17 @@ @Override void setBackgroundColor (GdkColor color) { - super.setBackgroundColor (color); - setBackgroundColor (fixedHandle, color); - // Bug 453827 - client handle should also be painted as it's visible to the user now. - setBackgroundColor (clientHandle, color); + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + // With CSS theming we only need to set the background color + // of the parent SwtFixed container. + setBackgroundColor (fixedHandle, color); + return; + } else { + super.setBackgroundColor (color); + setBackgroundColor (fixedHandle, color); + // Bug 453827 - client handle should also be painted as it's visible to the user now. + setBackgroundColor (clientHandle, color); + } } @Override @@ -308,8 +329,27 @@ @Override void setForegroundColor (GdkColor color) { - super.setForegroundColor (color); - setForegroundColor (labelHandle, color); + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + GdkRGBA rgba = null; + if (color != null) { + rgba = display.toGdkRGBA (color); + } + /* + * When using CSS, setting the foreground color on an empty label + * widget prevents the background from being set. If a user wants + * to specify a foreground color before the text is set, store the + * color and wait until text is specified to apply it. + */ + if (text.isEmpty()) { + foreground = rgba; + } else { + setForegroundColor (labelHandle, rgba); + foreground = rgba; + } + } else { + super.setForegroundColor (color); + setForegroundColor(labelHandle, color); + } } @Override @@ -362,6 +402,10 @@ } else { OS.gtk_frame_set_label_widget (handle, 0); } + // Set the foreground now that the text has been set + if (OS.GTK_VERSION >= OS.VERSION (3, 16, 0)) { + setForegroundColor (labelHandle, foreground); + } } @Override @@ -370,4 +414,46 @@ if (clientHandle != 0) OS.gtk_widget_show (clientHandle); if (labelHandle != 0) OS.gtk_widget_show (labelHandle); } + +@Override +int setBounds(int x, int y, int width, int height, boolean move, boolean resize) { + + if (OS.GTK3) { + // Work around for bug 470129. + // See also https://bugzilla.gnome.org/show_bug.cgi?id=754976 : + // GtkFrame: Attempt to allocate size of width 1 (or a small number) fails + // + // GtkFrame does not handle well allocating less than its minimum size + GtkRequisition requisition = new GtkRequisition(); + OS.gtk_widget_get_preferred_size(handle, requisition, null); + width = Math.max(requisition.width, width); + } + + return super.setBounds(x, y, width, height, move, resize); +} + +@Override +int /*long*/ paintHandle() { + if (OS.GTK3) { + return super.paintHandle(); + } + else { + int /*long*/ topHandle = topHandle (); + /* we draw all our children on the clientHandle*/ + int /*long*/ paintHandle = clientHandle; + while (paintHandle != topHandle) { + if (OS.gtk_widget_get_has_window (paintHandle)) break; + paintHandle = OS.gtk_widget_get_parent (paintHandle); + } + return paintHandle; + } +} + +@Override +int /*long*/ paintWindow () { + int /*long*/ paintHandle = clientHandle; + OS.gtk_widget_realize (paintHandle); + return gtk_widget_get_window (paintHandle); } + +} \ No newline at end of file diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Item.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Item.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Item.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Item.java 2016-07-06 19:11:33.000000000 +0000 @@ -13,6 +13,7 @@ import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.BidiUtil; /** * This class is the abstract superclass of all non-windowed @@ -39,7 +40,7 @@ * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -72,7 +73,7 @@ * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -154,7 +155,7 @@ * @param image the image to display on the receiver (may be null) * * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li> + * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -193,9 +194,13 @@ } boolean updateTextDirection(int textDirection) { + /* + * textDirection argument passed here is either (1) AUTO_TEXT_DIRECTION, or + * (2) 0 (i.e. match orientation) or FLIP_TEXT_DIRECTION (mismatch orientation). + */ if (textDirection == AUTO_TEXT_DIRECTION) { state |= HAS_AUTO_DIRECTION; - textDirection = (style ^ resolveTextDirection (text)) == 0 ? 0 : SWT.FLIP_TEXT_DIRECTION; + textDirection = (style ^ BidiUtil.resolveTextDirection (text)) == 0 ? 0 : SWT.FLIP_TEXT_DIRECTION; } else { state &= ~HAS_AUTO_DIRECTION; } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Label.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Label.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Label.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Label.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -114,7 +114,7 @@ } @Override -public Point computeSize (int wHint, int hHint, boolean changed) { +Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; @@ -187,9 +187,17 @@ int descent = OS.PANGO_PIXELS (OS.pango_font_metrics_get_descent (metrics)); OS.pango_font_metrics_unref (metrics); int fontHeight = ascent + descent; - int [] buffer = new int [1]; - OS.g_object_get (labelHandle, OS.ypad, buffer, 0); - fontHeight += 2 * buffer [0]; + if (OS.GTK3) { + int [] bufferBottom = new int [1]; + int [] bufferTop = new int [1]; + OS.g_object_get(labelHandle, OS.margin_bottom, bufferBottom, 0); + OS.g_object_get(labelHandle, OS.margin_top, bufferTop, 0); + fontHeight += bufferBottom [0] + bufferTop [0]; + } else { + int [] bufferYpad = new int[1]; + OS.g_object_get (labelHandle, OS.ypad, bufferYpad, 0); + fontHeight += 2 * bufferYpad [0]; + } if (frameHandle != 0) { fontHeight += 2 * getThickness (frameHandle).y; fontHeight += 2 * OS.gtk_container_get_border_width (frameHandle); @@ -289,7 +297,7 @@ } @Override -public int getBorderWidth () { +int getBorderWidthInPixels () { checkWidget(); if (frameHandle != 0) { return getThickness (frameHandle).x; @@ -484,9 +492,11 @@ @Override void setBackgroundColor (GdkColor color) { super.setBackgroundColor (color); - setBackgroundColor(fixedHandle, color); - if (labelHandle != 0) setBackgroundColor(labelHandle, color); - if (imageHandle != 0) setBackgroundColor(imageHandle, color); + if (OS.GTK_VERSION < OS.VERSION(3, 16, 0)) { + setBackgroundColor(fixedHandle, color); + if (labelHandle != 0) setBackgroundColor(labelHandle, color); + if (imageHandle != 0) setBackgroundColor(imageHandle, color); + } } @Override @@ -542,14 +552,34 @@ super.setFontDescription (font); if (labelHandle != 0) setFontDescription (labelHandle, font); if (imageHandle != 0) setFontDescription (imageHandle, font); + + // Bug 445801: Work around for computeSize not returning a different value after + // changing font, see https://bugzilla.gnome.org/show_bug.cgi?id=753116 + if (OS.GTK3) { + // This updates the pango context and also clears the size request cache on the GTK side. + int originalDirection = (style & SWT.RIGHT_TO_LEFT) != 0 ? OS.GTK_TEXT_DIR_RTL : OS.GTK_TEXT_DIR_LTR; + int tempDirection = (style & SWT.RIGHT_TO_LEFT) != 0 ? OS.GTK_TEXT_DIR_LTR : OS.GTK_TEXT_DIR_RTL; + OS.gtk_widget_set_direction (labelHandle, tempDirection); + OS.gtk_widget_set_direction (labelHandle, originalDirection); + } } @Override void setForegroundColor (GdkColor color) { super.setForegroundColor (color); - setForegroundColor (fixedHandle, color); - if (labelHandle != 0) setForegroundColor (labelHandle, color); - if (imageHandle != 0) setForegroundColor (imageHandle, color); + if (OS.GTK_VERSION >= OS.VERSION (3, 16, 0)) { + GdkRGBA rgba = null; + if (color != null) { + rgba = display.toGdkRGBA (color); + } + setForegroundColor (fixedHandle, rgba); + if (labelHandle != 0) setForegroundColor (labelHandle, rgba); + if (imageHandle != 0) setForegroundColor (imageHandle, rgba); + } else { + setForegroundColor (fixedHandle, color); + if (labelHandle != 0) setForegroundColor (labelHandle, color); + if (imageHandle != 0) setForegroundColor (imageHandle, color); + } } @Override @@ -616,7 +646,7 @@ * Note: If control characters like '\n', '\t' etc. are used * in the string, then the behavior is platform dependent. * </p> - * + * * @param string the new text * * @exception IllegalArgumentException <ul> @@ -640,6 +670,16 @@ } @Override +void setWidgetBackground () { + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + GdkColor color = (state & BACKGROUND) != 0 ? getBackgroundColor () : null; + super.setBackgroundColor (color); + } else { + super.setWidgetBackground(); + } +} + +@Override void showWidget () { super.showWidget (); if (frameHandle != 0) OS.gtk_widget_show (frameHandle); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Layout.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Layout.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Layout.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Layout.java 2016-07-06 19:11:33.000000000 +0000 @@ -18,7 +18,7 @@ * of the children of a composite widget. * This class is the abstract base class for * layouts. - * + * * @see Composite#setLayout(Layout) * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ @@ -28,8 +28,8 @@ * Computes and returns the size of the specified * composite's client area according to this layout. * <p> - * This method computes the size that the client area - * of the composite must be in order to position all + * This method computes the size that the client area + * of the composite must be in order to position all * children at their preferred size inside the * composite according to the layout algorithm * encoded by this layout. @@ -48,7 +48,7 @@ * @param hHint height (<code>SWT.DEFAULT</code> for preferred size) * @param flushCache <code>true</code> means flush cached layout values * @return a point containing the computed size (width, height) - * + * * @see #layout * @see Control#getBorderWidth * @see Control#getBounds @@ -60,12 +60,12 @@ /** * Instruct the layout to flush any cached values - * associated with the control specified in the argument + * associated with the control specified in the argument * <code>control</code>. - * + * * @param control a control managed by this layout * @return true if the Layout has flushed all cached information associated with control - * + * * @since 3.1 */ protected boolean flushCache (Control control) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Link.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Link.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Link.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Link.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Conrad Groth - Bug 401015 - [CSS] Add support for styling hyperlinks in Links *******************************************************************************/ package org.eclipse.swt.widgets; @@ -14,6 +15,7 @@ import org.eclipse.swt.accessibility.*; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; /** @@ -114,7 +116,7 @@ } @Override -public Point computeSize (int wHint, int hHint, boolean changed) { +Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; @@ -122,20 +124,20 @@ int layoutWidth = layout.getWidth (); //TEMPORARY CODE if (wHint == 0) { - layout.setWidth (1); - Rectangle rect = layout.getBounds (); + layout.setWidth (DPIUtil.autoScaleDown(1)); + Rectangle rect = DPIUtil.autoScaleUp(layout.getBounds ()); width = 0; height = rect.height; } else { - layout.setWidth (wHint); - Rectangle rect = layout.getBounds (); + layout.setWidth (DPIUtil.autoScaleDown(wHint)); + Rectangle rect = DPIUtil.autoScaleUp(layout.getBounds ()); width = rect.width; height = rect.height; } layout.setWidth (layoutWidth); if (wHint != SWT.DEFAULT) width = wHint; if (hHint != SWT.DEFAULT) height = hHint; - int border = getBorderWidth (); + int border = getBorderWidthInPixels (); width += border * 2; height += border * 2; return new Point (width, height); @@ -149,7 +151,6 @@ OS.gtk_widget_set_has_window (handle, true); OS.gtk_widget_set_can_focus (handle, true); layout = new TextLayout (display); - linkColor = display.getSystemColor(SWT.COLOR_LINK_FOREGROUND); disabledColor = new Color (display, LINK_DISABLED_FOREGROUND); offsets = new Point [0]; ids = new String [0]; @@ -179,9 +180,9 @@ if ((state & DISABLED) != 0) gc.setForeground (disabledColor); layout.draw (gc, 0, 0, selStart, selEnd, null, null); if (hasFocus () && focusIndex != -1) { - Rectangle [] rects = getRectangles (focusIndex); + Rectangle [] rects = getRectanglesInPixels (focusIndex); for (int i = 0; i < rects.length; i++) { - Rectangle rect = rects [i]; + Rectangle rect = DPIUtil.autoScaleDown(rects [i]); gc.drawFocus (rect.x, rect.y, rect.width, rect.height); } } @@ -191,12 +192,7 @@ void enableWidget (boolean enabled) { super.enableWidget (enabled); if (isDisposed ()) return; - TextStyle linkStyle = new TextStyle (null, enabled ? linkColor : disabledColor, null); - linkStyle.underline = true; - for (int i = 0; i < offsets.length; i++) { - Point point = offsets [i]; - layout.setStyle (linkStyle, point.x, point.y); - } + styleLinkParts(); redraw (); } @@ -262,12 +258,28 @@ }); } +/** + * Returns the link foreground color. + * + * @return the receiver's link foreground color. + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + * @since 3.105 + */ +public Color getLinkForeground () { + checkWidget (); + return linkColor != null ? linkColor : display.getSystemColor(SWT.COLOR_LINK_FOREGROUND); +} + @Override String getNameText () { return getText (); } -Rectangle [] getRectangles (int linkIndex) { +Rectangle [] getRectanglesInPixels (int linkIndex) { int lineCount = layout.getLineCount (); Rectangle [] rects = new Rectangle [lineCount]; int [] lineOffsets = layout.getLineOffsets (); @@ -278,13 +290,13 @@ while (point.y > lineOffsets [lineEnd]) lineEnd++; int index = 0; if (lineStart == lineEnd) { - rects [index++] = layout.getBounds (point.x, point.y); + rects [index++] = DPIUtil.autoScaleUp (layout.getBounds (point.x, point.y)); } else { - rects [index++] = layout.getBounds (point.x, lineOffsets [lineStart]-1); - rects [index++] = layout.getBounds (lineOffsets [lineEnd-1], point.y); + rects [index++] = DPIUtil.autoScaleUp (layout.getBounds (point.x, lineOffsets [lineStart]-1)); + rects [index++] = DPIUtil.autoScaleUp (layout.getBounds (lineOffsets [lineEnd-1], point.y)); if (lineEnd - lineStart > 1) { for (int i = lineStart; i < lineEnd - 1; i++) { - rects [index++] = layout.getLineBounds (i); + rects [index++] = DPIUtil.autoScaleUp (layout.getLineBounds (i)); } } } @@ -323,7 +335,7 @@ int x = (int) gdkEvent.x; int y = (int) gdkEvent.y; if ((style & SWT.MIRRORED) != 0) x = getClientWidth () - x; - int offset = layout.getOffset (x, y, null); + int offset = DPIUtil.autoScaleUp(layout.getOffset (x, y, null)); int oldSelectionX = selection.x; int oldSelectionY = selection.y; selection.x = offset; @@ -334,11 +346,11 @@ oldSelectionX = oldSelectionY; oldSelectionY = temp; } - Rectangle rect = layout.getBounds (oldSelectionX, oldSelectionY); - redraw (rect.x, rect.y, rect.width, rect.height, false); + Rectangle rect = DPIUtil.autoScaleUp(layout.getBounds (oldSelectionX, oldSelectionY)); + redrawInPixels (rect.x, rect.y, rect.width, rect.height, false); } for (int j = 0; j < offsets.length; j++) { - Rectangle [] rects = getRectangles (j); + Rectangle [] rects = getRectanglesInPixels (j); for (int i = 0; i < rects.length; i++) { Rectangle rect = rects [i]; if (rect.contains (x, y)) { @@ -363,7 +375,7 @@ int x = (int) gdkEvent.x; int y = (int) gdkEvent.y; if ((style & SWT.MIRRORED) != 0) x = getClientWidth () - x; - Rectangle [] rects = getRectangles (focusIndex); + Rectangle [] rects = getRectanglesInPixels (focusIndex); for (int i = 0; i < rects.length; i++) { Rectangle rect = rects [i]; if (rect.contains (x, y)) { @@ -378,6 +390,21 @@ } @Override +int /*long*/ gtk_draw (int /*long*/ widget, int /*long*/ cairo) { + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + int /*long*/ context = OS.gtk_widget_get_style_context(widget); + GtkAllocation allocation = new GtkAllocation(); + OS.gtk_widget_get_allocation (widget, allocation); + int width = (state & ZERO_WIDTH) != 0 ? 0 : allocation.width; + int height = (state & ZERO_HEIGHT) != 0 ? 0 : allocation.height; + // We specify a 0 value for x & y as we want the whole widget to be + // colored, not some portion of it. + OS.gtk_render_background(context, cairo, 0, 0, width, height); + } + return super.gtk_draw(widget, cairo); +} + +@Override int /*long*/ gtk_event_after (int /*long*/ widget, int /*long*/ gdkEvent) { int /*long*/ result = super.gtk_event_after (widget, gdkEvent); GdkEvent event = new GdkEvent (); @@ -432,7 +459,7 @@ if ((style & SWT.MIRRORED) != 0) x = getClientWidth () - x; if ((gdkEvent.state & OS.GDK_BUTTON1_MASK) != 0) { int oldSelection = selection.y; - selection.y = layout.getOffset (x, y, null); + selection.y = DPIUtil.autoScaleUp(layout.getOffset (x, y, null)); if (selection.y != oldSelection) { int newSelection = selection.y; if (oldSelection > newSelection) { @@ -441,11 +468,11 @@ newSelection = temp; } Rectangle rect = layout.getBounds (oldSelection, newSelection); - redraw (rect.x, rect.y, rect.width, rect.height, false); + redrawInPixels (rect.x, rect.y, rect.width, rect.height, false); } } else { for (int j = 0; j < offsets.length; j++) { - Rectangle [] rects = getRectangles (j); + Rectangle [] rects = getRectanglesInPixels (j); for (int i = 0; i < rects.length; i++) { Rectangle rect = rects [i]; if (rect.contains (x, y)) { @@ -690,7 +717,7 @@ int setBounds(int x, int y, int width, int height, boolean move, boolean resize) { int result = super.setBounds (x, y, width,height, move, resize); if ((result & RESIZED) != 0) { - layout.setWidth (width > 0 ? width : -1); + layout.setWidth (DPIUtil.autoScaleDown((width > 0 ? width : -1))); redraw (); } return result; @@ -702,6 +729,37 @@ layout.setFont (Font.gtk_new (display, font)); } +/** + * Sets the link foreground color to the color specified + * by the argument, or to the default system color for the link + * if the argument is null. + * <p> + * Note: This operation is a hint and may be overridden by the platform. + * </p> + * @param color the new color (or null) + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> + * </ul> + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + * @since 3.105 + */ +public void setLinkForeground (Color color) { + checkWidget(); + if (color != null) { + if (color.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT); + if (color.equals(linkColor)) return; + } else if (linkColor == null) return; + linkColor = color; + if (getEnabled()) { + styleLinkParts(); + redraw(); + } +} + @Override void setOrientation (boolean create) { super.setOrientation (create); @@ -713,7 +771,7 @@ * Sets the receiver's text. * <p> * The string can contain both regular text and hyperlinks. A hyperlink - * is delimited by an anchor tag, <A> and </A>. Within an + * is delimited by an anchor tag, <a> and </a>. Within an * anchor, a single HREF attribute is supported. When a hyperlink is * selected, the text field of the selection event contains either the * text of the hyperlink or the value of its HREF, if one was specified. @@ -753,13 +811,10 @@ layout.setText (parse (string)); focusIndex = offsets.length > 0 ? 0 : -1; selection.x = selection.y = -1; - boolean enabled = (state & DISABLED) == 0; - TextStyle linkStyle = new TextStyle (null, enabled ? linkColor : disabledColor, null); - linkStyle.underline = true; + styleLinkParts(); int [] bidiSegments = new int [offsets.length*2]; for (int i = 0; i < offsets.length; i++) { Point point = offsets [i]; - layout.setStyle (linkStyle, point.x, point.y); bidiSegments[i*2] = point.x; bidiSegments[i*2+1] = point.y+1; } @@ -781,6 +836,16 @@ fixStyle (handle); } +void styleLinkParts() { + boolean enabled = (state & DISABLED) == 0; + TextStyle linkStyle = new TextStyle (null, enabled ? getLinkForeground() : disabledColor, null); + linkStyle.underline = true; + for (int i = 0; i < offsets.length; i++) { + Point point = offsets [i]; + layout.setStyle (linkStyle, point.x, point.y); + } +} + @Override int traversalCode (int key, GdkEventKey event) { if (offsets.length == 0) return 0; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Listener.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Listener.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Listener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Listener.java 2016-07-06 19:11:33.000000000 +0000 @@ -12,15 +12,15 @@ /** - * Implementers of <code>Listener</code> provide a simple - * <code>handleEvent()</code> method that is used internally + * Implementers of <code>Listener</code> provide a simple + * <code>handleEvent()</code> method that is used internally * by SWT to dispatch events. * <p> * After creating an instance of a class that implements this interface - * it can be added to a widget using the + * it can be added to a widget using the * <code>addListener(int eventType, Listener handler)</code> method and - * removed using the - * <code>removeListener (int eventType, Listener handler)</code> method. + * removed using the + * <code>removeListener (int eventType, Listener handler)</code> method. * When the specified event occurs, <code>handleEvent(...)</code> will * be sent to the instance. * </p> @@ -29,10 +29,10 @@ * providing the <em>untyped listener</em> API. Typically, widgets will * also provide a higher-level <em>typed listener</em> API, that is based * on the standard <code>java.util.EventListener</code> pattern. - * </p> + * </p> * <p> * Note that, since all internal SWT event dispatching is based on untyped - * listeners, it is simple to build subsets of SWT for use on memory + * listeners, it is simple to build subsets of SWT for use on memory * constrained, small footprint devices, by removing the classes and * methods which implement the typed listener API. * </p> diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/List.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/List.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/List.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/List.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -43,6 +43,7 @@ int /*long*/ modelHandle; static final int TEXT_COLUMN = 0; + GdkRGBA background; /** * Constructs a new instance of this class given its parent @@ -83,7 +84,6 @@ * Note: If control characters like '\n', '\t' etc. are used * in the string, then the behavior is platform dependent. * </p> - * * @param string the new item * * @exception IllegalArgumentException <ul> @@ -251,7 +251,7 @@ } @Override -public Point computeSize (int wHint, int hHint, boolean changed) { +Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; @@ -264,7 +264,7 @@ * based on the number of items in the table */ if (OS.GTK3 && size.y == 0 && hHint == SWT.DEFAULT) { - size.y = getItemCount() * getItemHeight(); + size.y = getItemCount() * getItemHeightInPixels(); } /* @@ -273,7 +273,7 @@ * so need to assign default height */ if (size.y == 0 && hHint == SWT.DEFAULT) size.y = DEFAULT_HEIGHT; - Rectangle trim = computeTrim (0, 0, size.x, size.y); + Rectangle trim = computeTrimInPixels (0, 0, size.x, size.y); size.x = trim.width; size.y = trim.height; return size; @@ -422,6 +422,21 @@ return getBaseColor (); } +@Override +GdkColor getContextBackground () { + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + if (background != null) { + return display.toGdkColor (background); + } else { + // List is a GtkTreeView, same as Table/Tree: its default + // background color is COLOR_LIST_BACKGROUND. + return display.COLOR_LIST_BACKGROUND; + } + } else { + return super.getContextBackground (); + } +} + /** * Returns the zero-relative index of the item which currently * has the focus in the receiver, or -1 if no item has focus. @@ -511,6 +526,11 @@ */ public int getItemHeight () { checkWidget(); + return DPIUtil.autoScaleDown(getItemHeightInPixels()); +} + +int getItemHeightInPixels () { + checkWidget(); int itemCount = OS.gtk_tree_model_iter_n_children (modelHandle, 0); int /*long*/ column = OS.gtk_tree_view_get_column (handle, 0); if (itemCount == 0) { @@ -808,22 +828,65 @@ } } } - /* - * Bug in GTK. GTK segments fault, if the GtkTreeView widget is - * not in focus and all items in the widget are disposed before - * it finishes processing a button press. The fix is to give - * focus to the widget before it starts processing the event. - */ - if (!OS.gtk_widget_has_focus (handle)) { - OS.gtk_widget_grab_focus (handle); + + //If Mouse double-click pressed, manually send a DefaultSelection. See Bug 312568. + if (gdkEvent.type == OS.GDK_2BUTTON_PRESS) { + sendTreeDefaultSelection (); } + return result; } + @Override -int /*long*/ gtk_row_activated (int /*long*/ tree, int /*long*/ path, int /*long*/ column) { - sendSelectionEvent (SWT.DefaultSelection); - return 0; +int /*long*/ gtk_key_press_event (int /*long*/ widget, int /*long*/ event) { + GdkEventKey keyEvent = new GdkEventKey (); + OS.memmove (keyEvent, event, GdkEventKey.sizeof); + int key = keyEvent.keyval; + keyPressDefaultSelectionHandler (event, key); + return super.gtk_key_press_event (widget, event); +} + +/** + * Used to emulate DefaultSelection event. See Bug 312568. + * @param event the gtk key press event that was fired. + */ +void keyPressDefaultSelectionHandler (int /*long*/ event, int key) { + + int keymask = gdk_event_get_state (event); + switch (key) { + case OS.GDK_Return: + //Send Default selection return only when no other modifier is pressed. + if ((keymask & (OS.GDK_MOD1_MASK | OS.GDK_SHIFT_MASK | OS.GDK_CONTROL_MASK + | OS.GDK_SUPER_MASK | OS.GDK_META_MASK | OS.GDK_HYPER_MASK)) == 0) { + sendTreeDefaultSelection (); + } + break; + case OS.GDK_space: + //Shift + Space is a legal DefaultSelection event. (as per row-activation signal documentation). + //But do not send if another modifier is pressed. + if ((keymask & (OS.GDK_MOD1_MASK | OS.GDK_CONTROL_MASK + | OS.GDK_SUPER_MASK | OS.GDK_META_MASK | OS.GDK_HYPER_MASK)) == 0) { + sendTreeDefaultSelection (); + } + break; + } +} + +//Used to emulate DefaultSelection event. See Bug 312568. +//Feature in GTK. 'row-activation' event comes before DoubleClick event. +//This is causing the editor not to get focus after doubleclick. +//The solution is to manually send the DefaultSelection event after a doubleclick, +//and to emulate it for Space/Return. +void sendTreeDefaultSelection() { + + //Note, similar DefaultSelectionHandling in SWT List/Table/Tree + Event event = new Event (); + event.index = this.getFocusIndex (); + + if (event.index >= 0) + event.text = this.getItem (event.index); + sendSelectionEvent (SWT.DefaultSelection, event, false); } @Override @@ -1276,6 +1339,38 @@ } @Override +void setBackgroundColor (int /*long*/ context, int /*long*/ handle, GdkRGBA rgba) { + /* Setting the background color overrides the selected background color. + * To prevent this, we need to re-set the default. This can be done with CSS + * on GTK3.16+, or by using GtkStateFlags as an argument to + * gtk_widget_override_background_color() on versions of GTK3 less than 3.16. + */ + if (rgba == null) { + GdkColor temp = getDisplay().COLOR_LIST_BACKGROUND; + background = display.toGdkRGBA (temp); + } else { + background = rgba; + } + GdkColor defaultColor = getDisplay().COLOR_LIST_SELECTION; + GdkRGBA selectedBackground = display.toGdkRGBA (defaultColor); + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + String name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "treeview" : "GtkTreeView"; + String css = name + " {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n" + + name + ":selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}"; + + // Cache background color + cssBackground = css; + + // Apply background color and any foreground color + String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND); + gtk_css_provider_load_from_css(context, finalCss); + } else { + super.setBackgroundColor(context, handle, rgba); + OS.gtk_widget_override_background_color(handle, OS.GTK_STATE_FLAG_SELECTED, selectedBackground); + } +} + +@Override int setBounds (int x, int y, int width, int height, boolean move, boolean resize) { int result = super.setBounds (x, y, width, height, move, resize); /* @@ -1356,7 +1451,15 @@ @Override void setForegroundColor (GdkColor color) { - setForegroundColor (handle, color, false); + if (OS.GTK_VERSION >= OS.VERSION (3, 16, 0)) { + GdkRGBA rgba = null; + if (color != null) { + rgba = display.toGdkRGBA (color); + } + setForegroundColor (handle, rgba); + } else { + setForegroundColor (handle, color, false); + } } /** diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/MenuItem.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/MenuItem.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/MenuItem.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/MenuItem.java 2016-07-06 19:11:33.000000000 +0000 @@ -38,7 +38,21 @@ */ public class MenuItem extends Item { Menu parent, menu; - int /*long*/ groupHandle; + int /*long*/ groupHandle, labelHandle, imageHandle; + + /** Feature in Gtk: as of Gtk version 3.10 GtkImageMenuItem is deprecated, + * meaning that MenuItems in SWT with images can no longer be GtkImageMenuItems + * after Gtk3.10. The solution to this is to create a GtkMenuItem, add a GtkBox + * as its child, and pack that box with a GtkLabel and GtkImage. This reproduces + * the functionality of a GtkImageMenuItem and allows SWT to retain image support + * for MenuItems. + * + * For more information see: + * https://developer.gnome.org/gtk3/stable/GtkImageMenuItem.html#GtkImageMenuItem.description + * Bug 470298 + */ + int /*long*/ boxHandle; + int accelerator, userId; String toolTipText; @@ -240,12 +254,21 @@ void createHandle (int index) { state |= HANDLE; byte [] buffer = new byte [1]; - int bits = SWT.CHECK | SWT.RADIO | SWT.PUSH | SWT.SEPARATOR; + int bits = SWT.CHECK | SWT.RADIO | SWT.PUSH | SWT.SEPARATOR | SWT.CASCADE; switch (style & bits) { case SWT.SEPARATOR: handle = OS.gtk_separator_menu_item_new (); + if (handle == 0) error (SWT.ERROR_NO_HANDLES); break; case SWT.RADIO: + if (OS.GTK_VERSION <= OS.VERSION (3, 10, 8)) { + /* + * Bug in Ubuntu <= 14.04 with UBUNTU_MENUPROXY. GTK crashes when + * label of radio button is empty, see https://bugs.eclipse.org/419729 . + * The workaround is to initialize the label with a space. + */ + buffer = new byte [] { ' ', 0 }; + } /* * Feature in GTK. In GTK, radio button must always be part of * a radio button group. In a GTK radio group, one button is always @@ -262,20 +285,113 @@ OS.g_object_ref (groupHandle); OS.g_object_ref_sink (groupHandle); int /*long*/ group = OS.gtk_radio_menu_item_get_group (groupHandle); - handle = OS.gtk_radio_menu_item_new_with_label (group, buffer); + if (OS.GTK3) { + handle = OS.gtk_radio_menu_item_new (group); + if (handle == 0) error (SWT.ERROR_NO_HANDLES); + + labelHandle = OS.gtk_accel_label_new (buffer); + if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES); + + boxHandle = gtk_box_new (OS.GTK_ORIENTATION_HORIZONTAL, false, 6); + if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES); + + if (OS.SWT_PADDED_MENU_ITEMS) { + imageHandle = OS.gtk_image_new (); + if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES); + } + } else { // Gtk2 + handle = OS.gtk_radio_menu_item_new_with_label (group, buffer); + } break; case SWT.CHECK: - handle = OS.gtk_check_menu_item_new_with_label (buffer); + if (OS.GTK3) { + handle = OS.gtk_check_menu_item_new (); + if (handle == 0) error (SWT.ERROR_NO_HANDLES); + + labelHandle = OS.gtk_accel_label_new (buffer); + if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES); + + boxHandle = gtk_box_new (OS.GTK_ORIENTATION_HORIZONTAL, false, 6); + if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES); + + if (OS.SWT_PADDED_MENU_ITEMS) { + imageHandle = OS.gtk_image_new (); + if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES); + } + } else { // Gtk2 + handle = OS.gtk_check_menu_item_new_with_label (buffer); + if (handle == 0) error (SWT.ERROR_NO_HANDLES); + } break; + // This case now needs to be handled due to double padding. When double padded + // menus are used, the "head" menu item (such as File, Edit, Help, etc.) should + // not be padded. We only care about this in Gtk3. + case SWT.CASCADE: + if (OS.GTK3) { + handle = OS.gtk_menu_item_new (); + if (handle == 0) error (SWT.ERROR_NO_HANDLES); + + labelHandle = OS.gtk_accel_label_new (buffer); + if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES); + + boxHandle = gtk_box_new (OS.GTK_ORIENTATION_HORIZONTAL, false, 6); + if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES); + if ((parent.style & bits) == SWT.BAR) { + break; + } + if (OS.SWT_PADDED_MENU_ITEMS) { + imageHandle = OS.gtk_image_new (); + if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES); + } + break; + } case SWT.PUSH: default: - handle = OS.gtk_image_menu_item_new_with_label (buffer); + if (OS.GTK3) { + handle = OS.gtk_menu_item_new (); + if (handle == 0) error (SWT.ERROR_NO_HANDLES); + + labelHandle = OS.gtk_accel_label_new (buffer); + if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES); + + boxHandle = gtk_box_new (OS.GTK_ORIENTATION_HORIZONTAL, false, 6); + if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES); + + if (OS.SWT_PADDED_MENU_ITEMS) { + imageHandle = OS.gtk_image_new (); + if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES); + } + } else { // Gtk2 + handle = OS.gtk_image_menu_item_new_with_label (buffer); + } break; } - if (handle == 0) error (SWT.ERROR_NO_HANDLES); + if (imageHandle != 0) { + if (OS.SWT_PADDED_MENU_ITEMS) { + OS.gtk_image_set_pixel_size (imageHandle, 16); + } + OS.gtk_container_add (boxHandle, imageHandle); + OS.gtk_widget_show (imageHandle); + } + if (labelHandle != 0) { + if (OS.GTK_VERSION >= OS.VERSION (3, 16, 0)) { + OS.gtk_label_set_xalign (labelHandle, 0); + OS.gtk_widget_set_halign (labelHandle, OS.GTK_ALIGN_FILL); + } else { + OS.gtk_misc_set_alignment(labelHandle, 0, 0); + } + OS.gtk_box_pack_end (boxHandle, labelHandle, true, true, 0); + OS.gtk_widget_show (labelHandle); + } + if (boxHandle != 0) { + OS.gtk_container_add (handle, boxHandle); + OS.gtk_widget_show (boxHandle); + } if ((style & SWT.SEPARATOR) == 0) { - int /*long*/ label = OS.gtk_bin_get_child (handle); - OS.gtk_accel_label_set_accel_widget (label, 0); + if (boxHandle == 0) { + labelHandle = OS.gtk_bin_get_child (handle); + } + OS.gtk_accel_label_set_accel_widget (labelHandle, 0); } int /*long*/ parentHandle = parent.handle; boolean enabled = OS.gtk_widget_get_sensitive (parentHandle); @@ -712,16 +828,18 @@ } /** - * Sets the image the receiver will display to the argument. + * Sets the receiver's image to the argument, which may be + * null indicating that no image should be displayed. * <p> - * Note: This operation is a hint and is not supported on + * Note: This operation is a <em>HINT</em> and is not supported on * platforms that do not have this concept (for example, Windows NT). - * Furthermore, some platforms (such as GTK), cannot display both + * Furthermore, some platforms (such as GTK2), cannot display both * a check box and an image at the same time. Instead, they hide - * the image and display the check box. + * the image and display the check box. Some platforms (such as GTK3) + * support images alongside check boxes. * </p> * - * @param image the image to display + * @param image the image to display on the receiver (may be null) * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -733,7 +851,6 @@ checkWidget(); if ((style & SWT.SEPARATOR) != 0) return; super.setImage (image); - if (!OS.GTK_IS_IMAGE_MENU_ITEM (handle)) return; if (image != null) { ImageList imageList = parent.imageList; if (imageList == null) imageList = parent.imageList = new ImageList (); @@ -744,11 +861,46 @@ imageList.put (imageIndex, image); } int /*long*/ pixbuf = imageList.getPixbuf (imageIndex); - int /*long*/ imageHandle = OS.gtk_image_new_from_pixbuf (pixbuf); - OS.gtk_image_menu_item_set_image (handle, imageHandle); + if (OS.GTK3) { + if (!OS.GTK_IS_MENU_ITEM (handle)) return; + if (OS.SWT_PADDED_MENU_ITEMS && imageHandle != 0) { + OS.gtk_image_set_from_pixbuf(imageHandle, pixbuf); + } else { + if (imageHandle == 0 && boxHandle != 0) { + imageHandle = OS.gtk_image_new_from_pixbuf (pixbuf); + OS.gtk_container_add (boxHandle, imageHandle); + OS.gtk_box_reorder_child (boxHandle, imageHandle, 0); + } else { + OS.gtk_image_set_from_pixbuf(imageHandle, pixbuf); + } + if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES); + } + } else { + if (!OS.GTK_IS_IMAGE_MENU_ITEM (handle)) return; + imageHandle = OS.gtk_image_new_from_pixbuf (pixbuf); + OS.gtk_image_menu_item_set_image (handle, imageHandle); + } + if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_widget_show (imageHandle); } else { - OS.gtk_image_menu_item_set_image (handle, 0); + if (OS.GTK3) { + if (imageHandle != 0 && boxHandle != 0) { + if (OS.SWT_PADDED_MENU_ITEMS) { + OS.gtk_container_remove(boxHandle, imageHandle); + imageHandle = OS.gtk_image_new (); + if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES); + OS.gtk_image_set_pixel_size (imageHandle, 16); + OS.gtk_container_add (boxHandle, imageHandle); + OS.gtk_widget_show (imageHandle); + } else { + OS.gtk_container_remove(boxHandle, imageHandle); + imageHandle = 0; + } + } + } else { + if (!OS.GTK_IS_IMAGE_MENU_ITEM (handle)) return; + OS.gtk_image_menu_item_set_image (handle, 0); + } } } @@ -909,23 +1061,25 @@ } char [] chars = fixMnemonic (string); byte [] buffer = Converter.wcsToMbcs (null, chars, true); - int /*long*/ label = OS.gtk_bin_get_child (handle); - if (label != 0 && OS.GTK_IS_LABEL(label)) { - OS.gtk_label_set_text_with_mnemonic (label, buffer); - if (OS.GTK_IS_ACCEL_LABEL(label)) { + if (boxHandle == 0 && !OS.GTK3) { + labelHandle = OS.gtk_bin_get_child (handle); + } + if (labelHandle != 0 && OS.GTK_IS_LABEL (labelHandle)) { + OS.gtk_label_set_text_with_mnemonic (labelHandle, buffer); + if (OS.GTK_IS_ACCEL_LABEL (labelHandle)) { if (OS.GTK3) { - OS.gtk_accel_label_set_accel_widget(label, handle); if (OS.GTK_VERSION >= OS.VERSION(3, 6, 0)) { MaskKeysym maskKeysym = getMaskKeysym(); if (maskKeysym != null) { - OS.gtk_accel_label_set_accel(label, - maskKeysym.keysym, maskKeysym.mask); + OS.gtk_accel_label_set_accel_widget (labelHandle, handle); + OS.gtk_accel_label_set_accel (labelHandle, + maskKeysym.keysym, maskKeysym.mask); } } else { - setAccelLabel(label, accelString); + setAccelLabel (labelHandle, accelString); } } else { - setAccelLabel(label, accelString); + setAccelLabel (labelHandle, accelString); } // A workaround for Ubuntu Unity global menu OS.g_signal_emit_by_name(handle, OS.accel_closures_changed); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Menu.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Menu.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Menu.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Menu.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -10,11 +10,11 @@ *******************************************************************************/ package org.eclipse.swt.widgets; -import org.eclipse.swt.internal.*; -import org.eclipse.swt.internal.gtk.*; import org.eclipse.swt.*; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.*; +import org.eclipse.swt.internal.gtk.*; /** * Instances of this class are user interface objects that contain @@ -315,7 +315,7 @@ void createIMMenu (int /*long*/ imHandle) { boolean showInputMethod = false; int /*long*/ settings = OS.gtk_settings_get_default (); - if (settings != 0) { + if (settings != 0 && OS.GTK_VERSION < OS.VERSION (3, 10, 0)) { int [] buffer = new int [1]; OS.g_object_get (settings, OS.gtk_show_input_method_menu, buffer, 0); showInputMethod = buffer[0] != 0; @@ -342,7 +342,41 @@ } if (imItem == 0) { byte[] buffer = Converter.wcsToMbcs (null, SWT.getMessage("SWT_InputMethods"), true); - imItem = OS.gtk_image_menu_item_new_with_label (buffer); + if (OS.GTK3) { + imItem = OS.gtk_menu_item_new (); + if (imItem == 0) error (SWT.ERROR_NO_HANDLES); + int /*long*/ imageHandle = 0; + int /*long*/ labelHandle = OS.gtk_accel_label_new (buffer); + if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES); + if (OS.GTK_VERSION >= OS.VERSION (3, 16, 0)) { + OS.gtk_label_set_xalign (labelHandle, 0); + OS.gtk_widget_set_halign (labelHandle, OS.GTK_ALIGN_FILL); + } else { + OS.gtk_misc_set_alignment(labelHandle, 0, 0); + } + int /*long*/ boxHandle = gtk_box_new (OS.GTK_ORIENTATION_HORIZONTAL, false, 0); + if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES); + if (OS.SWT_PADDED_MENU_ITEMS) { + imageHandle = OS.gtk_image_new(); + if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES); + OS.gtk_image_set_pixel_size (imageHandle, 16); + if (boxHandle != 0) { + OS.gtk_container_add (boxHandle, imageHandle); + OS.gtk_widget_show (imageHandle); + } + } + if (labelHandle != 0 && boxHandle != 0) { + OS.gtk_box_pack_end (boxHandle, labelHandle, true, true, 0); + OS.gtk_widget_show (labelHandle); + } + if (boxHandle != 0) { + OS.gtk_container_add (imItem, boxHandle); + OS.gtk_widget_show (boxHandle); + } + } else { + imItem = OS.gtk_image_menu_item_new_with_label (buffer); + if (imItem == 0) error (SWT.ERROR_NO_HANDLES); + } OS.gtk_widget_show (imItem); OS.gtk_menu_shell_insert (handle, imItem, -1); } @@ -599,7 +633,7 @@ * Returns the receiver's shell. For all controls other than * shells, this simply returns the control's nearest ancestor * shell. Shells return themselves, even if they are children - * of other shells. Returns null if receiver or its ancestor + * of other shells. Returns null if receiver or its ancestor * is the application menubar. * * @return the receiver's shell or null @@ -978,6 +1012,11 @@ * </ul> */ public void setLocation (int x, int y) { + checkWidget (); + setLocation (new Point (x, y)); +} + +void setLocationInPixels (int x, int y) { checkWidget(); if ((style & (SWT.BAR | SWT.DROP_DOWN)) != 0) return; this.x = x; @@ -1010,9 +1049,14 @@ * @since 2.1 */ public void setLocation (Point location) { + checkWidget (); + setLocationInPixels (DPIUtil.autoScaleUp (location)); +} + +void setLocationInPixels (Point location) { checkWidget(); if (location == null) error (SWT.ERROR_NULL_ARGUMENT); - setLocation (location.x, location.y); + setLocationInPixels (location.x, location.y); } /** diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/MessageBox.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/MessageBox.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/MessageBox.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/MessageBox.java 2016-07-06 19:11:33.000000000 +0000 @@ -150,8 +150,9 @@ if ((style & (SWT.ICON_QUESTION)) != 0) messageType = OS.GTK_MESSAGE_QUESTION; if ((style & (SWT.ICON_ERROR)) != 0) messageType = OS.GTK_MESSAGE_ERROR; - byte [] buffer = Converter.wcsToMbcs (null, fixPercent (message), true); - handle = OS.gtk_message_dialog_new(parentHandle, dialogFlags, messageType, 0, buffer); + byte [] format = Converter.wcsToMbcs (null, "%s", true); + byte [] buffer = Converter.wcsToMbcs (null, message, true); + handle = OS.gtk_message_dialog_new(parentHandle, dialogFlags, messageType, 0, format, buffer); if (handle == 0) error(SWT.ERROR_NO_HANDLES); if (parentHandle != 0) { int /*long*/ pixbufs = OS.gtk_window_get_icon_list (parentHandle); @@ -235,20 +236,4 @@ return style; } -char[] fixPercent (String string) { - int length = string.length (); - char [] text = new char [length]; - string.getChars (0, length, text, 0); - int i = 0, j = 0; - char [] result = new char [length * 2]; - while (i < length) { - switch (text [i]) { - case '%': - result [j++] = '%'; - break; - } - result [j++] = text [i++]; - } - return result; -} } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Monitor.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Monitor.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Monitor.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Monitor.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -18,20 +18,20 @@ * @see Display * @see <a href="http://www.eclipse.org/swt/snippets/#monitor">Monitor snippets</a> * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.0 */ public final class Monitor { int /*long*/ handle; int x, y, width, height; int clientX, clientY, clientWidth, clientHeight; - + /** * Prevents uninitialized instances from being created outside the package. */ -Monitor () { +Monitor () { } - + /** * Compares the argument to the receiver, and returns true * if they represent the <em>same</em> object using a class @@ -56,24 +56,38 @@ * origin can be negative. * * @return the receiver's bounding rectangle - */ + */ public Rectangle getBounds () { return new Rectangle (x, y, width, height); } - + /** * Returns a rectangle which describes the area of the * receiver which is capable of displaying data. - * + * * @return the client area */ public Rectangle getClientArea () { return new Rectangle (clientX, clientY, clientWidth, clientHeight); } - + +void setBounds (Rectangle rect) { + x = rect.x; + y = rect.y; + width = rect.width; + height = rect.height; +} + +void setClientArea (Rectangle rect) { + clientX = rect.x; + clientY = rect.y; + clientWidth = rect.width; + clientHeight = rect.height; +} + /** - * Returns an integer hash code for the receiver. Any two - * objects that return <code>true</code> when passed to + * Returns an integer hash code for the receiver. Any two + * objects that return <code>true</code> when passed to * <code>equals</code> must return the same value for this * method. * diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/ProgressBar.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/ProgressBar.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/ProgressBar.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/ProgressBar.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -301,16 +301,18 @@ double fraction = minimum == maximum ? 1 : (double)(selection - minimum) / (maximum - minimum); OS.gtk_progress_bar_set_fraction (handle, fraction); - /* - * Feature in GTK. The progress bar does - * not redraw right away when a value is - * changed. This is not strictly incorrect - * but unexpected. The fix is to force all - * outstanding redraws to be delivered. - */ - int /*long*/ window = paintWindow (); - OS.gdk_window_process_updates (window, false); - OS.gdk_flush (); + if (!OS.GTK3) { + /* + * Feature in GTK. The progress bar does + * not redraw right away when a value is + * changed. This is not strictly incorrect + * but unexpected. The fix is to force all + * outstanding redraws to be delivered. + */ + int /*long*/ window = paintWindow (); + OS.gdk_window_process_updates (window, false); + OS.gdk_flush (); + } } void gtk_orientable_set_orientation (int /*long*/ pbar, int orientation) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/RunnableLock.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/RunnableLock.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/RunnableLock.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/RunnableLock.java 2016-07-06 19:11:33.000000000 +0000 @@ -22,7 +22,7 @@ Runnable runnable; Thread thread; Throwable throwable; - + RunnableLock (Runnable runnable) { this.runnable = runnable; } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Sash.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Sash.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Sash.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Sash.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -14,6 +14,7 @@ import org.eclipse.swt.*; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; /** @@ -120,11 +121,11 @@ } @Override -public Point computeSize (int wHint, int hHint, boolean changed) { +Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; - int border = getBorderWidth (); + int border = getBorderWidthInPixels (); int width = border * 2, height = border * 2; if ((style & SWT.HORIZONTAL) != 0) { width += DEFAULT_WIDTH; height += 3; @@ -144,7 +145,7 @@ OS.gtk_widget_set_has_window (handle, true); OS.gtk_widget_set_can_focus (handle, true); int type = (style & SWT.VERTICAL) != 0 ? OS.GDK_SB_H_DOUBLE_ARROW : OS.GDK_SB_V_DOUBLE_ARROW; - defaultCursor = OS.gdk_cursor_new (type); + defaultCursor = OS.gdk_cursor_new_for_display (OS.gdk_display_get_default(), type); } void drawBand (int x, int y, int width, int height) { @@ -192,25 +193,24 @@ lastY = y; Event event = new Event (); event.time = gdkEvent.time; - event.x = lastX; - event.y = lastY; - event.width = width; - event.height = height; + Rectangle eventRect = new Rectangle (lastX, lastY, width, height); + event.setBounds (DPIUtil.autoScaleDown (eventRect)); if ((style & SWT.SMOOTH) == 0) { event.detail = SWT.DRAG; } - if ((parent.style & SWT.MIRRORED) != 0) event.x = parent.getClientWidth () - width - event.x; + if ((parent.style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown (parent.getClientWidth () - width) - event.x; sendSelectionEvent (SWT.Selection, event, true); if (isDisposed ()) return 0; if (event.doit) { dragging = true; - lastX = event.x; - lastY = event.y; - if ((parent.style & SWT.MIRRORED) != 0) lastX = parent.getClientWidth () - width - lastX; + Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ()); + lastX = rect.x; + lastY = rect.y; + if ((parent.style & SWT.MIRRORED) != 0) lastX = parent.getClientWidth () - width - lastX; parent.update (true, (style & SWT.SMOOTH) == 0); - drawBand (lastX, event.y, width, height); + drawBand (lastX, rect.y, width, height); if ((style & SWT.SMOOTH) != 0) { - setBounds (event.x, event.y, width, height); + setBoundsInPixels (rect.x, rect.y, width, height); // widget could be disposed at this point } } @@ -233,17 +233,16 @@ int height = allocation.height; Event event = new Event (); event.time = gdkEvent.time; - event.x = lastX; - event.y = lastY; - event.width = width; - event.height = height; + Rectangle eventRect = new Rectangle (lastX, lastY, width, height); + event.setBounds (DPIUtil.autoScaleDown (eventRect)); drawBand (lastX, lastY, width, height); - if ((parent.style & SWT.MIRRORED) != 0) event.x = parent.getClientWidth () - width - event.x; + if ((parent.style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown (parent.getClientWidth () - width) - event.x; sendSelectionEvent (SWT.Selection, event, true); if (isDisposed ()) return result; if (event.doit) { if ((style & SWT.SMOOTH) != 0) { - setBounds (event.x, event.y, width, height); + Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ()); + setBoundsInPixels (rect.x, rect.y, width, height); // widget could be disposed at this point } } @@ -251,6 +250,21 @@ } @Override +int /*long*/ gtk_draw (int /*long*/ widget, int /*long*/ cairo) { + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + int /*long*/ context = OS.gtk_widget_get_style_context(widget); + GtkAllocation allocation = new GtkAllocation(); + OS.gtk_widget_get_allocation (widget, allocation); + int width = (state & ZERO_WIDTH) != 0 ? 0 : allocation.width; + int height = (state & ZERO_HEIGHT) != 0 ? 0 : allocation.height; + // We specify a 0 value for x & y as we want the whole widget to be + // colored, not some portion of it. + OS.gtk_render_background(context, cairo, 0, 0, width, height); + } + return super.gtk_draw(widget, cairo); +} + +@Override int /*long*/ gtk_focus_in_event (int /*long*/ widget, int /*long*/ event) { int /*long*/ result = super.gtk_focus_in_event (widget, event); if (result != 0) return result; @@ -311,30 +325,29 @@ /* The event must be sent because its doit flag is used. */ Event event = new Event (); event.time = gdkEvent.time; - event.x = newX; - event.y = newY; - event.width = width; - event.height = height; - if ((parent.style & SWT.MIRRORED) != 0) event.x = parent.getClientWidth () - width - event.x; + Rectangle eventRect = new Rectangle (newX, newY, width, height); + event.setBounds (DPIUtil.autoScaleDown (eventRect)); + if ((parent.style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown (parent.getClientWidth () - width) - event.x; sendSelectionEvent (SWT.Selection, event, true); if (ptrGrabResult == OS.GDK_GRAB_SUCCESS) gdk_pointer_ungrab (window, OS.GDK_CURRENT_TIME); if (isDisposed ()) break; if (event.doit) { - lastX = event.x; - lastY = event.y; + Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ()); + lastX = rect.x; + lastY = rect.y; if ((parent.style & SWT.MIRRORED) != 0) lastX = parent.getClientWidth () - width - lastX; if ((style & SWT.SMOOTH) != 0) { - setBounds (event.x, event.y, width, height); + setBoundsInPixels (rect.x, rect.y, width, height); if (isDisposed ()) break; } - int cursorX = event.x, cursorY = event.y; + int cursorX = rect.x, cursorY = rect.y; if ((style & SWT.VERTICAL) != 0) { cursorY += height / 2; } else { cursorX += width / 2; } - display.setCursorLocation (parent.toDisplay (cursorX, cursorY)); + display.setCursorLocation (parent.toDisplayInPixels (cursorX, cursorY)); } break; } @@ -385,25 +398,24 @@ Event event = new Event (); event.time = gdkEvent.time; - event.x = newX; - event.y = newY; - event.width = width; - event.height = height; + Rectangle eventRect = new Rectangle (newX, newY, width, height); + event.setBounds (DPIUtil.autoScaleDown (eventRect)); if ((style & SWT.SMOOTH) == 0) { event.detail = SWT.DRAG; } - if ((parent.style & SWT.MIRRORED) != 0) event.x = parent.getClientWidth() - width - event.x; + if ((parent.style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown (parent.getClientWidth () - width) - event.x; sendSelectionEvent (SWT.Selection, event, true); if (isDisposed ()) return 0; + Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ()); if (event.doit) { - lastX = event.x; - lastY = event.y; + lastX = rect.x; + lastY = rect.y; if ((parent.style & SWT.MIRRORED) != 0) lastX = parent.getClientWidth () - width - lastX; } parent.update (true, (style & SWT.SMOOTH) == 0); drawBand (lastX, lastY, width, height); if ((style & SWT.SMOOTH) != 0) { - setBounds (event.x, lastY, width, height); + setBoundsInPixels (rect.x, lastY, width, height); // widget could be disposed at this point } return result; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Scale.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Scale.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Scale.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Scale.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -109,7 +109,7 @@ } @Override -public Point computeSize (int wHint, int hHint, boolean changed) { +Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget(); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Scrollable.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Scrollable.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Scrollable.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Scrollable.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -13,6 +13,7 @@ import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; /** @@ -107,6 +108,12 @@ */ public Rectangle computeTrim (int x, int y, int width, int height) { checkWidget(); + Rectangle rect = DPIUtil.autoScaleUp(new Rectangle (x, y, width, height)); + return DPIUtil.autoScaleDown(computeTrimInPixels(rect.x, rect.y, rect.width, rect.height)); +} + +Rectangle computeTrimInPixels (int x, int y, int width, int height) { + checkWidget(); int border = 0; if (fixedHandle != 0) border += OS.gtk_container_get_border_width (fixedHandle); if (scrolledHandle != 0) border += OS.gtk_container_get_border_width (scrolledHandle); @@ -189,7 +196,7 @@ } @Override -public int getBorderWidth () { +int getBorderWidthInPixels () { checkWidget(); int border = 0; if (fixedHandle != 0) border += OS.gtk_container_get_border_width (fixedHandle); @@ -201,7 +208,6 @@ } return border; } - /** * Returns a rectangle which describes the area of the * receiver which is capable of displaying data (that is, @@ -218,6 +224,11 @@ */ public Rectangle getClientArea () { checkWidget (); + return DPIUtil.autoScaleDown(getClientAreaInPixels()); +} + +Rectangle getClientAreaInPixels () { + checkWidget (); forceResize (); int /*long*/ clientHandle = clientHandle (); GtkAllocation allocation = new GtkAllocation (); @@ -355,7 +366,9 @@ if (hBarHandle==0) return 0; GtkRequisition requisition = new GtkRequisition(); gtk_widget_get_preferred_size (hBarHandle, requisition); - int spacing = OS.GTK_SCROLLED_WINDOW_SCROLLBAR_SPACING(scrolledHandle); + int [] padding = new int [1]; + OS.gtk_widget_style_get(scrolledHandle, OS.scrollbar_spacing, padding, 0); + int spacing = padding[0]; return requisition.height + spacing; } @@ -389,6 +402,9 @@ int [] hsp = new int [1], vsp = new int [1]; OS.gtk_scrolled_window_get_policy (scrolledHandle, hsp, vsp); int policy = visible ? OS.GTK_POLICY_ALWAYS : OS.GTK_POLICY_NEVER; + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0) && !visible) { + policy = OS.GTK_POLICY_EXTERNAL; + } if ((bar.style & SWT.HORIZONTAL) != 0) { if (hsp [0] == policy) return false; hsp [0] = policy; @@ -491,7 +507,9 @@ if (vBarHandle == 0) return 0; GtkRequisition requisition = new GtkRequisition(); gtk_widget_get_preferred_size (vBarHandle, requisition); - int spacing = OS.GTK_SCROLLED_WINDOW_SCROLLBAR_SPACING(scrolledHandle); + int [] padding = new int [1]; + OS.gtk_widget_style_get(scrolledHandle, OS.scrollbar_spacing, padding, 0); + int spacing = padding[0]; return requisition.width + spacing; } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/ScrollBar.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/ScrollBar.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/ScrollBar.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/ScrollBar.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -14,6 +14,7 @@ import org.eclipse.swt.*; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; /** @@ -276,6 +277,7 @@ return (int) OS.gtk_adjustment_get_value (adjustmentHandle); } + /** * Returns a point describing the receiver's size. The * x coordinate of the result is the width of the receiver. @@ -291,6 +293,11 @@ */ public Point getSize () { checkWidget (); + return DPIUtil.autoScaleDown (getSizeInPixels ()); +} + +Point getSizeInPixels () { + checkWidget (); if (handle == 0) return new Point (0,0); GtkRequisition requisition = new GtkRequisition (); gtk_widget_get_preferred_size (handle, requisition); @@ -328,6 +335,11 @@ * @since 3.6 */ public Rectangle getThumbBounds () { + checkWidget (); + return DPIUtil.autoScaleDown(getThumbBoundsInPixels()); +} + +Rectangle getThumbBoundsInPixels () { checkWidget(); int [] slider_start = new int [1], slider_end = new int [1]; gtk_range_get_slider_range (handle, slider_start, slider_end); @@ -373,6 +385,11 @@ * @since 3.6 */ public Rectangle getThumbTrackBounds () { + checkWidget (); + return DPIUtil.autoScaleDown(getThumbTrackBoundsInPixels()); +} + +Rectangle getThumbTrackBoundsInPixels () { checkWidget(); int x = 0, y = 0, width, height; int[] has_stepper = new int[1]; @@ -453,9 +470,9 @@ int [] hsp = new int [1], vsp = new int [1]; OS.gtk_scrolled_window_get_policy (scrolledHandle, hsp, vsp); if ((style & SWT.HORIZONTAL) != 0) { - return hsp [0] != OS.GTK_POLICY_NEVER && OS.gtk_widget_get_visible (handle); + return hsp [0] != OS.GTK_POLICY_NEVER && hsp[0] != OS.GTK_POLICY_EXTERNAL && OS.gtk_widget_get_visible (handle); } else { - return vsp [0] != OS.GTK_POLICY_NEVER && OS.gtk_widget_get_visible (handle); + return vsp [0] != OS.GTK_POLICY_NEVER && vsp[0] != OS.GTK_POLICY_EXTERNAL && OS.gtk_widget_get_visible (handle); } } @@ -508,6 +525,9 @@ if (!dragSent) detail = OS.GTK_SCROLL_NONE; sendSelectionEvent (SWT.Selection, event, false); parent.updateScrollBarValue (this); + if (OS.GTK3) { + OS.gtk_widget_queue_draw(parent.handle); + } return 0; } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Shell.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Shell.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Shell.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Shell.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -82,7 +82,7 @@ * downgraded to <code>APPLICATION_MODAL</code>. * <dl> * <dt><b>Styles:</b></dt> - * <dd>BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE, ON_TOP, TOOL, SHEET</dd> + * <dd>BORDER, CLOSE, MIN, MAX, NO_MOVE, NO_TRIM, RESIZE, TITLE, ON_TOP, TOOL, SHEET</dd> * <dd>APPLICATION_MODAL, MODELESS, PRIMARY_MODAL, SYSTEM_MODAL</dd> * <dt><b>Events:</b></dt> * <dd>Activate, Close, Deactivate, Deiconify, Iconify</dd> @@ -172,6 +172,7 @@ * @see SWT#TITLE * @see SWT#TOOL * @see SWT#NO_TRIM + * @see SWT#NO_MOVE * @see SWT#SHELL_TRIM * @see SWT#DIALOG_TRIM * @see SWT#ON_TOP @@ -244,6 +245,7 @@ * @see SWT#TITLE * @see SWT#TOOL * @see SWT#NO_TRIM + * @see SWT#NO_MOVE * @see SWT#SHELL_TRIM * @see SWT#DIALOG_TRIM * @see SWT#ON_TOP @@ -348,6 +350,7 @@ * @see SWT#RESIZE * @see SWT#TITLE * @see SWT#NO_TRIM + * @see SWT#NO_MOVE * @see SWT#SHELL_TRIM * @see SWT#DIALOG_TRIM * @see SWT#ON_TOP @@ -495,31 +498,43 @@ hasResize = (style & SWT.RESIZE) != 0; hasBorder = (style & SWT.BORDER) != 0; } + int trimStyle; if (hasTitle) { - if (hasResize) { - display.titleResizeTrimWidth = trimWidth; - display.titleResizeTrimHeight = trimHeight; - return; - } - if (hasBorder) { - display.titleBorderTrimWidth = trimWidth; - display.titleBorderTrimHeight = trimHeight; - return; + if (hasResize) { + trimStyle = Display.TRIM_TITLE_RESIZE; + } else if (hasBorder) { + trimStyle = Display.TRIM_TITLE_BORDER; + } else { + trimStyle = Display.TRIM_TITLE; } - display.titleTrimWidth = trimWidth; - display.titleTrimHeight = trimHeight; - return; - } - if (hasResize) { - display.resizeTrimWidth = trimWidth; - display.resizeTrimHeight = trimHeight; - return; + } else if (hasResize) { + trimStyle = Display.TRIM_RESIZE; + } else if (hasBorder) { + trimStyle = Display.TRIM_BORDER; + } else { + trimStyle = Display.TRIM_NONE; } - if (hasBorder) { - display.borderTrimWidth = trimWidth; - display.borderTrimHeight = trimHeight; - return; + if (OS.GTK3) { + /* + * The workaround for bug 445900 seems to cause problems for some + * users on GTK2, see bug 492695. The fix is to only adjust the + * shell size on GTK3. + */ + Rectangle bounds = getBoundsInPixels(); + int widthAdjustment = display.trimWidths[trimStyle] - trimWidth; + int heightAdjustment = display.trimHeights[trimStyle] - trimHeight; + if (widthAdjustment == 0 && heightAdjustment == 0) return; + + bounds.width += widthAdjustment; + bounds.height += heightAdjustment; + oldWidth += widthAdjustment; + oldHeight += heightAdjustment; + if (!getMaximized()) { + resizeBounds (width + widthAdjustment, height + heightAdjustment, false); + } } + display.trimWidths[trimStyle] = trimWidth; + display.trimHeights[trimStyle] = trimHeight; } void bringToTop (boolean force) { @@ -597,11 +612,11 @@ void center () { if (parent == null) return; - Rectangle rect = getBounds (); - Rectangle parentRect = display.map (parent, null, parent.getClientArea()); + Rectangle rect = getBoundsInPixels (); + Rectangle parentRect = display.mapInPixels (parent, null, parent.getClientAreaInPixels()); int x = Math.max (parentRect.x, parentRect.x + (parentRect.width - rect.width) / 2); int y = Math.max (parentRect.y, parentRect.y + (parentRect.height - rect.height) / 2); - Rectangle monitorRect = parent.getMonitor ().getClientArea(); + Rectangle monitorRect = DPIUtil.autoScaleUp(parent.getMonitor ().getClientArea()); if (x + rect.width > monitorRect.x + monitorRect.width) { x = Math.max (monitorRect.x, monitorRect.x + monitorRect.width - rect.width); } else { @@ -612,7 +627,7 @@ } else { y = Math.max (y, monitorRect.y); } - setLocation (x, y); + setLocationInPixels (x, y); } @Override @@ -656,9 +671,9 @@ } @Override -public Rectangle computeTrim (int x, int y, int width, int height) { +Rectangle computeTrimInPixels (int x, int y, int width, int height) { checkWidget(); - Rectangle trim = super.computeTrim (x, y, width, height); + Rectangle trim = super.computeTrimInPixels (x, y, width, height); int border = 0; if ((style & (SWT.NO_TRIM | SWT.BORDER | SWT.SHELL_TRIM)) == 0) { border = OS.gtk_container_get_border_width (shellHandle); @@ -697,8 +712,12 @@ if (parent != null) { OS.gtk_window_set_transient_for (shellHandle, parent.topHandle ()); OS.gtk_window_set_destroy_with_parent (shellHandle, true); - OS.gtk_window_set_skip_taskbar_hint(shellHandle, true); - + // if child shells are minimizable, we want them to have a + // taskbar icon, so they can be unminimized + if ((style & SWT.MIN) == 0) { + OS.gtk_window_set_skip_taskbar_hint(shellHandle, true); + } + /* * For systems running Metacity, by applying the dialog type hint * to a window only the close button can be placed on the title bar. @@ -725,7 +744,9 @@ if ((style & (SWT.NO_TRIM | SWT.BORDER | SWT.SHELL_TRIM)) == 0) { OS.gtk_container_set_border_width (shellHandle, 1); if (OS.GTK3) { - OS.gtk_widget_override_background_color (shellHandle, OS.GTK_STATE_FLAG_NORMAL, new GdkRGBA()); + if (OS.GTK_VERSION < OS.VERSION (3, 16, 0)) { + OS.gtk_widget_override_background_color (shellHandle, OS.GTK_STATE_FLAG_NORMAL, new GdkRGBA()); + } } else { GdkColor color = new GdkColor (); OS.gtk_style_get_black (OS.gtk_widget_get_style (shellHandle), color); @@ -899,6 +920,11 @@ } @Override +public void requestLayout () { + layout (null, SWT.DEFER); +} + +@Override int /*long*/ topHandle () { return shellHandle; } @@ -1037,7 +1063,7 @@ } @Override -public Point getLocation () { +Point getLocationInPixels () { checkWidget (); int [] x = new int [1], y = new int [1]; OS.gtk_window_get_position (shellHandle, x,y); @@ -1067,6 +1093,11 @@ */ public Point getMinimumSize () { checkWidget (); + return DPIUtil.autoScaleDown (getMinimumSizeInPixels ()); +} + +Point getMinimumSizeInPixels () { + checkWidget (); int width = Math.max (1, minWidth + trimWidth ()); int height = Math.max (1, minHeight + trimHeight ()); return new Point (width, height); @@ -1118,7 +1149,7 @@ } @Override -public Point getSize () { +Point getSizeInPixels () { checkWidget (); GtkAllocation allocation = new GtkAllocation (); OS.gtk_widget_get_allocation (vboxHandle, allocation); @@ -1256,7 +1287,7 @@ if (!isVisible ()) { return 0; //We shouldn't handle move/resize events if shell is hidden. } - + if (!moved || oldX != x [0] || oldY != y [0]) { moved = true; oldX = x [0]; @@ -1470,7 +1501,7 @@ int mode = getResizeMode (gdkEvent.x, gdkEvent.y); if (mode != display.resizeMode) { int /*long*/ window = gtk_widget_get_window (shellHandle); - int /*long*/ cursor = OS.gdk_cursor_new (mode); + int /*long*/ cursor = OS.gdk_cursor_new_for_display (OS.gdk_display_get_default(), mode); OS.gdk_window_set_cursor (window, cursor); gdk_cursor_unref (cursor); display.resizeMode = mode; @@ -1521,10 +1552,15 @@ OS.gtk_widget_get_allocation (shellHandle, widgetAllocation); int width = widgetAllocation.width; int height = widgetAllocation.height; - if (!resized || oldWidth != width || oldHeight != height) { + + // Bug 474235: on Wayland gtk_size_allocate() is called more frequently, causing an + // infinitely recursive resize call. This causes non-resizable Shells/Dialogs to + // crash. Fix: only call resizeBounds() on resizable Shells. + if ((!resized || oldWidth != width || oldHeight != height) + && (OS.GTK3 && !OS.isX11() ? ((style & SWT.RESIZE) != 0) : true)) { //Wayland oldWidth = width; oldHeight = height; - resizeBounds (width, height, true); + resizeBounds (width, height, true); //this is called to resize child widgets when the shell is resized. } return 0; } @@ -1560,7 +1596,7 @@ * kind of border is requested. */ if ((style & SWT.RESIZE) != 0) decorations |= OS.GDK_DECOR_BORDER; - functions |= OS.GDK_FUNC_MOVE; + if ((style & SWT.NO_MOVE) == 0) functions |= OS.GDK_FUNC_MOVE; } OS.gdk_window_set_decorations (window, decorations); @@ -1571,6 +1607,10 @@ * decorations) are ignored by the window manager. */ OS.gdk_window_set_functions(window, functions); + } else if ((style & SWT.NO_MOVE) != 0) { + // if the GDK_FUNC_ALL bit is present, all the other style + // bits specified as a parameter will be removed from the window + OS.gdk_window_set_functions (window, OS.GDK_FUNC_ALL | OS.GDK_FUNC_MOVE); } if ((style & SWT.ON_TOP) != 0) { OS.gdk_window_set_override_redirect (window, true); @@ -1624,7 +1664,28 @@ Shell.class.cast(getParent()).open(); setVisible (true); if (isDisposed ()) return; - if (!restoreFocus () && !traverseGroup (true)) setFocus (); + /* + * When no widget has been given focus, or another push button has focus, + * give focus to the default button. This avoids overriding the default + * button. + */ + boolean restored = restoreFocus (); + if (!restored) { + restored = traverseGroup (true); + } + if (restored) { + Control focusControl = display.getFocusControl (); + if (focusControl instanceof Button && (focusControl.style & SWT.PUSH) != 0) { + restored = false; + } + } + if (!restored) { + if (defaultButton != null && !defaultButton.isDisposed ()) { + defaultButton.setFocus (); + } else { + setFocus (); + } + } } @Override @@ -1810,6 +1871,10 @@ @Override int setBounds (int x, int y, int width, int height, boolean move, boolean resize) { + // bug in GTK2 crashes JVM, in GTK3 the new shell only. See bug 472743 + width = Math.min(width, (2 << 14) - 1); + height = Math.min(height, (2 << 14) - 1); + if (fullScreen) setFullScreen (false); /* * Bug in GTK. When either of the location or size of @@ -1819,7 +1884,7 @@ * anything different from the current bounds. */ if (getMaximized ()) { - Rectangle rect = getBounds (); + Rectangle rect = getBoundsInPixels (); boolean sameOrigin = !move || (rect.x == x && rect.y == y); boolean sameExtent = !resize || (rect.width == width && rect.height == height); if (sameOrigin && sameExtent) return 0; @@ -1830,6 +1895,21 @@ int [] x_pos = new int [1], y_pos = new int [1]; OS.gtk_window_get_position (shellHandle, x_pos, y_pos); OS.gtk_window_move (shellHandle, x, y); + /* + * Bug in GTK: gtk_window_get_position () is not always up-to-date right after + * gtk_window_move (). The random delays cause problems like bug 445900. + * + * The workaround is to wait for the position change to be processed. + * The limit 1000 is an experimental value. I've seen cases where about 200 + * iterations were necessary. + */ + for (int i = 0; i < 1000; i++) { + int [] x2_pos = new int [1], y2_pos = new int [1]; + OS.gtk_window_get_position (shellHandle, x2_pos, y2_pos); + if (x2_pos[0] == x && y2_pos[0] == y) { + break; + } + } if (x_pos [0] != x || y_pos [0] != y) { moved = true; oldX = x; @@ -1900,7 +1980,7 @@ int /*long*/ parentHandle = shellHandle; OS.gtk_widget_realize (parentHandle); int /*long*/ window = gtk_widget_get_window (parentHandle); - Rectangle rect = getBounds (); + Rectangle rect = getBoundsInPixels (); GdkWindowAttr attributes = new GdkWindowAttr (); attributes.width = rect.width; attributes.height = rect.height; @@ -2088,6 +2168,11 @@ */ public void setMinimumSize (int width, int height) { checkWidget (); + setMinimumSize (new Point (width, height)); +} + +void setMinimumSizeInPixels (int width, int height) { + checkWidget (); GdkGeometry geometry = new GdkGeometry (); minWidth = geometry.min_width = Math.max (width, trimWidth ()) - trimWidth (); minHeight = geometry.min_height = Math.max (height, trimHeight ()) - trimHeight (); @@ -2113,8 +2198,13 @@ */ public void setMinimumSize (Point size) { checkWidget (); + setMinimumSizeInPixels (DPIUtil.autoScaleUp (size)); +} + +void setMinimumSizeInPixels (Point size) { + checkWidget (); if (size == null) error (SWT.ERROR_NULL_ARGUMENT); - setMinimumSize (size.x, size.y); + setMinimumSizeInPixels (size.x, size.y); } /** @@ -2158,7 +2248,6 @@ * </ul> * * @since 3.0 - * */ @Override public void setRegion (Region region) { @@ -2204,7 +2293,7 @@ int [] nRects = new int [1]; int /*long*/ [] rects = new int /*long*/ [1]; gdk_region_get_rectangles (rgn, rects, nRects); - Rectangle bounds = region.getBounds (); + Rectangle bounds = DPIUtil.autoScaleUp(region.getBounds ()); GdkRectangle rect = new GdkRectangle (); for (int i = 0; i < nRects [0]; i++) { OS.memmove (rect, rects[0] + (i * GdkRectangle.sizeof), GdkRectangle.sizeof); @@ -2244,9 +2333,9 @@ @Override public void setVisible (boolean visible) { checkWidget(); - + if (moved) { //fix shell location if it was moved. - setLocation(oldX, oldY); + setLocationInPixels(oldX, oldY); } int mask = SWT.PRIMARY_MODAL | SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL; if ((style & mask) != 0) { @@ -2327,7 +2416,7 @@ opened = true; if (!moved) { moved = true; - Point location = getLocation(); + Point location = getLocationInPixels(); oldX = location.x; oldY = location.y; sendEvent (SWT.Move); @@ -2335,7 +2424,7 @@ } if (!resized) { resized = true; - Point size = getSize (); + Point size = getSizeInPixels (); oldWidth = size.x - trimWidth (); oldHeight = size.y - trimHeight (); sendEvent (SWT.Resize); @@ -2444,13 +2533,13 @@ hasResize = (style & SWT.RESIZE) != 0; hasBorder = (style & SWT.BORDER) != 0; if (hasTitle) { - if (hasResize) return display.titleResizeTrimHeight; - if (hasBorder) return display.titleBorderTrimHeight; - return display.titleTrimHeight; - } - if (hasResize) return display.resizeTrimHeight; - if (hasBorder) return display.borderTrimHeight; - return 0; + if (hasResize) return display.trimHeights [Display.TRIM_TITLE_RESIZE]; + if (hasBorder) return display.trimHeights [Display.TRIM_TITLE_BORDER]; + return display.trimHeights [Display.TRIM_TITLE]; + } + if (hasResize) return display.trimHeights [Display.TRIM_RESIZE]; + if (hasBorder) return display.trimHeights [Display.TRIM_BORDER]; + return display.trimHeights [Display.TRIM_NONE]; } int trimWidth () { @@ -2461,13 +2550,13 @@ hasResize = (style & SWT.RESIZE) != 0; hasBorder = (style & SWT.BORDER) != 0; if (hasTitle) { - if (hasResize) return display.titleResizeTrimWidth; - if (hasBorder) return display.titleBorderTrimWidth; - return display.titleTrimWidth; - } - if (hasResize) return display.resizeTrimWidth; - if (hasBorder) return display.borderTrimWidth; - return 0; + if (hasResize) return display.trimWidths [Display.TRIM_TITLE_RESIZE]; + if (hasBorder) return display.trimWidths [Display.TRIM_TITLE_BORDER]; + return display.trimWidths [Display.TRIM_TITLE]; + } + if (hasResize) return display.trimWidths [Display.TRIM_RESIZE]; + if (hasBorder) return display.trimWidths [Display.TRIM_BORDER]; + return display.trimWidths [Display.TRIM_NONE]; } void updateModal () { @@ -2604,7 +2693,7 @@ } @Override -public Rectangle getBounds () { +Rectangle getBoundsInPixels () { checkWidget (); int [] x = new int [1], y = new int [1]; OS.gtk_window_get_position (shellHandle, x, y); @@ -2701,7 +2790,7 @@ * window trims etc. from the window manager. That's why getLocation () * is not safe to use for coordinate mappings after the shell has been made visible. */ - return getLocation (); + return getLocationInPixels (); } return super.getWindowOrigin( ); } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Slider.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Slider.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Slider.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Slider.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -264,7 +264,7 @@ } @Override -public Point computeSize (int wHint, int hHint, boolean changed) { +Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget(); OS.gtk_widget_realize(handle); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Spinner.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Spinner.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Spinner.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Spinner.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -65,6 +65,10 @@ static { LIMIT = 0x7FFFFFFF; } + /* Spinner uses non-standard CSS to set its background color, so we need + * a global variable to keep track of its background color. + */ + GdkRGBA background; /** * Constructs a new instance of this class given its parent @@ -200,7 +204,7 @@ } @Override -public Point computeSize (int wHint, int hHint, boolean changed) { +Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; @@ -229,7 +233,6 @@ byte [] buffer2 = new byte [length]; OS.memmove (buffer2, ptr, length); OS.pango_layout_set_text (layout, buffer1, buffer1.length); - OS.pango_layout_set_text (layout, buffer2, buffer2.length); int width, height = 0 ; OS.gtk_widget_realize (handle); if (OS.GTK3) { @@ -243,21 +246,30 @@ width = wHint == SWT.DEFAULT ? w [0] : wHint; height = hHint == SWT.DEFAULT ? h [0] : hHint; } - Rectangle trim = computeTrim (0, 0, width, height); + OS.pango_layout_set_text (layout, buffer2, buffer2.length); + Rectangle trim = computeTrimInPixels (0, 0, width, height); return new Point (trim.width, trim.height); } @Override -public Rectangle computeTrim (int x, int y, int width, int height) { +Rectangle computeTrimInPixels (int x, int y, int width, int height) { checkWidget (); int xborder = 0, yborder = 0; - Rectangle trim = super.computeTrim (x, y, width, height); + Rectangle trim = super.computeTrimInPixels (x, y, width, height); if (OS.GTK3) { GtkBorder tmp = new GtkBorder(); int /*long*/ context = OS.gtk_widget_get_style_context (handle); - OS.gtk_style_context_get_padding (context, OS.GTK_STATE_FLAG_NORMAL, tmp); + if (OS.GTK_VERSION < OS.VERSION(3, 18, 0)) { + OS.gtk_style_context_get_padding (context, OS.GTK_STATE_FLAG_NORMAL, tmp); + } else { + OS.gtk_style_context_get_padding (context, OS.gtk_widget_get_state_flags(handle), tmp); + } if ((style & SWT.BORDER) != 0) { - OS.gtk_style_context_get_border (context, OS.GTK_STATE_FLAG_NORMAL, tmp); + if (OS.GTK_VERSION < OS.VERSION(3, 18, 0)) { + OS.gtk_style_context_get_border (context, OS.GTK_STATE_FLAG_NORMAL, tmp); + } else { + OS.gtk_style_context_get_border (context, OS.gtk_widget_get_state_flags(handle), tmp); + } trim.x -= tmp.left; trim.y -= tmp.top; trim.width += tmp.left + tmp.right; @@ -322,7 +334,9 @@ if (handle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_container_add (fixedHandle, handle); OS.gtk_editable_set_editable (handle, (style & SWT.READ_ONLY) == 0); - OS.gtk_entry_set_has_frame (handle, (style & SWT.BORDER) != 0); + if (OS.GTK_VERSION <= OS.VERSION(3, 20, 0)) { + OS.gtk_entry_set_has_frame (handle, (style & SWT.BORDER) != 0); + } OS.gtk_spin_button_set_wrap (handle, (style & SWT.WRAP) != 0); if (OS.GTK3) { imContext = OS.imContextLast(); @@ -408,7 +422,7 @@ } @Override -public int getBorderWidth () { +int getBorderWidthInPixels () { checkWidget(); if ((this.style & SWT.BORDER) != 0) { return getThickness (handle).x; @@ -916,7 +930,21 @@ } @Override +GdkColor getContextBackground () { + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + if (background != null) { + return display.toGdkColor (background); + } else { + return display.COLOR_WIDGET_BACKGROUND; + } + } else { + return super.getContextBackground (); + } +} + +@Override void setBackgroundColor (int /*long*/ context, int /*long*/ handle, GdkRGBA rgba) { + background = rgba; setBackgroundColorGradient (context, handle, rgba); } @@ -931,14 +959,22 @@ @Override void setCursor (int /*long*/ cursor) { int /*long*/ defaultCursor = 0; - if (cursor == 0) defaultCursor = OS.gdk_cursor_new (OS.GDK_XTERM); + if (cursor == 0) defaultCursor = OS.gdk_cursor_new_for_display (OS.gdk_display_get_default(), OS.GDK_XTERM); super.setCursor (cursor != 0 ? cursor : defaultCursor); if (cursor == 0) gdk_cursor_unref (defaultCursor); } @Override void setForegroundColor (GdkColor color) { - setForegroundColor (handle, color, false); + if (OS.GTK_VERSION >= OS.VERSION (3, 16, 0)) { + GdkRGBA rgba = null; + if (color != null) { + rgba = display.toGdkRGBA (color); + } + setForegroundColor (handle, rgba); + } else { + setForegroundColor (handle, color, false); + } } /** diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Synchronizer.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Synchronizer.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Synchronizer.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Synchronizer.java 2016-07-06 19:11:33.000000000 +0000 @@ -10,10 +10,8 @@ *******************************************************************************/ package org.eclipse.swt.widgets; - import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; -import org.eclipse.swt.internal.*; /** * Instances of this class provide synchronization support @@ -55,6 +53,55 @@ this.display = display; } +/** + * Removes all pending events from the receiver and inserts them into the beginning of the given + * synchronizer's queue + * + * @param toReceiveTheEvents the synchronizer that will receive the events + */ +void moveAllEventsTo (Synchronizer toReceiveTheEvents) { + RunnableLock[] oldMessages; + int oldMessageCount; + synchronized (messageLock) { + oldMessages = messages; + messages = null; + oldMessageCount = messageCount; + messageCount = 0; + } + toReceiveTheEvents.addFirst(oldMessages, oldMessageCount); +} + +/** + * Adds the given events to the beginning of the message queue, to + * be processed in order. + * + * @param toAdd events to add. Permits null if and only if numToAdd is 0. + * @param numToAdd number of events to add from the beginning of the given array. + */ +void addFirst (RunnableLock[] toAdd, int numToAdd) { + if (numToAdd <= 0) { + return; + } + boolean wake = false; + synchronized (messageLock) { + int nextSize = messageCount + Math.max(numToAdd, GROW_SIZE); + if (messages == null) + messages = new RunnableLock[nextSize]; + if (messages.length < messageCount + numToAdd) { + RunnableLock[] newMessages = new RunnableLock[nextSize]; + System.arraycopy(messages, 0, newMessages, numToAdd, messageCount); + messages = newMessages; + } else { + System.arraycopy(messages, 0, messages, numToAdd, messageCount); + } + System.arraycopy(toAdd, 0, messages, 0, numToAdd); + wake = (messageCount == 0); + messageCount += numToAdd; + } + if (wake) + display.wakeThread(); +} + void addLast (RunnableLock lock) { boolean wake = false; synchronized (messageLock) { @@ -202,7 +249,7 @@ } } if (interrupted) { - Compatibility.interrupt(); + Thread.currentThread().interrupt(); } if (lock.throwable != null) { SWT.error (SWT.ERROR_FAILED_EXEC, lock.throwable); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/TabFolder.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/TabFolder.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/TabFolder.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/TabFolder.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -48,6 +48,43 @@ * @noextend This class is not intended to be subclassed by clients. */ public class TabFolder extends Composite { + /* + * Implementation note (see bug 454936, bug 480794): + * + * Architecture Change on GTK3: + * In TabItem#setControl(Control), we reparent the child to be a child of the 'tab' + * rather than tabfolder's parent swtFixed container. + * Note, this reparenting is only on the GTK side, not on the SWT side. + * + * GTK2 and GTK3 child nesting behaviour differs now. + * GTK2: + * swtFixed + * |-- GtkNoteBook + * | |-- tabLabel1 + * | |-- tabLabel2 + * |-- swtFixed (child1) //child is sibling of Notebook + * |-- swtFixed (child2) + * + * GTK3+: + * swtFixed + * |-- GtkNoteBook + * |-- tabLabel1 + * |-- tabLabel2 + * |-- pageHandle (tabItem1) + * |-- child1 //child now child of Notebook.pageHandle. + * |-- pageHandle (tabItem2) + * |-- child1 + * + * This changes the hierarchy so that children are beneath gtkNotebook (as oppose to + * being siblings) and thus fixes DND and background color issues. + * In gtk2, reparenting doesn't function properly (tab content appear blank), + * so this is a gtk3-specific behavior. + * + * Note about the reason for reparenting: + * Reparenting (as opposed to adding widget to a tab in the first place) is necessary + * because the SWT API allows situation where you create a child control before you create a TabItem. + */ + TabItem [] items; ImageList imageList; @@ -57,7 +94,7 @@ * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -152,9 +189,9 @@ } @Override -public Point computeSize (int wHint, int hHint, boolean changed) { +Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); - Point size = super.computeSize (wHint, hHint, changed); + Point size = super.computeSizeInPixels (wHint, hHint, changed); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; boolean scrollable = OS.gtk_notebook_get_scrollable (handle); @@ -172,7 +209,7 @@ } @Override -public Rectangle computeTrim (int x, int y, int width, int height) { +Rectangle computeTrimInPixels (int x, int y, int width, int height) { checkWidget(); forceResize (); int /*long*/ clientHandle = clientHandle (); @@ -195,8 +232,8 @@ } @Override -public Rectangle getClientArea () { - Rectangle clientRectangle = super.getClientArea (); +Rectangle getClientAreaInPixels () { + Rectangle clientRectangle = super.getClientAreaInPixels (); if (OS.GTK3) { /* @@ -315,12 +352,12 @@ if (newIndex != -1) { Control control = items [newIndex].getControl (); if (control != null && !control.isDisposed ()) { - control.setBounds (getClientArea()); + control.setBoundsInPixels (getClientAreaInPixels()); control.setVisible (true); } Event event = new Event (); event.item = items [newIndex]; - sendSelectionEvent (SWT.Selection, event, true); + sendSelectionEvent (SWT.Selection, event, true); // the widget could be destroyed at this point } } @@ -330,7 +367,50 @@ int /*long*/ eventHandle () { return handle; } - + +@Override +Control[] _getChildren() { + Control [] directChildren = super._getChildren (); + if (OS.GTK3) { + int directCount = directChildren.length; + int count = items == null ? 0 : items.length; + Control [] children = new Control [count + directCount]; + int i = 0; + for (int j = 0; j < count; j++) { + TabItem tabItem = items[j]; + if (tabItem != null) { + int /*long*/ parentHandle = tabItem.pageHandle; + int /*long*/ list = OS.gtk_container_get_children (parentHandle); + if (list != 0) { + int /*long*/ handle = OS.g_list_data (list); + if (handle != 0) { + Widget widget = display.getWidget (handle); + if (widget != null && widget != this) { + if (widget instanceof Control) { + children [i++] = (Control) widget; + } + } + } + OS.g_list_free (list); + } + } + } + if (i == count + directCount) return children; + Control [] newChildren; + if (i == count) { + newChildren = children; + } else { + newChildren = new Control [i + directCount]; + System.arraycopy (children, 0, newChildren, 0, i); + } + System.arraycopy (directChildren, 0, newChildren, i, directCount); + return newChildren; + + } else { + return directChildren; + } +} + /** * Returns the item at the given, zero-relative index in the * receiver. Throws an exception if the index is out of range. @@ -348,7 +428,7 @@ */ public TabItem getItem (int index) { checkWidget(); - if (!(0 <= index && index < getItemCount())) error (SWT.ERROR_INVALID_RANGE); + if (!(0 <= index && index < getItemCount())) error (SWT.ERROR_INVALID_RANGE); int /*long*/ list = OS.gtk_container_get_children (handle); if (list == 0) error (SWT.ERROR_CANNOT_GET_ITEM); int itemCount = OS.g_list_length (list); @@ -372,7 +452,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.4 */ public TabItem getItem(Point point) { @@ -411,11 +491,11 @@ /** * Returns an array of <code>TabItem</code>s which are the items - * in the receiver. + * in the receiver. * <p> * Note: This is not the actual structure used by the receiver * to maintain its list of items, so modifying the array will - * not affect the receiver. + * not affect the receiver. * </p> * * @return the items in the receiver @@ -440,7 +520,7 @@ * <p> * Note: This is not the actual structure used by the receiver * to maintain its selection, so modifying the array will - * not affect the receiver. + * not affect the receiver. * </p> * @return an array representing the selection * @@ -485,11 +565,13 @@ if (control != null && !control.isDisposed ()) { control.setVisible (false); } + } else { + return 0; } TabItem item = items [(int)/*64*/page_num]; Control control = item.getControl (); if (control != null && !control.isDisposed ()) { - control.setBounds(getClientArea()); + control.setBoundsInPixels(getClientAreaInPixels()); control.setVisible (true); } Event event = new Event(); @@ -506,7 +588,7 @@ /** * Searches the receiver's list starting at the first item - * (index 0) until an item is found that is equal to the + * (index 0) until an item is found that is equal to the * argument, and returns the index of that item. If no item * is found, returns -1. * @@ -536,14 +618,7 @@ @Override Point minimumSize (int wHint, int hHint, boolean flushCache) { - Control [] children; - if (OS.GTK3) { - //We want the 'Tabcontents' rather than - //what's nested under the main swtFixed. - children = _getChildren (clientHandle ()); - } else { - children = _getChildren (); - } + Control [] children = _getChildren (); int width = 0, height = 0; for (int i=0; i<children.length; i++) { Control child = children [i]; @@ -559,11 +634,15 @@ index++; } if (index == count) { - Rectangle rect = child.getBounds (); + Rectangle rect = DPIUtil.autoScaleUp(child.getBounds ()); width = Math.max (width, rect.x + rect.width); height = Math.max (height, rect.y + rect.height); } else { - Point size = child.computeSize (wHint, hHint, flushCache); + /* + * Since computeSize can be overridden by subclasses, we cannot + * call computeSizeInPixels directly. + */ + Point size = DPIUtil.autoScaleUp(child.computeSize (DPIUtil.autoScaleDown(wHint), DPIUtil.autoScaleDown(hHint), flushCache)); width = Math.max (width, size.x); height = Math.max (height, size.y); } @@ -644,7 +723,7 @@ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); if (eventTable == null) return; eventTable.unhook (SWT.Selection, listener); - eventTable.unhook (SWT.DefaultSelection,listener); + eventTable.unhook (SWT.DefaultSelection,listener); } @Override @@ -664,6 +743,24 @@ } @Override +void setBackgroundColor (int /*long*/ context, int /*long*/ handle, GdkRGBA rgba) { + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + // Form background string + String name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "notebook header" : "GtkNotebook.header"; + String css = name + " {background-color: " + display.gtk_rgba_to_css_string (rgba) + ";}"; + + // Cache background + cssBackground = css; + + // Apply background color and any cached foreground color + String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND); + gtk_css_provider_load_from_css (context, finalCss); + } else { + OS.gtk_widget_override_background_color (handle, OS.GTK_STATE_FLAG_NORMAL, rgba); + } +} + +@Override int setBounds (int x, int y, int width, int height, boolean move, boolean resize) { int result = super.setBounds (x, y, width, height, move, resize); if ((result & RESIZED) != 0) { @@ -672,7 +769,7 @@ TabItem item = items [index]; Control control = item.control; if (control != null && !control.isDisposed ()) { - control.setBounds (getClientArea ()); + control.setBoundsInPixels (getClientAreaInPixels ()); } } } @@ -712,7 +809,7 @@ } /** - * Selects the item at the given zero-relative index in the receiver. + * Selects the item at the given zero-relative index in the receiver. * If the item at the index was already selected, it remains selected. * The current selection is first cleared, then the new items are * selected. Indices that are out of range are ignored. @@ -749,7 +846,7 @@ TabItem item = items [newIndex]; Control control = item.control; if (control != null && !control.isDisposed ()) { - control.setBounds (getClientArea ()); + control.setBoundsInPixels (getClientAreaInPixels ()); control.setVisible (true); } if (notify) { @@ -774,7 +871,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.2 */ public void setSelection (TabItem item) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/TabItem.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/TabItem.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/TabItem.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/TabItem.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -12,9 +12,9 @@ import org.eclipse.swt.*; +import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; -import org.eclipse.swt.graphics.*; /** * Instances of this class represent a selectable user interface object @@ -34,7 +34,7 @@ * @noextend This class is not intended to be subclassed by clients. */ public class TabItem extends Item { - int /*long*/ labelHandle, imageHandle, pageHandle; + int /*long*/ labelHandle, imageHandle, pageHandle, provider; Control control; TabFolder parent; String toolTipText; @@ -153,6 +153,11 @@ * @since 3.4 */ public Rectangle getBounds () { + checkWidget (); + return DPIUtil.autoScaleDown (getBoundsInPixels ()); +} + +Rectangle getBoundsInPixels () { checkWidget(); GtkAllocation allocation = new GtkAllocation (); OS.gtk_widget_get_allocation (handle, allocation); @@ -288,42 +293,7 @@ } if (control != null && OS.GTK3) { - /* - * Bug 454936 (see also other 454936 references in TabFolder) - * Architecture Fix: - * We reparent the child to be a child of the 'tab' rather than tabfolder's parent swtFixed container. - * Note, this reparenting is only on the GTK side, not on the SWT side. - * - * Note, GTK2 and GTK3 child nesting behaviour is different now. - * GTK2: - * swtFixed - * |-- GtkNoteBook - * | |-- tabLabel1 - * | |-- tabLabel2 - * |-- swtFixed (child1) //child is sibling of Notebook - * |-- swtFixed (child2) - * - * GTK3+: - * swtFixed - * |-- GtkNoteBook - * |-- tabLabel1 - * |-- tabLabel2 - * |-- swtFixed (child1) //child now child of Notebook. - * |-- swtFixed (child2) - * - * This corrects the hierarchy so that children are beneath gtkNotebook (as oppose to - * being siblings) and thus fixes DND and background color issues. - * In gtk2, reparenting doesn't function properly (tab content appear blank), - * so this is a gtk3-specific behavior. - * - * Note about the reason for reparenting: - * Reparenting (as oppose to adding widget to a tab in the first place) is neccessary - * because you can have a situation where you create a widget before you create a tab. e.g - * TabFolder tabFolder = new TabFolder(shell, 0); - * Composite composite = new Composite(tabFolder, 0); - * TabItem tabItem = new TabItem(tabFolder, 0); - * tabitem.setControl(composite); - */ + // See implementation note about bug 454936 at the start of TabFolder. OS.gtk_widget_reparent (control.topHandle (), pageHandle); } @@ -341,7 +311,7 @@ } } if (newControl != null) { - newControl.setBounds (parent.getClientArea ()); + newControl.setBoundsInPixels (parent.getClientAreaInPixels ()); newControl.setVisible (true); } @@ -356,8 +326,47 @@ void setForegroundColor (GdkColor color) { /* Don't set the color in vbox handle (it doesn't draw) */ - setForegroundColor (labelHandle, color, false); - setForegroundColor (imageHandle, color, false); + if (OS.GTK_VERSION >= OS.VERSION (3, 16, 0)) { + GdkRGBA rgba = null; + if (color != null) { + rgba = display.toGdkRGBA (color); + } + setForegroundColor (labelHandle, rgba); + setForegroundColor (imageHandle, rgba); + } else { + setForegroundColor (labelHandle, color, false); + setForegroundColor (imageHandle, color, false); + } + +} + +void setForegroundColor (int /*long*/ handle, GdkRGBA rgba) { + GdkRGBA toSet = new GdkRGBA(); + if (rgba != null) { + toSet = rgba; + } else { + GdkColor defaultForeground = display.COLOR_WIDGET_FOREGROUND; + toSet = display.toGdkRGBA (defaultForeground); + } + int /*long*/ context = OS.gtk_widget_get_style_context (handle); + // Form foreground string + String color = display.gtk_rgba_to_css_string(toSet); + String css = "* {color: " + color + ";}"; + + // Cache and apply foreground color + parent.cssForeground = css; + gtk_css_provider_load_from_css(context, css); +} + +void gtk_css_provider_load_from_css (int /*long*/ context, String css) { + /* Utility function. */ + //@param css : a 'css java' string like "{\nbackground: red;\n}". + if (provider == 0) { + provider = OS.gtk_css_provider_new (); + OS.gtk_style_context_add_provider (context, provider, OS.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + OS.g_object_unref (provider); + } + OS.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (null, css, true), -1, null); } @Override diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/TableColumn.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/TableColumn.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/TableColumn.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/TableColumn.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -12,10 +12,10 @@ import org.eclipse.swt.*; +import org.eclipse.swt.events.*; +import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.events.*; /** * Instances of this class represent a column in a table widget. @@ -320,6 +320,11 @@ * </ul> */ public int getWidth () { + checkWidget (); + return DPIUtil.autoScaleDown(getWidthInPixels()); +} + +int getWidthInPixels () { checkWidget(); if (!OS.gtk_tree_view_column_get_visible (handle)) { return 0; @@ -447,7 +452,7 @@ } OS.g_free (iter); } - setWidth(width); + setWidthInPixels(width); } @Override @@ -689,6 +694,11 @@ * </ul> */ public void setWidth (int width) { + checkWidget (); + setWidthInPixels (DPIUtil.autoScaleUp (width)); +} + +void setWidthInPixels (int width) { checkWidget(); if (width < 0) return; if (width == lastWidth) return; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/TableItem.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/TableItem.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/TableItem.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/TableItem.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -38,6 +38,7 @@ Font font; Font[] cellFont; boolean cached, grayed; + int columnSetHeight, columnSetWidth; /** * Constructs a new instance of this class given its parent @@ -266,6 +267,23 @@ * @since 3.2 */ public Rectangle getBounds () { + return DPIUtil.autoScaleDown (getBoundsinPixels ()); +} + +/** + * Returns a rectangle describing the size and location of the receiver's + * text relative to its parent. + * + * @return the bounding rectangle of the receiver's text + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + * + * @since 3.105 + */ +Rectangle getBoundsinPixels () { // TODO fully test on early and later versions of GTK // shifted a bit too far right on later versions of GTK - however, old Tree also had this problem checkWidget (); @@ -313,7 +331,11 @@ } } int width = OS.gtk_tree_view_column_get_visible (column) ? rect.width + 1 : 0; - return new Rectangle (rect.x, rect.y, width, rect.height + 1); + Rectangle r = new Rectangle (rect.x, rect.y, width, rect.height + 1); + if (parent.getHeaderVisible() && OS.GTK_VERSION > OS.VERSION(3, 9, 0)) { + r.y += parent.getHeaderHeightInPixels(); + } + return r; } /** @@ -348,6 +370,11 @@ * </ul> */ public Rectangle getBounds (int index) { + checkWidget (); + return DPIUtil.autoScaleDown (getBoundsInPixels (index)); +} + +Rectangle getBoundsInPixels (int index) { checkWidget(); if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED); int /*long*/ parentHandle = parent.handle; @@ -374,7 +401,7 @@ int width = OS.gtk_tree_view_column_get_visible (column) ? rect.width + 1 : 0; Rectangle r = new Rectangle (rect.x, rect.y, width, rect.height + 1); if (parent.getHeaderVisible() && OS.GTK_VERSION > OS.VERSION(3, 9, 0)) { - r.y += parent.getHeaderHeight(); + r.y += parent.getHeaderHeightInPixels(); } return r; } @@ -537,6 +564,11 @@ */ public Rectangle getImageBounds (int index) { checkWidget (); + return DPIUtil.autoScaleDown (getImageBoundsInPixels (index)); +} + +Rectangle getImageBoundsInPixels (int index) { + checkWidget (); if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED); int /*long*/ parentHandle = parent.handle; int /*long*/ column = 0; @@ -556,7 +588,33 @@ if ((parent.getStyle () & SWT.MIRRORED) != 0) rect.x = parent.getClientWidth () - rect.width - rect.x; int [] x = new int [1], w = new int[1]; OS.gtk_tree_view_column_cell_get_position (column, pixbufRenderer, x, w); - rect.x += x [0]; + /* + * Feature in GTK. When a pixbufRenderer has size of 0x0, gtk_tree_view_column_cell_get_position + * returns a position of 0 as well. This causes offset issues meaning that images/widgets/etc. + * can be placed over the text. We need to account for the base case of a pixbufRenderer that has + * yet to be sized, as per Bug 469277 & 476419. NOTE: this change has been ported to Tables since Tables/Trees both + * use the same underlying GTK structure. + */ + if (OS.GTK3) { + if (parent.pixbufSizeSet) { + if (x [0] > 0) { + rect.x += x [0]; + } + } else { + /* + * If the size of the pixbufRenderer hasn't been set, we need to take into account the + * position of the textRenderer, to ensure images/widgets/etc. aren't placed over the TableItem's + * text. + */ + int /*long*/ textRenderer = parent.getTextRenderer (column); + if (textRenderer == 0) return new Rectangle (0, 0, 0, 0); + int [] xText = new int [1], wText = new int [1]; + OS.gtk_tree_view_column_cell_get_position (column, textRenderer, xText, wText); + rect.x += xText [0]; + } + } else { + rect.x += x [0]; + } rect.width = w [0]; int width = OS.gtk_tree_view_column_get_visible (column) ? rect.width : 0; return new Rectangle (rect.x, rect.y, width, rect.height + 1); @@ -645,6 +703,11 @@ */ public Rectangle getTextBounds (int index) { checkWidget (); + return DPIUtil.autoScaleDown (getTextBoundsInPixels (index)); +} + +Rectangle getTextBoundsInPixels (int index) { + checkWidget (); if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED); int count = Math.max (1, parent.getColumnCount ()); if (0 > index || index > count - 1) return new Rectangle (0, 0, 0, 0); @@ -689,7 +752,27 @@ rect.x += horizontalSeparator; OS.gtk_tree_view_column_cell_get_position (column, textRenderer, x, null); - rect.x += x [0]; + /* + * Fix for Eclipse bug 476562, we need to re-adjust the bounds for the text + * when the separator value is less than the width of the image. Previously + * images larger than 16px in width would be cut off on the right side. + * NOTE: this change has been ported to Tables since Tables/Trees both use the + * same underlying GTK structure. + */ + if (OS.GTK3) { + Image image = _getImage(index); + int imageWidth = 0; + if (image != null) { + imageWidth = image.getBoundsInPixels ().width; + } + if (x [0] < imageWidth) { + rect.x += imageWidth; + } else { + rect.x += x [0]; + } + } else { + rect.x += x [0]; + } if (parent.columnCount > 0) { if (rect.x + rect.width > right) { rect.width = Math.max (0, right - rect.x); @@ -1064,6 +1147,44 @@ if (imageIndex == -1) imageIndex = imageList.add (image); pixbuf = imageList.getPixbuf (imageIndex); } + /* + * Reset size of pixbufRenderer if we have an image being set that is larger + * than the current size of the pixbufRenderer. Fix for bug 457196. + * We only do this if the size of the pixbufRenderer has not yet been set. + * Otherwise, the pixbufRenderer retains the same size as the first image added. + * See comment #4, Bug 478560. Note that all columns need to have their + * pixbufRenderer set to this size after the initial image is set. NOTE: this + * change has been ported to Tables since Tables/Trees both use the same + * underlying GTK structure. + */ + if (OS.GTK3) { + int /*long*/parentHandle = parent.handle; + int /*long*/ column = OS.gtk_tree_view_get_column (parentHandle, index); + int /*long*/ pixbufRenderer = parent.getPixbufRenderer (column); + int [] currentWidth = new int [1]; + int [] currentHeight= new int [1]; + OS.gtk_cell_renderer_get_fixed_size (pixbufRenderer, currentWidth, currentHeight); + if (!parent.pixbufSizeSet) { + if (image != null) { + int iWidth = image.getBoundsInPixels ().width; + int iHeight = image.getBoundsInPixels ().height; + if (iWidth > currentWidth [0] || iHeight > currentHeight [0]) { + OS.gtk_cell_renderer_set_fixed_size (pixbufRenderer, iWidth, iHeight); + parent.pixbufSizeSet = true; + columnSetHeight = iHeight; + columnSetWidth = iWidth; + } + } + } else { + /* + * We check to see if the cached value is greater than the size of the pixbufRenderer. + * If it is, then we change the size of the pixbufRenderer accordingly. + */ + if (columnSetWidth > currentWidth [0] || columnSetHeight > currentHeight [0]) { + OS.gtk_cell_renderer_set_fixed_size (pixbufRenderer, columnSetWidth, columnSetHeight); + } + } + } int modelIndex = parent.columnCount == 0 ? Table.FIRST_COLUMN : parent.columns [index].modelIndex; OS.gtk_list_store_set (parent.modelHandle, handle, modelIndex + Table.CELL_PIXBUF, pixbuf, -1); /* @@ -1078,7 +1199,7 @@ int [] w = new int [1]; int /*long*/ pixbufRenderer = parent.getPixbufRenderer(column); OS.gtk_tree_view_column_cell_get_position (column, pixbufRenderer, null, w); - if (w[0] < image.getBounds().width) { + if (w[0] < image.getBoundsInPixels().width) { /* * There is no direct way to clear the cell renderer width so we * are relying on the fact that it is done as part of modifying @@ -1092,6 +1213,16 @@ } } cached = true; + /* + * Bug 465056: single column Tables have a very small initial width. + * Fix: when text or an image is set for a Table, compute its + * width and see if it's larger than the maximum of the previous widths. + */ + int /*long*/ column; + if (parent.columnCount == 0) { + column = OS.gtk_tree_view_get_column (parent.handle, index); + parent.maxWidth = Math.max(parent.maxWidth, parent.calculateWidth(column, this.handle)); + } } @Override @@ -1170,6 +1301,16 @@ int modelIndex = parent.columnCount == 0 ? Table.FIRST_COLUMN : parent.columns [index].modelIndex; OS.gtk_list_store_set (parent.modelHandle, handle, modelIndex + Table.CELL_TEXT, buffer, -1); cached = true; + /* + * Bug 465056: single column Tables have a very small initial width. + * Fix: when text or an image is set for a Table, compute its + * width and see if it's larger than the maximum of the previous widths. + */ + int /*long*/ column; + if (parent.columnCount == 0) { + column = OS.gtk_tree_view_get_column (parent.handle, index); + parent.maxWidth = Math.max(parent.maxWidth, parent.calculateWidth(column, this.handle)); + } } @Override diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Table.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Table.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Table.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Table.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -80,7 +80,9 @@ boolean firstCustomDraw; int drawState, drawFlags; GdkColor drawForeground; - boolean ownerDraw, ignoreSize, ignoreAccessibility; + GdkRGBA background; + boolean ownerDraw, ignoreSize, ignoreAccessibility, pixbufSizeSet; + int maxWidth = 0; static final int CHECKED_COLUMN = 0; static final int GRAYED_COLUMN = 1; @@ -323,7 +325,7 @@ * always grows in size regardless of the text or images in the table. * The fix is to determine the column width from the cell renderers. */ - + //This workaround is causing the problem Bug 459834 in GTK3. So reverting the workaround for GTK3 if (OS.GTK3) { int [] width = new int [1]; @@ -485,29 +487,38 @@ } @Override -public Point computeSize (int wHint, int hHint, boolean changed) { +Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; Point size = computeNativeSize (handle, wHint, hHint, changed); - if (size.x == 0 && wHint == SWT.DEFAULT) size.x = DEFAULT_WIDTH; - - /* - * in GTK 3.8 computeNativeSize returning 0 for height. - * So if the height is returned as zero calculate the table height - * based on the number of items in the table - */ - if (OS.GTK3 && size.y == 0 && hHint == SWT.DEFAULT) { - size.y = getItemCount() * getItemHeight(); + if (OS.GTK3) { + /* + * In GTK 3, computeNativeSize(..) sometimes just returns the header + * height as height. In that case, calculate the table height based on + * the number of items in the table. + */ + if (hHint == SWT.DEFAULT && size.y == getHeaderHeight()) { + size.y = getItemCount() * getItemHeight() + getHeaderHeight(); + } + /* + * Bug 465056: single column Tables have a very small initial width. + * Fix: set the width of the Table to the width of the widest + * TableItem. + */ + if (wHint == SWT.DEFAULT && size.x == 0 && columnCount == 0) { + size.x = maxWidth; + } } - /* * In case the table doesn't contain any elements, * getItemCount returns 0 and size.y will be 0 - * so need to assign default height + * so need to assign default height. The same applies + * for size.x. */ if (size.y == 0 && hHint == SWT.DEFAULT) size.y = DEFAULT_HEIGHT; - Rectangle trim = computeTrim (0, 0, size.x, size.y); + if (size.x == 0 && wHint == SWT.DEFAULT) size.x = DEFAULT_WIDTH; + Rectangle trim = computeTrimInPixels (0, 0, size.x, size.y); size.x = trim.width; size.y = trim.height; return size; @@ -638,6 +649,9 @@ int vsp = (style & SWT.V_SCROLL) != 0 ? OS.GTK_POLICY_AUTOMATIC : OS.GTK_POLICY_NEVER; OS.gtk_scrolled_window_set_policy (scrolledHandle, hsp, vsp); if ((style & SWT.BORDER) != 0) OS.gtk_scrolled_window_set_shadow_type (scrolledHandle, OS.GTK_SHADOW_ETCHED_IN); + /* + * We enable fixed-height-mode for performance reasons (see bug 490203). + */ if ((style & SWT.VIRTUAL) != 0) { OS.g_object_set (handle, OS.fixed_height_mode, true, 0); } @@ -715,7 +729,7 @@ * ensure that the columns are resized before any queries. */ if(!isVisible ()) { - OS.gtk_container_resize_children (handle); + forceResize(); } } @@ -760,7 +774,9 @@ } else { // set default size this size is used for calculating the icon and text positions in a table if ((!ownerDraw) && (OS.GTK3)) { - OS.gtk_cell_renderer_set_fixed_size(pixbufRenderer, 16, 16); + // Set render size to 0x0 until we actually add images, fix for + // Bug 457196 (this applies to Tables as well). + OS.gtk_cell_renderer_set_fixed_size(pixbufRenderer, 0, 0); } } int /*long*/ textRenderer = ownerDraw ? OS.g_object_new (display.gtk_cell_renderer_text_get_type (), 0) : OS.gtk_cell_renderer_text_new (); @@ -799,7 +815,12 @@ } /* Add attributes */ - OS.gtk_tree_view_column_add_attribute (columnHandle, pixbufRenderer, OS.GTK3 ? OS.gicon : OS.pixbuf, modelIndex + CELL_PIXBUF); + /* + * Formerly OS.gicon was set if on GTK3, but this is being removed do to spacing issues in Tables/Trees with + * no images. Fix for Bug 457196. NOTE: this change has been ported to Tables since Tables/Trees both + * use the same underlying GTK structure. + */ + OS.gtk_tree_view_column_add_attribute (columnHandle, pixbufRenderer, OS.pixbuf, modelIndex + CELL_PIXBUF); if (!ownerDraw) { OS.gtk_tree_view_column_add_attribute (columnHandle, pixbufRenderer, OS.cell_background_gdk, BACKGROUND_COLUMN); OS.gtk_tree_view_column_add_attribute (columnHandle, textRenderer, OS.cell_background_gdk, BACKGROUND_COLUMN); @@ -1140,7 +1161,7 @@ } @Override -public Rectangle getClientArea () { +Rectangle getClientAreaInPixels () { checkWidget (); forceResize (); OS.gtk_widget_realize (handle); @@ -1157,7 +1178,7 @@ int height = (state & ZERO_HEIGHT) != 0 ? 0 : allocation.height; Rectangle rect = new Rectangle (fixedX [0] - binX [0], fixedY [0] - binY [0], width, height); if (getHeaderVisible() && OS.GTK_VERSION > OS.VERSION(3, 9, 0)) { - rect.y += getHeaderHeight(); + rect.y += getHeaderHeightInPixels(); } return rect; } @@ -1327,6 +1348,21 @@ return result; } +@Override +GdkColor getContextBackground () { + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + if (background != null) { + return display.toGdkColor (background); + } else { + // For Tables and Trees, the default background is + // COLOR_LIST_BACKGROUND instead of COLOR_WIDGET_BACKGROUND. + return display.COLOR_LIST_BACKGROUND; + } + } else { + return super.getContextBackground (); + } +} + TableItem getFocusItem () { int /*long*/ [] path = new int /*long*/ [1]; OS.gtk_tree_view_get_cursor (handle, path, null); @@ -1358,6 +1394,11 @@ * </ul> */ public int getGridLineWidth () { + checkWidget (); + return DPIUtil.autoScaleDown (getGridLineWidthInPixels ()); +} + +int getGridLineWidthInPixels () { checkWidget(); return 0; } @@ -1376,6 +1417,11 @@ */ public int getHeaderHeight () { checkWidget (); + return DPIUtil.autoScaleDown (getHeaderHeightInPixels ()); +} + +int getHeaderHeightInPixels () { + checkWidget (); if (!OS.gtk_tree_view_get_headers_visible (handle)) return 0; if (columnCount > 0) { GtkRequisition requisition = new GtkRequisition (); @@ -1467,12 +1513,17 @@ */ public TableItem getItem (Point point) { checkWidget(); + return getItemInPixels(DPIUtil.autoScaleUp(point)); +} + +TableItem getItemInPixels (Point point) { + checkWidget(); if (point == null) error (SWT.ERROR_NULL_ARGUMENT); int /*long*/ [] path = new int /*long*/ [1]; OS.gtk_widget_realize (handle); int y = point.y; if (getHeaderVisible() && OS.GTK_VERSION > OS.VERSION(3, 9, 0)) { - y -= getHeaderHeight(); + y -= getHeaderHeightInPixels(); } if (!OS.gtk_tree_view_get_path_at_pos (handle, point.x, y, path, null, null, null)) return null; if (path [0] == 0) return null; @@ -1514,6 +1565,11 @@ * </ul> */ public int getItemHeight () { + checkWidget (); + return DPIUtil.autoScaleDown (getItemHeightInPixels ()); +} + +int getItemHeightInPixels () { checkWidget(); if (itemCount == 0) { int /*long*/ column = OS.gtk_tree_view_get_column (handle, 0); @@ -1891,19 +1947,70 @@ } } } - /* - * Bug in GTK. GTK segments fault, if the GtkTreeView widget is - * not in focus and all items in the widget are disposed before - * it finishes processing a button press. The fix is to give - * focus to the widget before it starts processing the event. - */ - if (!OS.gtk_widget_has_focus (handle)) { - OS.gtk_widget_grab_focus (handle); + + //If Mouse double-click pressed, manually send a DefaultSelection. See Bug 312568. + if (gdkEvent.type == OS.GDK_2BUTTON_PRESS) { + sendTreeDefaultSelection (); } + return result; } @Override +int /*long*/ gtk_key_press_event (int /*long*/ widget, int /*long*/ event) { + GdkEventKey keyEvent = new GdkEventKey (); + OS.memmove (keyEvent, event, GdkEventKey.sizeof); + int key = keyEvent.keyval; + keyPressDefaultSelectionHandler (event, key); + return super.gtk_key_press_event (widget, event); +} + +/** + * Used to emulate DefaultSelection event. See Bug 312568. + * @param event the gtk key press event that was fired. + */ +void keyPressDefaultSelectionHandler (int /*long*/ event, int key) { + + int keymask = gdk_event_get_state (event); + switch (key) { + case OS.GDK_Return: + //Send Default selection return only when no other modifier is pressed. + if ((keymask & (OS.GDK_MOD1_MASK | OS.GDK_SHIFT_MASK | OS.GDK_CONTROL_MASK + | OS.GDK_SUPER_MASK | OS.GDK_META_MASK | OS.GDK_HYPER_MASK)) == 0) { + sendTreeDefaultSelection (); + } + break; + case OS.GDK_space: + //Shift + Space is a legal DefaultSelection event. (as per row-activation signal documentation). + //But do not send if another modifier is pressed. + if ((keymask & (OS.GDK_MOD1_MASK | OS.GDK_CONTROL_MASK + | OS.GDK_SUPER_MASK | OS.GDK_META_MASK | OS.GDK_HYPER_MASK)) == 0) { + sendTreeDefaultSelection (); + } + break; + } +} + +//Used to emulate DefaultSelection event. See Bug 312568. +//Feature in GTK. 'row-activation' event comes before DoubleClick event. +//This is causing the editor not to get focus after doubleclick. +//The solution is to manually send the DefaultSelection event after a doubleclick, +//and to emulate it for Space/Return. +void sendTreeDefaultSelection() { + + //Note, similar DefaultSelectionHandling in SWT List/Table/Tree + TableItem tableItem = getFocusItem (); + if (tableItem == null) + return; + + Event event = new Event (); + event.item = tableItem; + + sendSelectionEvent (SWT.DefaultSelection, event, false); +} + + +@Override int /*long*/ gtk_button_release_event (int /*long*/ widget, int /*long*/ event) { int /*long*/ window = OS.GDK_EVENT_WINDOW (event); if (window != OS.gtk_tree_view_get_bin_window (handle)) return 0; @@ -1995,21 +2102,6 @@ } @Override -int /*long*/ gtk_row_activated (int /*long*/ tree, int /*long*/ path, int /*long*/ column) { - TableItem item = null; - int /*long*/ indices = OS.gtk_tree_path_get_indices (path); - if (indices != 0) { - int [] index = new int []{-1}; - OS.memmove (index, indices, 4); - item = _getItem (index [0]); - } - Event event = new Event (); - event.item = item; - sendSelectionEvent (SWT.DefaultSelection, event, false); - return 0; -} - -@Override int /*long*/ gtk_row_deleted (int /*long*/ model, int /*long*/ path) { if (ignoreAccessibility) { OS.g_signal_stop_emission_by_name (model, OS.row_deleted); @@ -2545,7 +2637,7 @@ Image image = item.getImage (columnIndex); int imageWidth = 0; if (image != null) { - Rectangle bounds = image.getBounds (); + Rectangle bounds = image.getBoundsInPixels (); imageWidth = bounds.width; } contentWidth [0] += imageWidth; @@ -2555,13 +2647,14 @@ event.item = item; event.index = columnIndex; event.gc = gc; - event.width = contentWidth [0]; - event.height = contentHeight [0]; + Rectangle eventRect = new Rectangle (0, 0, contentWidth [0], contentHeight [0]); + event.setBounds (DPIUtil.autoScaleDown (eventRect)); if (isSelected) event.detail = SWT.SELECTED; sendEvent (SWT.MeasureItem, event); gc.dispose (); - contentWidth [0] = event.width - imageWidth; - if (contentHeight [0] < event.height) contentHeight [0] = event.height; + Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ()); + contentWidth [0] = rect.width - imageWidth; + if (contentHeight [0] < rect.height) contentHeight [0] = rect.height; if (width != 0) OS.memmove (width, contentWidth, 4); if (height != 0) OS.memmove (height, contentHeight, 4); if (OS.GTK3) { @@ -2626,7 +2719,8 @@ } } if (item != null) { - if (OS.GTK_IS_CELL_RENDERER_TOGGLE (cell) || (OS.GTK_IS_CELL_RENDERER_PIXBUF (cell) && (columnIndex != 0 || (style & SWT.CHECK) == 0))) { + if (OS.GTK_IS_CELL_RENDERER_TOGGLE (cell) || + ( (OS.GTK_IS_CELL_RENDERER_PIXBUF (cell) || OS.GTK_VERSION > OS.VERSION(3, 13, 0)) && (columnIndex != 0 || (style & SWT.CHECK) == 0))) { drawFlags = (int)/*64*/flags; drawState = SWT.FOREGROUND; int /*long*/ [] ptr = new int /*long*/ [1]; @@ -2707,19 +2801,26 @@ if (OS.GTK_VERSION >= OS.VERSION(3, 9, 0) && cr != 0) { GdkRectangle r = new GdkRectangle(); OS.gdk_cairo_get_clip_rectangle(cr, r); - gc.setClipping(rect.x, r.y, r.width, r.height); + Rectangle rect2 = DPIUtil.autoScaleDown(new Rectangle(rect.x, r.y, r.width, r.height)); + // Caveat: rect2 is necessary because GC#setClipping(Rectangle) got broken by bug 446075 + gc.setClipping(rect2.x, rect2.y, rect2.width, rect2.height); + + if (OS.GTK_VERSION <= OS.VERSION(3, 14, 8)) { + rect.width = r.width; + } } else { - gc.setClipping (rect.x, rect.y, rect.width, rect.height); + Rectangle rect2 = DPIUtil.autoScaleDown(new Rectangle(rect.x, rect.y, rect.width, rect.height)); + // Caveat: rect2 is necessary because GC#setClipping(Rectangle) got broken by bug 446075 + gc.setClipping(rect2.x, rect2.y, rect2.width, rect2.height); + } Event event = new Event (); event.item = item; event.index = columnIndex; event.gc = gc; - event.x = rect.x; - event.y = rect.y; - event.width = rect.width; - event.height = rect.height; event.detail = drawState; + Rectangle eventRect = new Rectangle (rect.x, rect.y, rect.width, rect.height); + event.setBounds (DPIUtil.autoScaleDown (eventRect)); sendEvent (SWT.EraseItem, event); drawForeground = null; drawState = event.doit ? event.detail : 0; @@ -2755,7 +2856,7 @@ gc.setBackground (item.getBackground (columnIndex)); GdkRectangle rect = new GdkRectangle (); OS.memmove (rect, background_area, GdkRectangle.sizeof); - gc.fillRectangle (rect.x, rect.y, rect.width, rect.height); + gc.fillRectangle(DPIUtil.autoScaleDown(new Rectangle(rect.x, rect.y, rect.width, rect.height))); gc.dispose (); } if ((drawState & SWT.FOREGROUND) != 0 || OS.GTK_IS_CELL_RENDERER_TOGGLE (cell)) { @@ -2793,7 +2894,7 @@ Image image = item.getImage (columnIndex); int imageWidth = 0; if (image != null) { - Rectangle bounds = image.getBounds (); + Rectangle bounds = image.getBoundsInPixels (); imageWidth = bounds.width; } // On gtk >3.9 and <3.14.8 the clip rectangle does not have image area into clip rectangle @@ -2828,15 +2929,17 @@ } gc.setFont (item.getFont (columnIndex)); if ((style & SWT.MIRRORED) != 0) rect.x = getClientWidth () - rect.width - rect.x; - gc.setClipping (rect.x, rect.y, rect.width, rect.height); + + Rectangle rect2 = DPIUtil.autoScaleDown(new Rectangle(rect.x, rect.y, rect.width, rect.height)); + // Caveat: rect2 is necessary because GC#setClipping(Rectangle) got broken by bug 446075 + gc.setClipping(rect2.x, rect2.y, rect2.width, rect2.height); + Event event = new Event (); event.item = item; event.index = columnIndex; event.gc = gc; - event.x = rect.x + contentX [0]; - event.y = rect.y; - event.width = contentWidth [0]; - event.height = rect.height; + Rectangle eventRect = new Rectangle (rect.x + contentX [0], rect.y, contentWidth [0], rect.height); + event.setBounds (DPIUtil.autoScaleDown (eventRect)); event.detail = drawState; sendEvent (SWT.PaintItem, event); gc.dispose(); @@ -3053,17 +3156,38 @@ super.setBackgroundColor (color); if (!OS.GTK3) { OS.gtk_widget_modify_base (handle, 0, color); - } else { - // Setting the background color overrides the selected background color - // so we have to reset it the default. - GdkColor defaultColor = getDisplay().COLOR_LIST_SELECTION; - GdkRGBA selectedBackground = new GdkRGBA (); - selectedBackground.alpha = 1; - selectedBackground.red = (defaultColor.red & 0xFFFF) / (float)0xFFFF; - selectedBackground.green = (defaultColor.green & 0xFFFF) / (float)0xFFFF; - selectedBackground.blue = (defaultColor.blue & 0xFFFF) / (float)0xFFFF; + } +} - OS.gtk_widget_override_background_color (handle, OS.GTK_STATE_FLAG_SELECTED, selectedBackground); +@Override +void setBackgroundColor (int /*long*/ context, int /*long*/ handle, GdkRGBA rgba) { + /* Setting the background color overrides the selected background color. + * To prevent this, we need to re-set the default. This can be done with CSS + * on GTK3.16+, or by using GtkStateFlags as an argument to + * gtk_widget_override_background_color() on versions of GTK3 less than 3.16. + */ + if (rgba == null) { + GdkColor temp = getDisplay().COLOR_LIST_BACKGROUND; + background = display.toGdkRGBA (temp); + } else { + background = rgba; + } + GdkColor defaultColor = getDisplay().COLOR_LIST_SELECTION; + GdkRGBA selectedBackground = display.toGdkRGBA (defaultColor); + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + String name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "treeview" : "GtkTreeView"; + String css = name + " {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n" + + name + ":selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}"; + + // Cache background color + cssBackground = css; + + // Apply background color and any foreground color + String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND); + gtk_css_provider_load_from_css(context, finalCss); + } else { + super.setBackgroundColor(context, handle, rgba); + OS.gtk_widget_override_background_color(handle, OS.GTK_STATE_FLAG_SELECTED, selectedBackground); } } @@ -3147,7 +3271,15 @@ @Override void setForegroundColor (GdkColor color) { - setForegroundColor (handle, color, false); + if (OS.GTK_VERSION >= OS.VERSION (3, 16, 0)) { + GdkRGBA rgba = null; + if (color != null) { + rgba = display.toGdkRGBA (color); + } + setForegroundColor (handle, rgba); + } else { + setForegroundColor (handle, color, false); + } } /** diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/TaskBar.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/TaskBar.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/TaskBar.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/TaskBar.java 2016-07-06 19:11:33.000000000 +0000 @@ -15,19 +15,19 @@ /** * Instances of this class represent the system task bar. - * + * * <dl> * <dt><b>Styles:</b></dt> * <dd>(none)</dd> * <dt><b>Events:</b></dt> * <dd>(none)</dd> * </dl> - * + * * @see Display#getSystemTaskBar * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.6 - * + * * @noextend This class is not intended to be subclassed by clients. */ public class TaskBar extends Widget { @@ -109,10 +109,10 @@ } /** - * Returns the <code>TaskItem</code> for the given <code>Shell</code> or the <code>TaskItem</code> + * Returns the <code>TaskItem</code> for the given <code>Shell</code> or the <code>TaskItem</code> * for the application if the <code>Shell</code> parameter is <code>null</code>. * If the requested item is not supported by the platform it returns <code>null</code>. - * + * * @param shell the shell for which the task item is requested, or null to request the application item * @return the task item for the given shell or the application * @@ -128,11 +128,11 @@ /** * Returns an array of <code>TaskItem</code>s which are the items - * in the receiver. + * in the receiver. * <p> * Note: This is not the actual structure used by the receiver * to maintain its list of items, so modifying the array will - * not affect the receiver. + * not affect the receiver. * </p> * * @return the items in the receiver @@ -165,7 +165,7 @@ } @Override -void reskinChildren (int flags) { +void reskinChildren (int flags) { if (items != null) { for (int i=0; i<items.length; i++) { TaskItem item = items [i]; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/TaskItem.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/TaskItem.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/TaskItem.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/TaskItem.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,7 +16,7 @@ /** * Instances of this class represent a task item. - * + * * <dl> * <dt><b>Styles:</b></dt> * <dd>(none)</dd> @@ -25,9 +25,9 @@ * </dl> * * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.6 - * + * * @noextend This class is not intended to be subclassed by clients. */ public class TaskItem extends Item { @@ -47,7 +47,7 @@ * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together + * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. @@ -100,7 +100,7 @@ public Menu getMenu () { checkWidget (); return menu; -} +} /** * Returns the receiver's overlay image if it has one, or null @@ -143,7 +143,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * */ public TaskBar getParent () { checkWidget (); @@ -196,7 +196,7 @@ /** * Sets the receiver's pop up menu to the argument. The way the menu is * shown is platform specific. - * + * * <p> * This feature might not be available for the receiver on all * platforms. The application code can check if it is supported @@ -211,13 +211,13 @@ * <p> * The menu should be fully created before this method is called. * Dynamic changes to the menu after the method is called will not be reflected - * in the native menu.</p> + * in the native menu.</p> * * @param menu the new pop up menu * * @exception IllegalArgumentException <ul> * <li>ERROR_MENU_NOT_POP_UP - the menu is not a pop up menu</li> - * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li> + * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -238,7 +238,7 @@ /** * Sets the receiver's overlay image, which may be null * indicating that no image should be displayed. The bounds - * for the overlay image is determined by the platform and in + * for the overlay image is determined by the platform and in * general it should be a small image. * * <p> @@ -249,13 +249,13 @@ * * <p> * For better cross platform support, the application code should - * first try to set this feature on the <code>TaskItem</code> for the + * first try to set this feature on the <code>TaskItem</code> for the * main shell then on the <code>TaskItem</code> for the application.</p> * * @param overlayImage the new overlay image (may be null) * * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT - if the overlayImage has been disposed</li> + * <li>ERROR_INVALID_ARGUMENT - if the overlayImage has been disposed</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -281,7 +281,7 @@ * * <p> * For better cross platform support, the application code should - * first try to set this feature on the <code>TaskItem</code> for the + * first try to set this feature on the <code>TaskItem</code> for the * main shell then on the <code>TaskItem</code> for the application.</p> * * @param overlayText the new overlay text @@ -310,8 +310,8 @@ * <li>{@link SWT#ERROR}</li> * <li>{@link SWT#INDETERMINATE}</li> * </ul></p> - * - * The percentage of progress shown by the states <code>SWT#NORMAL</code>, <code>SWT#PAUSED</code>, + * + * The percentage of progress shown by the states <code>SWT#NORMAL</code>, <code>SWT#PAUSED</code>, * <code>SWT#ERROR</code> is set with <code>setProgress()</code>. <br> * The state <code>SWT#DEFAULT</code> indicates that no progress should be shown. * @@ -323,16 +323,16 @@ * * <p> * For better cross platform support, the application code should - * first try to set this feature on the <code>TaskItem</code> for the + * first try to set this feature on the <code>TaskItem</code> for the * main shell then on the <code>TaskItem</code> for the application.</p> * - * @param progressState the new progress state + * @param progressState the new progress state * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * #see {@link #setProgress(int)} */ public void setProgressState (int progressState) { @@ -354,7 +354,7 @@ * * <p> * For better cross platform support, the application code should - * first try to set this feature on the <code>TaskItem</code> for the + * first try to set this feature on the <code>TaskItem</code> for the * main shell then on the <code>TaskItem</code> for the application.</p> * * @param progress the new progress @@ -363,7 +363,7 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * #see {@link #setProgressState(int)} */ public void setProgress (int progress) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Text.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Text.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Text.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Text.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -98,6 +98,12 @@ LIMIT = 0x7FFFFFFF; DELIMITER = "\n"; } + /* Text uses non-standard CSS to set its background color, so we need + * a global variable to keep track of its background color. + */ + GdkRGBA background; + int /*long*/ indexMark = 0; + double cachedAdjustment, currentAdjustment; /** * Constructs a new instance of this class given its parent @@ -201,7 +207,14 @@ if (handle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_container_add (fixedHandle, handle); OS.gtk_editable_set_editable (handle, (style & SWT.READ_ONLY) == 0); - OS.gtk_entry_set_has_frame (handle, (style & SWT.BORDER) != 0); + /* + * We need to handle borders differently in GTK3.20+. See bug 491319. + * Leaving this call enabled on 3.20 causes an SWT.SINGLE Text widget + * to have a blank background color. + */ + if (OS.GTK_VERSION < OS.VERSION(3, 20, 0)) { + OS.gtk_entry_set_has_frame (handle, (style & SWT.BORDER) != 0); + } OS.gtk_entry_set_visibility (handle, (style & SWT.PASSWORD) == 0); float alignment = 0.0f; if ((style & SWT.CENTER) != 0) alignment = 0.5f; @@ -414,7 +427,7 @@ OS.gtk_text_buffer_insert (bufferHandle, position, buffer, buffer.length); OS.gtk_text_buffer_place_cursor (bufferHandle, position); int /*long*/ mark = OS.gtk_text_buffer_get_insert (bufferHandle); - OS.gtk_text_view_scroll_mark_onscreen (handle, mark); + OS.gtk_text_view_scroll_to_mark (handle, mark, 0, true, 0, 0); } applySegments (); } @@ -545,7 +558,7 @@ } @Override -public Point computeSize (int wHint, int hHint, boolean changed) { +Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; @@ -578,26 +591,39 @@ if (height == 0) height = DEFAULT_HEIGHT; width = wHint == SWT.DEFAULT ? width : wHint; height = hHint == SWT.DEFAULT ? height : hHint; - Rectangle trim = computeTrim (0, 0, width, height); + Rectangle trim = computeTrimInPixels (0, 0, width, height); return new Point (trim.width, trim.height); } @Override -public Rectangle computeTrim (int x, int y, int width, int height) { +Rectangle computeTrimInPixels (int x, int y, int width, int height) { checkWidget (); - Rectangle trim = super.computeTrim (x, y, width, height); + Rectangle trim = super.computeTrimInPixels (x, y, width, height); int xborder = 0, yborder = 0; if ((style & SWT.SINGLE) != 0) { if (OS.GTK3) { GtkBorder tmp = new GtkBorder(); int /*long*/ context = OS.gtk_widget_get_style_context (handle); - OS.gtk_style_context_get_padding (context, OS.GTK_STATE_FLAG_NORMAL, tmp); + if (OS.GTK_VERSION < OS.VERSION(3, 18, 0)) { + OS.gtk_style_context_get_padding (context, OS.GTK_STATE_FLAG_NORMAL, tmp); + } else { + OS.gtk_style_context_get_padding (context, OS.gtk_widget_get_state_flags(handle), tmp); + } trim.x -= tmp.left; trim.y -= tmp.top; trim.width += tmp.left + tmp.right; - trim.height += tmp.top + tmp.bottom; + if (OS.GTK_VERSION >= OS.VERSION (3, 20, 0)) { + Point widthNative = computeNativeSize(handle, trim.width, SWT.DEFAULT, true); + trim.height = widthNative.y; + } else { + trim.height += tmp.top + tmp.bottom; + } if ((style & SWT.BORDER) != 0) { - OS.gtk_style_context_get_border (context, OS.GTK_STATE_FLAG_NORMAL, tmp); + if (OS.GTK_VERSION < OS.VERSION(3, 18, 0)) { + OS.gtk_style_context_get_border (context, OS.GTK_STATE_FLAG_NORMAL, tmp); + } else { + OS.gtk_style_context_get_border (context, OS.gtk_widget_get_state_flags(handle), tmp); + } trim.x -= tmp.left; trim.y -= tmp.top; trim.width += tmp.left + tmp.right; @@ -816,9 +842,9 @@ } @Override -public int getBorderWidth () { +int getBorderWidthInPixels () { checkWidget(); - if ((style & SWT.MULTI) != 0) return super.getBorderWidth (); + if ((style & SWT.MULTI) != 0) return super.getBorderWidthInPixels (); if ((this.style & SWT.BORDER) != 0) { return getThickness (handle).x; } @@ -860,6 +886,11 @@ */ public Point getCaretLocation () { checkWidget (); + return DPIUtil.autoScaleDown(getCaretLocationInPixels()); +} + +Point getCaretLocationInPixels () { + checkWidget (); if ((style & SWT.SINGLE) != 0) { int index = OS.gtk_editable_get_position (handle); index = OS.gtk_entry_text_index_to_layout_index (handle, index); @@ -868,7 +899,7 @@ int /*long*/ layout = OS.gtk_entry_get_layout (handle); PangoRectangle pos = new PangoRectangle (); OS.pango_layout_index_to_pos (layout, index, pos); - int x = offset_x [0] + OS.PANGO_PIXELS (pos.x) - getBorderWidth (); + int x = offset_x [0] + OS.PANGO_PIXELS (pos.x) - getBorderWidthInPixels (); int y = offset_y [0] + OS.PANGO_PIXELS (pos.y); return new Point (x, y); } @@ -1373,6 +1404,30 @@ checkWidget (); if ((style & SWT.SINGLE) != 0) return 0; byte [] position = new byte [ITER_SIZEOF]; + /* + * Feature in GTK: GtkTextView widgets are subject to line validation + * which happens during idle. This causes GtkTextIter to not update quickly + * enough when changes are added to the text buffer. The fix is to use a + * GtkTextMark to track the precise index, then convert it back to a + * GtkTextIter when getTopIndex() is called. See bug 487467. + * + * NOTE: to cover cases where getTopIndex() is called without setTopIndex() + * being called, we fetch the current GtkAdjustment value and cache it for + * comparison. In getTopIndex() we compare the current value with the cached + * one to see if the user has scrolled/moved the viewport using the GUI. + * If so, we use the old method of fetching the top index. + */ + if (OS.GTK3) { + int /*long*/ vAdjustment = OS.gtk_scrollable_get_vadjustment (handle); + currentAdjustment = OS.gtk_adjustment_get_value (vAdjustment); + if (cachedAdjustment == currentAdjustment) { + // If indexMark is 0, fetch topIndex using the old method + if (indexMark != 0) { + OS.gtk_text_buffer_get_iter_at_mark (bufferHandle, position, indexMark); + return OS.gtk_text_iter_get_line (position); + } + } + } GdkRectangle rect = new GdkRectangle (); OS.gtk_text_view_get_visible_rect (handle, rect); OS.gtk_text_view_get_line_at_y (handle, position, rect.y, null); @@ -1401,6 +1456,11 @@ */ public int getTopPixel () { checkWidget (); + return DPIUtil.autoScaleDown(getTopPixelInPixels()); +} + +int getTopPixelInPixels () { + checkWidget (); if ((style & SWT.SINGLE) != 0) return 0; byte [] position = new byte [ITER_SIZEOF]; GdkRectangle rect = new GdkRectangle (); @@ -1664,10 +1724,8 @@ if (OS.GTK3) { int /*long*/ styleContext = OS.gtk_widget_get_style_context (handle); GdkRGBA rgba = new GdkRGBA (); - OS.gtk_style_context_get_color (styleContext, OS.GTK_STATE_FLAG_INSENSITIVE, rgba); - textColor.red = (short)(rgba.red * 0xFFFF); - textColor.green = (short)(rgba.green * 0xFFFF); - textColor.blue = (short)(rgba.blue * 0xFFFF); + rgba = display.styleContextGetColor (styleContext, OS.GTK_STATE_FLAG_INSENSITIVE, rgba); + textColor = display.toGdkColor (rgba); Point thickness = getThickness (handle); x += thickness.x; y += thickness.y; @@ -1678,7 +1736,8 @@ } if (OS.USE_CAIRO) { int /*long*/ cairo = cr != 0 ? cr : OS.gdk_cairo_create(window); - Cairo.cairo_set_source_rgba(cairo, (textColor.red & 0xFFFF) / (float)0xFFFF, (textColor.green & 0xFFFF) / (float)0xFFFF, (textColor.blue & 0xFFFF) / (float)0xFFFF, 1); + GdkRGBA rgba = display.toGdkRGBA (textColor); + Cairo.cairo_set_source_rgba(cairo, rgba.red, rgba.green, rgba.blue, rgba.alpha); Cairo.cairo_move_to(cairo, x, y); OS.pango_cairo_show_layout(cairo, layout); if (cr != cairo) Cairo.cairo_destroy(cairo); @@ -1947,7 +2006,7 @@ OS.gtk_text_buffer_insert (bufferHandle, start, buffer, buffer.length); OS.gtk_text_buffer_place_cursor (bufferHandle, start); int /*long*/ mark = OS.gtk_text_buffer_get_insert (bufferHandle); - OS.gtk_text_view_scroll_mark_onscreen (handle, mark); + OS.gtk_text_view_scroll_to_mark (handle, mark, 0, true, 0, 0); } applySegments (); } @@ -2145,18 +2204,65 @@ } @Override +GdkColor getContextBackground () { + if (OS.GTK3) { + if (background != null) { + return display.toGdkColor (background); + } else { + return display.COLOR_LIST_BACKGROUND; + } + } else { + return super.getContextBackground (); + } +} + +@Override void setBackgroundColor (int /*long*/ context, int /*long*/ handle, GdkRGBA rgba) { - if ((style & SWT.MULTI) != 0) { - super.setBackgroundColor (context, handle, rgba); - return; + /* Setting the background color overrides the selected background color. + * To prevent this, we need to re-set the default. This can be done with CSS + * on GTK3.16+, or by using GtkStateFlags as an argument to + * gtk_widget_override_background_color() on versions of GTK3 less than 3.16. + */ + if (rgba == null) { + GdkColor temp = getDisplay().COLOR_LIST_BACKGROUND; + background = display.toGdkRGBA (temp); + } else { + background = rgba; + } + GdkColor defaultColor = getDisplay().COLOR_LIST_SELECTION; + GdkRGBA selectedBackground = display.toGdkRGBA (defaultColor); + GdkRGBA selectedForeground = display.toGdkRGBA(display.COLOR_LIST_SELECTION_TEXT); + if (OS.GTK3) { + String css; + String properties; + String name; + String selection = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? " selection" : ":selected"; + if ((style & SWT.SINGLE) != 0) { + name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "entry" : "GtkEntry"; + properties = " {background: " + display.gtk_rgba_to_css_string(background) + ";}\n" + + name + ":selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}\n" + + name + selection + " {color: " + display.gtk_rgba_to_css_string(selectedForeground) + ";}"; + } else { + name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "textview text" : "GtkTextView"; + properties = " {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n" + + name + ":selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}\n" + + name + selection + " {color: " + display.gtk_rgba_to_css_string(selectedForeground) + ";}"; + } + css = name + properties; + + // Cache background color + cssBackground = css; + + // Apply background color and any foreground color + String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND); + gtk_css_provider_load_from_css(context, finalCss); } - setBackgroundColorGradient (context, handle, rgba); } @Override void setCursor (int /*long*/ cursor) { int /*long*/ defaultCursor = 0; - if (cursor == 0) defaultCursor = OS.gdk_cursor_new (OS.GDK_XTERM); + if (cursor == 0) defaultCursor = OS.gdk_cursor_new_for_display (OS.gdk_display_get_default(), OS.GDK_XTERM); super.setCursor (cursor != 0 ? cursor : defaultCursor); if (cursor == 0) gdk_cursor_unref (defaultCursor); } @@ -2242,7 +2348,15 @@ @Override void setForegroundColor (GdkColor color) { - setForegroundColor (handle, color, false); + if (OS.GTK_VERSION >= OS.VERSION (3, 16, 0)) { + GdkRGBA rgba = null; + if (color != null) { + rgba = display.toGdkRGBA (color); + } + setForegroundColor (handle, rgba); + } else { + setForegroundColor (handle, color, false); + } } /** @@ -2340,7 +2454,7 @@ OS.gtk_text_buffer_get_iter_at_offset (bufferHandle, startIter, start); OS.gtk_text_buffer_place_cursor (bufferHandle, startIter); int /*long*/ mark = OS.gtk_text_buffer_get_insert (bufferHandle); - OS.gtk_text_view_scroll_mark_onscreen (handle, mark); + OS.gtk_text_view_scroll_to_mark (handle, mark, 0, true, 0, 0); } } @@ -2467,7 +2581,6 @@ * Note: If control characters like '\n', '\t' etc. are used * in the string, then the behavior is platform dependent. * </p> - * * @param string the new text * * @exception IllegalArgumentException <ul> @@ -2563,7 +2676,7 @@ OS.gtk_text_buffer_get_iter_at_offset (bufferHandle, position, 0); OS.gtk_text_buffer_place_cursor (bufferHandle, position); int /*long*/ mark = OS.gtk_text_buffer_get_insert (bufferHandle); - OS.gtk_text_view_scroll_mark_onscreen (handle, mark); + OS.gtk_text_view_scroll_to_mark (handle, mark, 0, true, 0, 0); Arrays.fill (buffer, (byte) 0); } sendEvent (SWT.Modify); @@ -2624,7 +2737,23 @@ if ((style & SWT.SINGLE) != 0) return; byte [] position = new byte [ITER_SIZEOF]; OS.gtk_text_buffer_get_iter_at_line (bufferHandle, position, index); - OS.gtk_text_view_scroll_to_iter (handle, position, 0, true, 0, 0); + if (OS.GTK3) { + /* + * Feature in GTK: create a new GtkTextMark for the purposes of + * keeping track of the top index. In getTopIndex() we can use this + * without worrying about line validation. See bug 487467. + * + * We also cache the current GtkAdjustment value for future comparison + * in getTopIndex(). + */ + byte [] buffer = Converter.wcsToMbcs (null, "index_mark", true); + indexMark = OS.gtk_text_buffer_create_mark (bufferHandle, buffer, position, true); + OS.gtk_text_view_scroll_to_mark (handle, indexMark, 0, true, 0, 0); + int /*long*/ vAdjustment = OS.gtk_scrollable_get_vadjustment (handle); + cachedAdjustment = OS.gtk_adjustment_get_value (vAdjustment); + } else { + OS.gtk_text_view_scroll_to_iter (handle, position, 0, true, 0, 0); + } } /** @@ -2644,9 +2773,9 @@ checkWidget (); if ((style & SWT.SINGLE) != 0) return; int /*long*/ mark = OS.gtk_text_buffer_get_selection_bound (bufferHandle); - OS.gtk_text_view_scroll_mark_onscreen (handle, mark); + OS.gtk_text_view_scroll_to_mark (handle, mark, 0, true, 0, 0); mark = OS.gtk_text_buffer_get_insert (bufferHandle); - OS.gtk_text_view_scroll_mark_onscreen (handle, mark); + OS.gtk_text_view_scroll_to_mark (handle, mark, 0, true, 0, 0); } int translateOffset (int offset) { diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/ToolBar.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/ToolBar.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/ToolBar.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/ToolBar.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -54,6 +54,7 @@ menuItemSelectedFunc = new Callback(ToolBar.class, "MenuItemSelectedProc", 2); if (menuItemSelectedFunc.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); } + String cssBackground, cssForeground = " "; /** * Constructs a new instance of this class given its parent @@ -132,23 +133,12 @@ handle = OS.gtk_toolbar_new (); if (handle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_container_add (fixedHandle, handle); - if ((style & SWT.FLAT) != 0) { + if ((style & SWT.FLAT) != 0 && !OS.GTK3) { byte [] swt_toolbar_flat = Converter.wcsToMbcs (null, "swt-toolbar-flat", true); OS.gtk_widget_set_name (handle, swt_toolbar_flat); } /* - * Bug in GTK. For some reason, the toolbar style context does not read - * the CSS style sheet until the window containing the toolbar is shown. - * The fix is to call gtk_style_context_invalidate() which it seems to - * force the style sheet to be read. - */ - if (OS.GTK3) { - int /*long*/ context = OS.gtk_widget_get_style_context (handle); - OS.gtk_style_context_invalidate (context); - } - - /* * Bug in GTK. GTK will segment fault if gtk_widget_reparent() is called * on a tool bar or on a widget hierarchy containing a tool bar when the icon * size is not GTK_ICON_SIZE_LARGE_TOOLBAR. The fix is to set the icon @@ -173,7 +163,7 @@ } @Override -public Point computeSize (int wHint, int hHint, boolean changed) { +Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; @@ -310,10 +300,15 @@ */ public ToolItem getItem (Point point) { checkWidget(); + return getItemInPixels(DPIUtil.autoScaleUp(point)); +} + + +ToolItem getItemInPixels (Point point) { if (point == null) error (SWT.ERROR_NULL_ARGUMENT); ToolItem[] items = getItems(); for (int i=0; i<items.length; i++) { - if (items[i].getBounds().contains(point)) return items[i]; + if (items[i].getBoundsInPixels().contains(point)) return items[i]; } return null; } @@ -486,9 +481,9 @@ event.detail = SWT.ARROW; GtkAllocation allocation = new GtkAllocation (); OS.gtk_widget_get_allocation (widget, allocation); - event.x = allocation.x; - if ((style & SWT.MIRRORED) != 0) event.x = getClientWidth () - allocation.width - event.x; - event.y = allocation.y + allocation.height; + event.x = DPIUtil.autoScaleDown(allocation.x); + if ((style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown (getClientWidth () - allocation.width) - event.x; + event.y = DPIUtil.autoScaleDown(allocation.y + allocation.height); break; case SWT.RADIO : if ((style & SWT.NO_RADIO_GROUP) == 0) item.selectRadio (); @@ -598,6 +593,24 @@ } @Override +void setBackgroundColor (int /*long*/ context, int /*long*/ handle, GdkRGBA rgba) { + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + // Form background string + String name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "toolbar" : "GtkToolbar"; + String css = name + " {background-color: " + display.gtk_rgba_to_css_string(rgba) + "}"; + + // Cache background color + this.cssBackground = css; + + // Apply background color and any foreground color + String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND); + gtk_css_provider_load_from_css(context, finalCss); + } else { + super.setBackgroundColor(context, handle, rgba); + } +} + +@Override void setFontDescription (int /*long*/ font) { super.setFontDescription (font); ToolItem [] items = getItems (); @@ -607,6 +620,17 @@ relayout (); } +void restoreBackground () { + /* + * We need to restore the cached background color in order to prevent + * setting the foreground color from overriding the background color + * (or replacing it with black). + */ + int /*long*/ context = OS.gtk_widget_get_style_context(handle); + String finalCss = display.gtk_css_create_css_color_string (this.cssBackground, cssForeground, SWT.BACKGROUND); + gtk_css_provider_load_from_css (context, finalCss); +} + @Override void setForegroundColor (GdkColor color) { super.setForegroundColor (color); diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/ToolItem.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/ToolItem.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/ToolItem.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/ToolItem.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -207,23 +207,10 @@ int /*long*/ child = OS.gtk_bin_get_child (handle); int /*long*/ list = OS.gtk_container_get_children (child); arrowHandle = OS.g_list_nth_data (list, 1); - OS.gtk_widget_set_sensitive (arrowHandle, true); - if (!OS.GTK3) { - OS.gtk_widget_set_size_request(OS.gtk_bin_get_child(arrowHandle), 8, 6); - } else { - //Disable left and right padding to not have so wide toolbars - String css ="GtkMenuButton.button {\n"+ - "padding-left: 0px;\n"+ - "padding-right: 0px;\n"+ - "}\n"; - if (provider == 0) { - //If provider is initialized the style has already been applied application wide so no need to repeat. - provider = OS.gtk_css_provider_new (); - int /*long*/ context = OS.gtk_widget_get_style_context(arrowHandle); - OS.gtk_style_context_add_provider (context, provider, OS.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - OS.g_object_unref (provider); - OS.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (null, css, true), -1, null); - OS.gtk_style_context_invalidate (context); + if (arrowHandle != 0) { + OS.gtk_widget_set_sensitive (arrowHandle, true); + if (!OS.GTK3) { + OS.gtk_widget_set_size_request(OS.gtk_bin_get_child(arrowHandle), 8, 6); } } break; @@ -312,6 +299,11 @@ * </ul> */ public Rectangle getBounds () { + checkWidget (); + return DPIUtil.autoScaleDown (getBoundsInPixels ()); +} + +Rectangle getBoundsInPixels () { checkWidget(); parent.forceResize (); int /*long*/ topHandle = topHandle (); @@ -466,6 +458,11 @@ * </ul> */ public int getWidth () { + checkWidget (); + return DPIUtil.autoScaleDown (getWidthInPixels ()); +} + +int getWidthInPixels () { checkWidget(); parent.forceResize (); int /*long*/ topHandle = topHandle (); @@ -536,9 +533,9 @@ event.detail = SWT.ARROW; GtkAllocation allocation = new GtkAllocation (); OS.gtk_widget_get_allocation (topHandle, allocation); - event.x = allocation.x; - if ((parent.style & SWT.MIRRORED) != 0) event.x = parent.getClientWidth () - allocation.width - event.x; - event.y = allocation.y + allocation.height; + event.x = DPIUtil.autoScaleDown(allocation.x); + if ((style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown (parent.getClientWidth ()- allocation.width) - event.x; + event.y = DPIUtil.autoScaleDown(allocation.y + allocation.height); } break; } @@ -585,8 +582,10 @@ int [] showImages = new int []{1}; int /*long*/ settings = OS.gtk_settings_get_default(); if (settings != 0) { - int /*long*/ property = OS.g_object_class_find_property(OS.G_OBJECT_GET_CLASS(settings), OS.gtk_menu_images); - if (property != 0) OS.g_object_get (settings, OS.gtk_menu_images, showImages, 0); + if (!OS.GTK3) { + int /*long*/ property = OS.g_object_class_find_property(OS.G_OBJECT_GET_CLASS(settings), OS.gtk_menu_images); + if (property != 0) OS.g_object_get (settings, OS.gtk_menu_images, showImages, 0); + } } /* @@ -607,10 +606,40 @@ else { label = Converter.wcsToMbcs(null, text, true); } - int /*long*/ menuItem = OS.gtk_image_menu_item_new_with_label (label); - int /*long*/ menuImage = OS.gtk_image_new_from_pixbuf (pixbuf); - OS.gtk_image_menu_item_set_image (menuItem, menuImage); + int /*long*/ menuItem; + if (OS.GTK3) { + + menuItem = OS.gtk_menu_item_new (); + if (menuItem == 0) error (SWT.ERROR_NO_HANDLES); + + int /*long*/ boxHandle = gtk_box_new (OS.GTK_ORIENTATION_HORIZONTAL, false, 6); + if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES); + + int /*long*/ menuLabel = OS.gtk_accel_label_new (label); + if (menuLabel == 0) error (SWT.ERROR_NO_HANDLES); + if (OS.GTK_VERSION >= OS.VERSION (3, 16, 0)) { + OS.gtk_label_set_xalign (labelHandle, 0); + OS.gtk_widget_set_halign (labelHandle, OS.GTK_ALIGN_FILL); + } else { + OS.gtk_misc_set_alignment(labelHandle, 0, 0); + } + + int /*long*/ menuImage = OS.gtk_image_new_from_pixbuf (pixbuf); + if (menuImage == 0) error (SWT.ERROR_NO_HANDLES); + + OS.gtk_container_add (boxHandle, menuImage); + OS.gtk_box_pack_end (boxHandle, menuLabel, true, true, 0); + OS.gtk_container_add (menuItem, boxHandle); + } else { + menuItem = OS.gtk_image_menu_item_new_with_label (label); + if (menuItem == 0) error (SWT.ERROR_NO_HANDLES); + + int /*long*/ menuImage = OS.gtk_image_new_from_pixbuf (pixbuf); + if (menuImage == 0) error (SWT.ERROR_NO_HANDLES); + OS.gtk_image_menu_item_set_image (menuItem, menuImage); + } OS.gtk_tool_item_set_proxy_menu_item (widget, buffer, menuItem); + /* * Since the arrow button does not appear in the drop_down * item, we request the menu-item and then, hook the @@ -625,6 +654,17 @@ return 0; } +void gtk_css_provider_load_from_css (int /*long*/ context, String css) { + /* Utility function. */ + //@param css : a 'css java' string like "{\nbackground: red;\n}". + if (provider == 0) { + provider = OS.gtk_css_provider_new (); + OS.gtk_style_context_add_provider (context, provider, OS.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + OS.g_object_unref (provider); + } + OS.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (null, css, true), -1, null); +} + @Override int /*long*/ gtk_enter_notify_event (int /*long*/ widget, int /*long*/ event) { parent.gtk_enter_notify_event (widget, event); @@ -839,13 +879,13 @@ * case can occur when the control is a * combo box. */ - Rectangle itemRect = getBounds (); - control.setSize (itemRect.width, itemRect.height); + Rectangle itemRect = getBoundsInPixels (); + control.setSizeInPixels (itemRect.width, itemRect.height); resizeHandle(itemRect.width, itemRect.height); - Rectangle rect = control.getBounds (); + Rectangle rect = control.getBoundsInPixels (); rect.x = itemRect.x + (itemRect.width - rect.width) / 2; rect.y = itemRect.y + (itemRect.height - rect.height) / 2; - control.setLocation (rect.x, rect.y); + control.setLocationInPixels (rect.x, rect.y); } } @@ -958,7 +998,7 @@ */ int [] x = new int [1], y = new int [1]; gdk_window_get_device_position (parent.paintWindow (), x, y, null); - if (getBounds ().contains (x [0], y [0])) { + if (getBoundsInPixels ().contains (x [0], y [0])) { OS.gtk_widget_hide (handle); OS.gtk_widget_show (handle); } @@ -984,7 +1024,37 @@ } void setForegroundColor (GdkColor color) { - if (labelHandle != 0) setForegroundColor (labelHandle, color); + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0) && labelHandle != 0) { + GdkRGBA rgba = null; + if (color != null) { + rgba = display.toGdkRGBA (color); + } + setForegroundColor (labelHandle, rgba); + } else { + if (labelHandle != 0) setForegroundColor (labelHandle, color); + } +} + +void setForegroundColor (int /*long*/ handle, GdkRGBA rgba) { + GdkRGBA toSet = new GdkRGBA(); + if (rgba != null) { + toSet = rgba; + } else { + GdkColor defaultForeground = display.COLOR_WIDGET_FOREGROUND; + toSet = display.toGdkRGBA (defaultForeground); + } + int /*long*/ context = OS.gtk_widget_get_style_context (handle); + // Form foreground string + String color = display.gtk_rgba_to_css_string(toSet); + String css = "* {color: " + color + ";}"; + + // Cache and apply foreground color + parent.cssForeground = css; + gtk_css_provider_load_from_css(context, css); + + // We need to set the parent ToolBar's background + // otherwise setting the foreground will wipe it out. + parent.restoreBackground(); } /** @@ -1219,6 +1289,11 @@ * </ul> */ public void setWidth (int width) { + checkWidget (); + setWidthInPixels(DPIUtil.autoScaleUp(width)); +} + +void setWidthInPixels (int width) { checkWidget(); if ((style & SWT.SEPARATOR) == 0) return; if (width < 0) return; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/ToolTip.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/ToolTip.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/ToolTip.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/ToolTip.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -48,6 +48,7 @@ TrayItem item; int x, y, timerId; int /*long*/ layoutText = 0, layoutMessage = 0; + int /*long*/ provider; int [] borderPolygon; boolean spikeAbove, autohide; @@ -251,7 +252,7 @@ } OS.gtk_widget_realize(handle); Region region = new Region (display); - region.add(polyline); + region.add(DPIUtil.autoScaleDown(polyline)); if (OS.GTK3) { OS.gtk_widget_shape_combine_region (handle, region.handle); } else { @@ -268,21 +269,30 @@ handle = OS.gtk_window_new (OS.GTK_WINDOW_POPUP); Color background = display.getSystemColor (SWT.COLOR_INFO_BACKGROUND); if (OS.GTK3) { - GdkColor color = background.handle; - GdkRGBA rgba = new GdkRGBA(); - rgba.alpha = 1; - rgba.red = (color.red & 0xFFFF) / (float)0xFFFF; - rgba.green = (color.green & 0xFFFF) / (float)0xFFFF; - rgba.blue = (color.blue & 0xFFFF) / (float)0xFFFF; - OS.gtk_widget_override_background_color (handle, OS.GTK_STATE_FLAG_NORMAL, rgba); + int /*long*/ context = OS.gtk_widget_get_style_context (handle); + GdkRGBA bgRGBA = display.toGdkRGBA(display.COLOR_INFO_BACKGROUND); + String name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "window" : "GtkWindow"; + String css = name + " {background-color: " + display.gtk_rgba_to_css_string(bgRGBA) + ";}"; + gtk_css_provider_load_from_css (context, css); + OS.gtk_style_context_invalidate (context); } else { OS.gtk_widget_modify_bg (handle, OS.GTK_STATE_NORMAL, background.handle); } - OS.gtk_widget_set_app_paintable (handle, true); OS.gtk_window_set_type_hint (handle, OS.GDK_WINDOW_TYPE_HINT_TOOLTIP); } } +void gtk_css_provider_load_from_css (int /*long*/ context, String css) { + /* Utility function. */ + //@param css : a 'css java' string like "{\nbackground: red;\n}". + if (provider == 0) { + provider = OS.gtk_css_provider_new (); + OS.gtk_style_context_add_provider (context, provider, OS.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + OS.g_object_unref (provider); + } + OS.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (null, css, true), -1, null); +} + @Override void createWidget (int index) { super.createWidget (index); @@ -595,6 +605,9 @@ void hookEvents () { if ((style & SWT.BALLOON) != 0) { OS.g_signal_connect_closure_by_id (handle, display.signalIds [EXPOSE_EVENT], 0, display.getClosure (EXPOSE_EVENT), true); + if (OS.GTK_VERSION >= OS.VERSION (3, 9, 0)) { + OS.g_signal_connect_closure_by_id (handle, display.signalIds [EXPOSE_EVENT_INVERSE], 0, display.getClosure (EXPOSE_EVENT_INVERSE), true); + } OS.gtk_widget_add_events (handle, OS.GDK_BUTTON_PRESS_MASK); OS.g_signal_connect_closure (handle, OS.button_press_event, display.getClosure (BUTTON_PRESS_EVENT), false); } @@ -698,13 +711,17 @@ */ public void setLocation (int x, int y) { checkWidget (); + setLocation (new Point (x, y)); +} + +void setLocationInPixels (int x, int y) { + checkWidget (); this.x = x; this.y = y; if ((style & SWT.BALLOON) != 0) { if (OS.gtk_widget_get_visible (handle)) configure (); } } - /** * Sets the location of the receiver, which must be a tooltip, * to the point specified by the argument which is relative @@ -729,8 +746,13 @@ */ public void setLocation (Point location) { checkWidget (); + setLocationInPixels(DPIUtil.autoScaleUp(location)); +} + +void setLocationInPixels (Point location) { + checkWidget (); if (location == null) error (SWT.ERROR_NULL_ARGUMENT); - setLocation (location.x, location.y); + setLocationInPixels (location.x, location.y); } /** diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Touch.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Touch.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Touch.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Touch.java 2016-07-06 19:11:33.000000000 +0000 @@ -17,7 +17,7 @@ * * @see org.eclipse.swt.events.TouchEvent * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.7 */ public final class Touch { @@ -38,7 +38,7 @@ * The state of this touch at the time it was generated. If this field is 0 * then the finger is still touching the device but has not moved * since the last <code>TouchEvent</code> was generated. - * + * * @see org.eclipse.swt.SWT#TOUCHSTATE_DOWN * @see org.eclipse.swt.SWT#TOUCHSTATE_MOVE * @see org.eclipse.swt.SWT#TOUCHSTATE_UP @@ -48,15 +48,15 @@ /** * A flag indicating that the touch is the first touch from a previous * state of no touch points. Once designated as such, the touch remains - * the primary touch until all fingers are removed from the device. + * the primary touch until all fingers are removed from the device. */ public boolean primary; - - /** + + /** * The x location of the touch in TouchSource coordinates. */ public int x; - + /** * The y location of the touch in TouchSource coordinates. */ @@ -64,9 +64,9 @@ /** * Constructs a new touch state from the given inputs. - * + * * @param identity Identity of the touch - * @param source Object representing the device that generated the touch + * @param source Object representing the device that generated the touch * @param state One of the state constants representing the state of this touch * @param primary Whether or not the touch is the primary touch * @param x X location of the touch in screen coordinates diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/TouchSource.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/TouchSource.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/TouchSource.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/TouchSource.java 2016-07-06 19:11:33.000000000 +0000 @@ -24,7 +24,7 @@ * as a tablet or a touch screen. There is a one-to-one mapping between a touch point and a location in * a window. * </li><li> - * When an instance is <em>indirect</em> (more precisely, not direct), the touch source is a track pad or + * When an instance is <em>indirect</em> (more precisely, not direct), the touch source is a track pad or * other device that normally moves the cursor, but is also able to interpret multiple touches on its surface. * In this case there is not a one-to-one mapping between the location of the touch on the device and a * location on the display because the user can remove their finger or stylus and touch another part of @@ -34,18 +34,18 @@ * * @see Touch * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.7 */ public final class TouchSource { int /*long*/ handle; - boolean direct; + boolean direct; Rectangle bounds; /** * Constructs a new touch source from the given inputs. - * - * @param direct Is the touch source direct or indirect? + * + * @param direct Is the touch source direct or indirect? * @param height height of the source in pixels. * @param width width of the source in pixels. */ diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Tracker.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Tracker.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Tracker.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Tracker.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -12,9 +12,10 @@ import org.eclipse.swt.*; -import org.eclipse.swt.internal.gtk.*; -import org.eclipse.swt.graphics.*; import org.eclipse.swt.events.*; +import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.*; +import org.eclipse.swt.internal.gtk.*; /** * Instances of this class implement rubber banding rectangles that are @@ -194,7 +195,7 @@ int newX = bounds.x + bounds.width / 2; int newY = bounds.y; - Point point = display.map (parent, null, newX, newY); + Point point = display.mapInPixels (parent, null, newX, newY); display.setCursorLocation (point); /* @@ -227,7 +228,7 @@ newY = bounds.y + bounds.height / 2; } - Point point = display.map (parent, null, newX, newY); + Point point = display.mapInPixels (parent, null, newX, newY); display.setCursorLocation (point); /* @@ -317,7 +318,7 @@ int /*long*/ region = OS.gdk_region_new (); GdkRectangle rect = new GdkRectangle(); for (int i = 0; i < rects.length; i++) { - Rectangle r = parent != null ? display.map(parent, null, rects[i]) : rects[i]; + Rectangle r = parent != null ? display.mapInPixels(parent, null, rects[i]) : rects[i]; rect.x = r.x; rect.y = r.y; rect.width = r.width + 1; @@ -375,6 +376,16 @@ Rectangle [] result = new Rectangle [rectangles.length]; for (int i = 0; i < rectangles.length; i++) { Rectangle current = rectangles [i]; + result [i] = DPIUtil.autoScaleDown (new Rectangle (current.x, current.y, current.width, current.height)); + } + return result; +} + +Rectangle [] getRectanglesInPixels () { + checkWidget(); + Rectangle [] result = new Rectangle [rectangles.length]; + for (int i = 0; i < rectangles.length; i++) { + Rectangle current = rectangles [i]; result [i] = new Rectangle (current.x, current.y, current.width, current.height); } return result; @@ -397,7 +408,7 @@ boolean grab () { int /*long*/ cursor = this.cursor != null ? this.cursor.handle : 0; - int result = gdk_pointer_grab (window, OS.GDK_OWNERSHIP_NONE, false, OS.GDK_POINTER_MOTION_MASK | OS.GDK_BUTTON_RELEASE_MASK, window, cursor, OS.GDK_CURRENT_TIME); + int result = gdk_pointer_grab (window, OS.GDK_OWNERSHIP_NONE, false, OS.GDK_POINTER_MOTION_MASK | OS.GDK_BUTTON_RELEASE_MASK, 0, cursor, OS.GDK_CURRENT_TIME); return result == OS.GDK_GRAB_SUCCESS; } @@ -442,10 +453,10 @@ rectsToErase [i] = new Rectangle (current.x, current.y, current.width, current.height); } Event event = new Event (); - event.x = oldX + xChange; - event.y = oldY + yChange; + Rectangle eventRect = new Rectangle (oldX + xChange, oldY + yChange, 0, 0); + event.setBounds (DPIUtil.autoScaleDown (eventRect)); if (parent != null && (parent.style & SWT.MIRRORED) != 0) { - event.x = parent.getClientWidth () - event.width - event.x; + event.x = DPIUtil.autoScaleDown (parent.getClientWidth ()) - event.width - event.x; } if ((style & SWT.RESIZE) != 0) { resizeRectangles (xChange, yChange); @@ -567,12 +578,12 @@ } Event event = new Event (); if (parent == null) { - event.x = newX [0]; - event.y = newY [0]; + Rectangle eventRect = new Rectangle (newX [0], newY [0], 0, 0); + event.setBounds (DPIUtil.autoScaleDown (eventRect)); } else { - Point screenCoord = display.map (parent, null, newX [0], newY [0]); - event.x = screenCoord.x; - event.y = screenCoord.y; + Point screenCoord = display.mapInPixels (parent, null, newX [0], newY [0]); + Rectangle eventRect = new Rectangle (screenCoord.x, screenCoord.y, 0, 0); + event.setBounds (DPIUtil.autoScaleDown (eventRect)); } if ((style & SWT.RESIZE) != 0) { resizeRectangles (newX [0] - oldX, newY [0] - oldY); @@ -754,12 +765,25 @@ OS.gtk_widget_realize (overlay); int /*long*/ overlayWindow = OS.gtk_widget_get_window (overlay); OS.gdk_window_set_override_redirect (overlayWindow, true); - OS.gtk_widget_override_background_color (overlay, OS.GTK_STATE_FLAG_NORMAL, new GdkRGBA()); + if (OS.GTK_VERSION < OS.VERSION (3, 16, 0)) { + OS.gtk_widget_override_background_color (overlay, OS.GTK_STATE_FLAG_NORMAL, new GdkRGBA()); + } else { + String name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "window" : "GtkWindow"; + String css = name + " {background-color: rgb(0,0,0);}"; + int /*long*/ provider = 0; + int /*long*/ context = OS.gtk_widget_get_style_context (overlay); + if (provider == 0) { + provider = OS.gtk_css_provider_new (); + OS.gtk_style_context_add_provider (context, provider, OS.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + OS.g_object_unref (provider); + } + OS.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (null, css, true), -1, null); + } int /*long*/ region = OS.gdk_region_new (); OS.gtk_widget_shape_combine_region (overlay, region); OS.gtk_widget_input_shape_combine_region (overlay, region); OS.gdk_region_destroy (region); - Rectangle bounds = display.getBounds(); + Rectangle bounds = display.getBoundsInPixels(); OS.gtk_window_move (overlay, bounds.x, bounds.y); OS.gtk_window_resize (overlay, bounds.width, bounds.height); OS.gtk_widget_show (overlay); @@ -1037,6 +1061,16 @@ checkWidget(); if (rectangles == null) error (SWT.ERROR_NULL_ARGUMENT); int length = rectangles.length; + for (int i = 0; i < length; i++) { + rectangles [i] = DPIUtil.autoScaleUp (rectangles [i]); + } + setRectanglesInPixels (rectangles); +} + +void setRectanglesInPixels (Rectangle [] rectangles) { + checkWidget(); + if (rectangles == null) error (SWT.ERROR_NULL_ARGUMENT); + int length = rectangles.length; this.rectangles = new Rectangle [length]; for (int i = 0; i < length; i++) { Rectangle current = rectangles [i]; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/TrayItem.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/TrayItem.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/TrayItem.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/TrayItem.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -293,7 +293,7 @@ OS.gtk_widget_get_allocation (widget, widgetAllocation); int xoffset = (int) Math.floor (widgetAllocation.x + ((widgetAllocation.width -OS.GTK_WIDGET_REQUISITION_WIDTH (widget)) * 0.5) + 0.5); int yoffset = (int) Math.floor (widgetAllocation.y + ((widgetAllocation.height - OS.GTK_WIDGET_REQUISITION_HEIGHT (widget)) * 0.5) + 0.5); - Rectangle b = image.getBounds(); + Rectangle b = image.getBoundsInPixels(); int /*long*/ gdkImagePtr = OS.gdk_drawable_get_image (image.mask, 0, 0, b.width, b.height); if (gdkImagePtr == 0) error(SWT.ERROR_NO_HANDLES); GdkImage gdkImage = new GdkImage(); @@ -308,7 +308,8 @@ int theByte = maskData [index] & 0xFF; int mask = 1 << (x & 0x7); if ((theByte & mask) != 0) { - region.add (xoffset + x, yoffset + y, 1, 1); + Rectangle rect = DPIUtil.autoScaleDown(new Rectangle(xoffset + x, yoffset + y, 1, 1)); + region.add(rect.x, rect.y, rect.width, rect.height); } } } diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Tray.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Tray.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Tray.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Tray.java 2016-07-06 19:11:33.000000000 +0000 @@ -16,7 +16,7 @@ /** * Instances of this class represent the system tray that is part * of the task bar status area on some operating systems. - * + * * <dl> * <dt><b>Styles:</b></dt> * <dd>(none)</dd> @@ -26,11 +26,11 @@ * <p> * IMPORTANT: This class is <em>not</em> intended to be subclassed. * </p> - * + * * @see Display#getSystemTray * @see <a href="http://www.eclipse.org/swt/snippets/#tray">Tray, TrayItem snippets</a> * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * + * * @since 3.0 * @noextend This class is not intended to be subclassed by clients. */ @@ -47,7 +47,7 @@ this.display = display; reskinWidget (); } - + void createItem (TrayItem item, int index) { if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_INVALID_RANGE); if (itemCount == items.length) { @@ -108,11 +108,11 @@ /** * Returns an array of <code>TrayItem</code>s which are the items - * in the receiver. + * in the receiver. * <p> * Note: This is not the actual structure used by the receiver * to maintain its list of items, so modifying the array will - * not affect the receiver. + * not affect the receiver. * </p> * * @return the items in the receiver @@ -150,7 +150,7 @@ } @Override -void reskinChildren (int flags) { +void reskinChildren (int flags) { if (items != null) { for (int i=0; i<items.length; i++) { TrayItem item = items [i]; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/TreeColumn.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/TreeColumn.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/TreeColumn.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/TreeColumn.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -12,10 +12,10 @@ import org.eclipse.swt.*; +import org.eclipse.swt.events.*; +import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.events.*; /** * Instances of this class represent a column in a tree widget. @@ -322,6 +322,11 @@ * </ul> */ public int getWidth () { + checkWidget (); + return DPIUtil.autoScaleDown (getWidthInPixels ()); +} + +int getWidthInPixels () { checkWidget(); if (!OS.gtk_tree_view_column_get_visible (handle)) { return 0; @@ -449,7 +454,7 @@ } OS.g_free (iter); } - setWidth(width); + setWidthInPixels(width); } @Override @@ -689,6 +694,11 @@ * </ul> */ public void setWidth (int width) { + checkWidget (); + setWidthInPixels (DPIUtil.autoScaleUp (width)); +} + +void setWidthInPixels (int width) { checkWidget(); if (width < 0) return; if (width == lastWidth) return; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/TreeItem.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/TreeItem.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/TreeItem.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/TreeItem.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -40,6 +40,7 @@ Font[] cellFont; boolean cached, grayed, isExpanded; static final int EXPANDER_EXTRA_PADDING = 4; + int columnSetHeight, columnSetWidth; /** * Constructs a new instance of this class given its parent @@ -421,6 +422,11 @@ * @since 3.1 */ public Rectangle getBounds (int index) { + checkWidget (); + return DPIUtil.autoScaleDown (getBoundsInPixels (index)); +} + +Rectangle getBoundsInPixels (int index) { // TODO fully test on early and later versions of GTK checkWidget(); if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED); @@ -449,7 +455,7 @@ int width = OS.gtk_tree_view_column_get_visible (column) ? rect.width + 1 : 0; Rectangle r = new Rectangle (rect.x, rect.y, width, rect.height + 1); if (parent.getHeaderVisible() && OS.GTK_VERSION > OS.VERSION(3, 9, 0)) { - r.y += parent.getHeaderHeight(); + r.y += parent.getHeaderHeightInPixels(); } return r; } @@ -466,6 +472,11 @@ * </ul> */ public Rectangle getBounds () { + checkWidget (); + return DPIUtil.autoScaleDown (getBoundsInPixels ()); +} + +Rectangle getBoundsInPixels () { // TODO fully test on early and later versions of GTK // shifted a bit too far right on later versions of GTK - however, old Tree also had this problem checkWidget (); @@ -509,7 +520,11 @@ } } int width = OS.gtk_tree_view_column_get_visible (column) ? rect.width + 1 : 0; - return new Rectangle (rect.x, rect.y, width, rect.height + 1); + Rectangle r = new Rectangle (rect.x, rect.y, width, rect.height + 1); + if (parent.getHeaderVisible() && OS.GTK_VERSION > OS.VERSION(3, 9, 0)) { + r.y += parent.getHeaderHeightInPixels(); + } + return r; } /** @@ -696,6 +711,11 @@ * @since 3.1 */ public Rectangle getImageBounds (int index) { + checkWidget (); + return DPIUtil.autoScaleDown(getImageBoundsInPixels(index)); +} + +Rectangle getImageBoundsInPixels (int index) { // TODO fully test on early and later versions of GTK checkWidget (); if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED); @@ -715,10 +735,35 @@ OS.gtk_tree_view_get_cell_area (parentHandle, path, column, rect); if ((parent.getStyle () & SWT.MIRRORED) != 0) rect.x = parent.getClientWidth () - rect.width - rect.x; OS.gtk_tree_path_free (path); - - int [] x = new int [1], w = new int[1]; + /* + * Feature in GTK. When a pixbufRenderer has size of 0x0, gtk_tree_view_column_cell_get_position + * returns a position of 0 as well. This causes offset issues meaning that images/widgets/etc. + * can be placed over the text. We need to account for the base case of a pixbufRenderer that has + * yet to be sized, as per Bug 469277 & 476419. NOTE: this change has been ported to Tables since Tables/Trees both + * use the same underlying GTK structure. + */ + int [] x = new int [1], w = new int [1]; OS.gtk_tree_view_column_cell_get_position (column, pixbufRenderer, x, w); - rect.x += x [0]; + if (OS.GTK3) { + if (parent.pixbufSizeSet) { + if (x [0] > 0) { + rect.x += x [0]; + } + } else { + /* + * If the size of the pixbufRenderer hasn't been set, we need to take into account the + * position of the textRenderer, to ensure images/widgets/etc. aren't placed over the TreeItem's + * text. + */ + int /*long*/ textRenderer = parent.getTextRenderer (column); + if (textRenderer == 0) return new Rectangle (0, 0, 0, 0); + int [] xText = new int [1], wText = new int [1]; + OS.gtk_tree_view_column_cell_get_position (column, textRenderer, xText, wText); + rect.x += xText [0]; + } + } else { + rect.x += x [0]; + } rect.width = w [0]; int width = OS.gtk_tree_view_column_get_visible (column) ? rect.width : 0; return new Rectangle (rect.x, rect.y, width, rect.height + 1); @@ -885,6 +930,11 @@ */ public Rectangle getTextBounds (int index) { checkWidget (); + return DPIUtil.autoScaleDown(getTextBoundsInPixels(index)); +} + +Rectangle getTextBoundsInPixels (int index) { + checkWidget (); if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED); int count = Math.max (1, parent.getColumnCount ()); if (0 > index || index > count - 1) return new Rectangle (0, 0, 0, 0); @@ -925,7 +975,27 @@ int horizontalSeparator = buffer[0]; rect.x += horizontalSeparator; OS.gtk_tree_view_column_cell_get_position (column, textRenderer, x, null); - rect.x += x [0]; + /* + * Fix for Eclipse bug 476562, we need to re-adjust the bounds for the text + * when the separator value is less than the width of the image. Previously + * images larger than 16px in width would be cut off on the right side. + * NOTE: this change has been ported to Tables since Tables/Trees both use the + * same underlying GTK structure. + */ + if (OS.GTK3) { + Image image = _getImage(index); + int imageWidth = 0; + if (image != null) { + imageWidth = image.getBoundsInPixels ().width; + } + if (x [0] < imageWidth) { + rect.x += imageWidth; + } else { + rect.x += x [0]; + } + } else { + rect.x += x [0]; + } if (parent.columnCount > 0) { if (rect.x + rect.width > right) { rect.width = Math.max (0, right - rect.x); @@ -1434,6 +1504,57 @@ pixbuf = imageList.getPixbuf (imageIndex); } int modelIndex = parent.columnCount == 0 ? Tree.FIRST_COLUMN : parent.columns [index].modelIndex; + /* + * Reset size of pixbufRenderer if we have an image being set that is larger + * than the current size of the pixbufRenderer. Fix for Bug 469277 & 476419. + * We only do this if the size of the pixbufRenderer has not yet been set. + * Otherwise, the pixbufRenderer retains the same size as the first image added. + * See comment #4, Bug 478560. Note that all columns need to have their + * pixbufRenderer set to this size after the initial image is set. NOTE: this + * change has been ported to Tables since Tables/Trees both use the same + * underlying GTK structure. + */ + if (OS.GTK3) { + int /*long*/parentHandle = parent.handle; + int /*long*/ column = OS.gtk_tree_view_get_column (parentHandle, index); + int /*long*/ pixbufRenderer = parent.getPixbufRenderer (column); + int [] currentWidth = new int [1]; + int [] currentHeight= new int [1]; + OS.gtk_cell_renderer_get_fixed_size (pixbufRenderer, currentWidth, currentHeight); + if (!parent.pixbufSizeSet) { + if (image != null) { + int iWidth = image.getBoundsInPixels ().width; + int iHeight = image.getBoundsInPixels ().height; + if (iWidth > currentWidth [0] || iHeight > currentHeight [0]) { + OS.gtk_cell_renderer_set_fixed_size (pixbufRenderer, iWidth, iHeight); + parent.pixbufSizeSet = true; + columnSetHeight = iHeight; + columnSetWidth = iWidth; + parent.pixbufHeight = iHeight; + parent.pixbufWidth = iWidth; + /* + * Feature in GTK: a Tree with the style SWT.VIRTUAL has + * fixed-height-mode enabled. This will limit the size of + * any cells, including renderers. In order to prevent + * images from disappearing/being cropped, we re-create + * the renderers when the first image is set. Fix for + * bug 480261. + */ + if ((parent.style & SWT.VIRTUAL) != 0) { + parent.createRenderers(column, modelIndex, ((parent.style & SWT.CHECK) != 0) , parent.style); + } + } + } + } else { + /* + * We check to see if the cached value is greater than the size of the pixbufRenderer. + * If it is, then we change the size of the pixbufRenderer accordingly. + */ + if (columnSetWidth > currentWidth [0] || columnSetHeight > currentHeight [0]) { + OS.gtk_cell_renderer_set_fixed_size (pixbufRenderer, columnSetWidth, columnSetHeight); + } + } + } OS.gtk_tree_store_set (parent.modelHandle, handle, modelIndex + Tree.CELL_PIXBUF, pixbuf, -1); /* * Bug in GTK. When using fixed-height-mode, GTK does not recalculate the cell renderer width @@ -1447,7 +1568,7 @@ int [] w = new int [1]; int /*long*/ pixbufRenderer = parent.getPixbufRenderer(column); OS.gtk_tree_view_column_cell_get_position (column, pixbufRenderer, null, w); - if (w[0] < image.getBounds().width) { + if (w[0] < image.getBoundsInPixels().width) { /* * There is no direct way to clear the cell renderer width so we * are relying on the fact that it is done as part of modifying diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Tree.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Tree.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Tree.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Tree.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -89,7 +89,9 @@ boolean expandAll; int drawState, drawFlags; GdkColor drawForeground; - boolean ownerDraw, ignoreSize, ignoreAccessibility; + GdkRGBA background; + boolean ownerDraw, ignoreSize, ignoreAccessibility, pixbufSizeSet; + int pixbufHeight, pixbufWidth; static final int ID_COLUMN = 0; static final int CHECKED_COLUMN = 1; @@ -536,7 +538,7 @@ } @Override -public Point computeSize (int wHint, int hHint, boolean changed) { +Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; @@ -545,12 +547,15 @@ if (size.x == 0 && wHint == SWT.DEFAULT) size.x = DEFAULT_WIDTH; /* - * in GTK 3.8 computeNativeSize returning 0 for height. - * So if the height is returned as zero calculate the tree height - * based on the number of items in the table + * In GTK 3, computeNativeSize(..) sometimes just returns the header + * height as height. In that case, calculate the tree height based on + * the number of items at the root of the tree. + * FIXME: This calculation neglects children of expanded tree items. + * When fixing that, be careful not to use getItems (), since that + * would realize too many VIRTUAL TreeItems (similar to bug 490203). */ - if (OS.GTK3 && size.y == 0 && hHint == SWT.DEFAULT) { - size.y = getItemCount() * getItemHeight(); + if (OS.GTK3 && hHint == SWT.DEFAULT && size.y == getHeaderHeight()) { + size.y = getItemCount() * getItemHeightInPixels() + getHeaderHeight(); } /* @@ -559,7 +564,7 @@ * so need to assign default height */ if (size.y == 0 && hHint == SWT.DEFAULT) size.y = DEFAULT_HEIGHT; - Rectangle trim = computeTrim (0, 0, size.x, size.y); + Rectangle trim = computeTrimInPixels (0, 0, size.x, size.y); size.x = trim.width; size.y = trim.height; return size; @@ -741,6 +746,9 @@ int vsp = (style & SWT.V_SCROLL) != 0 ? OS.GTK_POLICY_AUTOMATIC : OS.GTK_POLICY_NEVER; OS.gtk_scrolled_window_set_policy (scrolledHandle, hsp, vsp); if ((style & SWT.BORDER) != 0) OS.gtk_scrolled_window_set_shadow_type (scrolledHandle, OS.GTK_SHADOW_ETCHED_IN); + /* + * We enable fixed-height-mode for performance reasons (see bug 490203). + */ if ((style & SWT.VIRTUAL) != 0) { OS.g_object_set (handle, OS.fixed_height_mode, true, 0); } @@ -861,7 +869,21 @@ } else { // set default size this size is used for calculating the icon and text positions in a tree if ((!ownerDraw) && (OS.GTK3)) { - OS.gtk_cell_renderer_set_fixed_size(pixbufRenderer, 16, 16); + /* + * When SWT.VIRTUAL is specified, size the pixbuf renderer + * according to the size of the first image set. If no image + * is set, specify a size of 0x0 like for all other Tree + * styles. Fix for bug 480261. + */ + if ((style & SWT.VIRTUAL) != 0 && pixbufSizeSet) { + OS.gtk_cell_renderer_set_fixed_size(pixbufRenderer, pixbufHeight, pixbufWidth); + } else { + /* + * For all other styles, set render size to 0x0 until we + * actually add images, fix for bugs 469277 & 476419. + */ + OS.gtk_cell_renderer_set_fixed_size(pixbufRenderer, 0, 0); + } } } int /*long*/ textRenderer = ownerDraw ? OS.g_object_new (display.gtk_cell_renderer_text_get_type (), 0) : OS.gtk_cell_renderer_text_new (); @@ -899,8 +921,14 @@ OS.gtk_tree_view_column_set_alignment (columnHandle, 0f); } - /* Add attributes */ - OS.gtk_tree_view_column_add_attribute (columnHandle, pixbufRenderer, OS.GTK3 ? OS.gicon : OS.pixbuf, modelIndex + CELL_PIXBUF); + /* + * Add attributes + * + * Formerly OS.gicon was set if on GTK3, but this is being removed do to spacing issues in Tables/Trees with + * no images. Fix for Bug 469277 & 476419. NOTE: this change has been ported to Tables since Tables/Trees both + * use the same underlying GTK structure. + */ + OS.gtk_tree_view_column_add_attribute (columnHandle, pixbufRenderer, OS.pixbuf, modelIndex + CELL_PIXBUF); if (!ownerDraw) { OS.gtk_tree_view_column_add_attribute (columnHandle, pixbufRenderer, OS.cell_background_gdk, BACKGROUND_COLUMN); OS.gtk_tree_view_column_add_attribute (columnHandle, textRenderer, OS.cell_background_gdk, BACKGROUND_COLUMN); @@ -1132,7 +1160,7 @@ } @Override -public Rectangle getClientArea () { +Rectangle getClientAreaInPixels () { checkWidget (); forceResize (); OS.gtk_widget_realize (handle); @@ -1149,7 +1177,7 @@ int height = (state & ZERO_HEIGHT) != 0 ? 0 : allocation.height; Rectangle rect = new Rectangle (fixedX [0] - binX [0], fixedY [0] - binY [0], width, height); if (getHeaderVisible() && OS.GTK_VERSION > OS.VERSION(3, 9, 0)) { - rect.y += getHeaderHeight(); + rect.y += getHeaderHeightInPixels(); } return rect; } @@ -1326,6 +1354,21 @@ return result; } +@Override +GdkColor getContextBackground () { + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + if (background != null) { + return display.toGdkColor (background); + } else { + // For Tables and Trees, the default background is + // COLOR_LIST_BACKGROUND instead of COLOR_WIDGET_BACKGROUND. + return display.COLOR_LIST_BACKGROUND; + } + } else { + return super.getContextBackground (); + } +} + TreeItem getFocusItem () { int /*long*/ [] path = new int /*long*/ [1]; OS.gtk_tree_view_get_cursor (handle, path, null); @@ -1360,6 +1403,11 @@ * @since 3.1 */ public int getGridLineWidth () { + checkWidget (); + return DPIUtil.autoScaleDown (getGridLineWidthInPixels ()); +} + +int getGridLineWidthInPixels () { checkWidget(); return 0; } @@ -1378,6 +1426,11 @@ */ public int getHeaderHeight () { checkWidget (); + return DPIUtil.autoScaleDown (getHeaderHeightInPixels ()); +} + +int getHeaderHeightInPixels () { + checkWidget (); if (!OS.gtk_tree_view_get_headers_visible (handle)) return 0; if (columnCount > 0) { GtkRequisition requisition = new GtkRequisition (); @@ -1474,6 +1527,11 @@ * </ul> */ public TreeItem getItem (Point point) { + checkWidget(); + return getItemInPixels(DPIUtil.autoScaleUp(point)); +} + +TreeItem getItemInPixels (Point point) { checkWidget (); if (point == null) error (SWT.ERROR_NULL_ARGUMENT); int /*long*/ [] path = new int /*long*/ [1]; @@ -1481,7 +1539,7 @@ int x = point.x; int y = point.y; if (getHeaderVisible() && OS.GTK_VERSION > OS.VERSION(3, 9, 0)) { - y -= getHeaderHeight(); + y -= getHeaderHeightInPixels(); } if ((style & SWT.MIRRORED) != 0) x = getClientWidth () - x; int /*long*/ [] columnHandle = new int /*long*/ [1]; @@ -1540,6 +1598,11 @@ */ public int getItemHeight () { checkWidget (); + return DPIUtil.autoScaleDown (getItemHeightInPixels ()); +} + +int getItemHeightInPixels () { + checkWidget (); int itemCount = OS.gtk_tree_model_iter_n_children (modelHandle, 0); if (itemCount == 0) { int /*long*/ column = OS.gtk_tree_view_get_column (handle, 0); @@ -1877,19 +1940,69 @@ } } } - /* - * Bug in GTK. GTK segments fault, if the GtkTreeView widget is - * not in focus and all items in the widget are disposed before - * it finishes processing a button press. The fix is to give - * focus to the widget before it starts processing the event. - */ - if (!OS.gtk_widget_has_focus (handle)) { - OS.gtk_widget_grab_focus (handle); + + //If Mouse double-click pressed, manually send a DefaultSelection. See Bug 312568. + if (gdkEvent.type == OS.GDK_2BUTTON_PRESS) { + sendTreeDefaultSelection (); } + return result; } @Override +int /*long*/ gtk_key_press_event (int /*long*/ widget, int /*long*/ event) { + GdkEventKey keyEvent = new GdkEventKey (); + OS.memmove (keyEvent, event, GdkEventKey.sizeof); + int key = keyEvent.keyval; + keyPressDefaultSelectionHandler (event, key); + return super.gtk_key_press_event (widget, event); +} + +/** + * Used to emulate DefaultSelection event. See Bug 312568. + * @param event the gtk key press event that was fired. + */ +void keyPressDefaultSelectionHandler (int /*long*/ event, int key) { + + int keymask = gdk_event_get_state (event); + switch (key) { + case OS.GDK_Return: + //Send Default selection return only when no other modifier is pressed. + if ((keymask & (OS.GDK_MOD1_MASK | OS.GDK_SHIFT_MASK | OS.GDK_CONTROL_MASK + | OS.GDK_SUPER_MASK | OS.GDK_META_MASK | OS.GDK_HYPER_MASK)) == 0) { + sendTreeDefaultSelection (); + } + break; + case OS.GDK_space: + //Shift + Space is a legal DefaultSelection event. (as per row-activation signal documentation). + //But do not send if another modifier is pressed. + if ((keymask & (OS.GDK_MOD1_MASK | OS.GDK_CONTROL_MASK + | OS.GDK_SUPER_MASK | OS.GDK_META_MASK | OS.GDK_HYPER_MASK)) == 0) { + sendTreeDefaultSelection (); + } + break; + } +} + +//Used to emulate DefaultSelection event. See Bug 312568. +//Feature in GTK. 'row-activation' event comes before DoubleClick event. +//This is causing the editor not to get focus after doubleclick. +//The solution is to manually send the DefaultSelection event after a doubleclick, +//and to emulate it for Space/Return. +void sendTreeDefaultSelection() { + + //Note, similar DefaultSelectionHandling in SWT List/Table/Tree + TreeItem treeItem = getFocusItem (); + if (treeItem == null) + return; + + Event event = new Event (); + event.item = treeItem; + + sendSelectionEvent (SWT.DefaultSelection, event, false); +} + +@Override int /*long*/ gtk_button_release_event (int /*long*/ widget, int /*long*/ event) { int /*long*/ window = OS.GDK_EVENT_WINDOW (event); if (window != OS.gtk_tree_view_get_bin_window (handle)) return 0; @@ -1993,23 +2106,6 @@ } @Override -int /*long*/ gtk_row_activated (int /*long*/ tree, int /*long*/ path, int /*long*/ column) { - if (path == 0) return 0; - TreeItem item = null; - int /*long*/ iter = OS.g_malloc (OS.GtkTreeIter_sizeof ()); - if (OS.gtk_tree_model_get_iter (modelHandle, iter, path)) { - int [] index = new int [1]; - OS.gtk_tree_model_get (modelHandle, iter, ID_COLUMN, index, -1); - item = items [index [0]]; - } - OS.g_free (iter); - Event event = new Event (); - event.item = item; - sendSelectionEvent (SWT.DefaultSelection, event, false); - return 0; -} - -@Override int /*long*/ gtk_row_deleted (int /*long*/ model, int /*long*/ path) { if (ignoreAccessibility) { OS.g_signal_stop_emission_by_name (model, OS.row_deleted); @@ -2564,7 +2660,7 @@ Image image = item.getImage (columnIndex); int imageWidth = 0; if (image != null) { - Rectangle bounds = image.getBounds (); + Rectangle bounds = image.getBoundsInPixels (); imageWidth = bounds.width; } contentWidth [0] += imageWidth; @@ -2574,8 +2670,8 @@ event.item = item; event.index = columnIndex; event.gc = gc; - event.width = contentWidth [0]; - event.height = contentHeight [0]; + Rectangle eventRect = new Rectangle (0, 0, contentWidth [0], contentHeight [0]); + event.setBounds (DPIUtil.autoScaleDown (eventRect)); int /*long*/ path = OS.gtk_tree_model_get_path (modelHandle, iter); int /*long*/ selection = OS.gtk_tree_view_get_selection (handle); if (OS.gtk_tree_selection_path_is_selected (selection, path)) { @@ -2584,8 +2680,9 @@ OS.gtk_tree_path_free (path); sendEvent (SWT.MeasureItem, event); gc.dispose (); - contentWidth [0] = event.width - imageWidth; - if (contentHeight [0] < event.height) contentHeight [0] = event.height; + Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ()); + contentWidth [0] = rect.width - imageWidth; + if (contentHeight [0] < rect.height) contentHeight [0] = rect.height; if (width != 0) OS.memmove (width, contentWidth, 4); if (height != 0) OS.memmove (height, contentHeight, 4); if (OS.GTK3) { @@ -2642,7 +2739,8 @@ } } if (item != null) { - if (OS.GTK_IS_CELL_RENDERER_TOGGLE (cell) || (OS.GTK_IS_CELL_RENDERER_PIXBUF (cell) && (columnIndex != 0 || (style & SWT.CHECK) == 0))) { + if (OS.GTK_IS_CELL_RENDERER_TOGGLE (cell) || + ( (OS.GTK_IS_CELL_RENDERER_PIXBUF (cell) || OS.GTK_VERSION > OS.VERSION(3, 13, 0)) && (columnIndex != 0 || (style & SWT.CHECK) == 0))) { drawFlags = (int)/*64*/flags; drawState = SWT.FOREGROUND; int /*long*/ [] ptr = new int /*long*/ [1]; @@ -2723,25 +2821,27 @@ if (OS.GTK_VERSION >= OS.VERSION(3, 9, 0) && cr != 0) { GdkRectangle r = new GdkRectangle(); OS.gdk_cairo_get_clip_rectangle(cr, r); - gc.setClipping(rect.x, r.y, r.width, r.height); + Rectangle rect2 = DPIUtil.autoScaleDown(new Rectangle(rect.x, r.y, r.width, r.height)); + // Caveat: rect2 is necessary because GC#setClipping(Rectangle) got broken by bug 446075 + gc.setClipping(rect2.x, rect2.y, rect2.width, rect2.height); + if (OS.GTK_VERSION <= OS.VERSION(3, 14, 8)) { + rect.width = r.width; + } } else { - gc.setClipping (rect.x, rect.y, rect.width, rect.height); + Rectangle rect2 = DPIUtil.autoScaleDown(new Rectangle(rect.x, rect.y, rect.width, rect.height)); + // Caveat: rect2 is necessary because GC#setClipping(Rectangle) got broken by bug 446075 + gc.setClipping(rect2.x, rect2.y, rect2.width, rect2.height); } Event event = new Event (); event.item = item; event.index = columnIndex; event.gc = gc; - event.x = rect.x; - event.y = rect.y; - event.width = rect.width; - event.height = rect.height; + Rectangle eventRect = new Rectangle (rect.x, rect.y, rect.width, rect.height); + event.setBounds (DPIUtil.autoScaleDown (eventRect)); event.detail = drawState; sendEvent (SWT.EraseItem, event); drawForeground = null; drawState = event.doit ? event.detail : 0; - if (OS.GTK3 && OS.GTK_VERSION <= OS.VERSION(3, 14, 8)) { - drawState |= SWT.FOREGROUND; - } drawFlags &= ~(OS.GTK_CELL_RENDERER_FOCUSED | OS.GTK_CELL_RENDERER_SELECTED); if ((drawState & SWT.SELECTED) != 0) drawFlags |= OS.GTK_CELL_RENDERER_SELECTED; if ((drawState & SWT.FOCUSED) != 0) drawFlags |= OS.GTK_CELL_RENDERER_FOCUSED; @@ -2765,7 +2865,7 @@ gc.setBackground (item.getBackground (columnIndex)); GdkRectangle rect = new GdkRectangle (); OS.memmove (rect, background_area, GdkRectangle.sizeof); - gc.fillRectangle (rect.x, rect.y, rect.width, rect.height); + gc.fillRectangle(DPIUtil.autoScaleDown(new Rectangle(rect.x, rect.y, rect.width, rect.height))); gc.dispose (); } if ((drawState & SWT.FOREGROUND) != 0 || OS.GTK_IS_CELL_RENDERER_TOGGLE (cell)) { @@ -2785,10 +2885,8 @@ if (OS.GTK_IS_CELL_RENDERER_TEXT (cell)) { if (hooks (SWT.PaintItem)) { GdkRectangle rect = new GdkRectangle (); - GdkRectangle clipRect = new GdkRectangle (); int /*long*/ path = OS.gtk_tree_model_get_path (modelHandle, iter); OS.gtk_tree_view_get_cell_area (handle, path, columnHandle, rect); - OS.gtk_tree_view_get_background_area (handle, path, columnHandle, clipRect); OS.gtk_tree_path_free (path); // A workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=459117 if (cr != 0 && OS.GTK_VERSION > OS.VERSION(3, 9, 0) && OS.GTK_VERSION <= OS.VERSION(3, 14, 8)) { @@ -2805,7 +2903,7 @@ Image image = item.getImage (columnIndex); int imageWidth = 0; if (image != null) { - Rectangle bounds = image.getBounds (); + Rectangle bounds = image.getBoundsInPixels (); imageWidth = bounds.width; } // On gtk >3.9 and <3.14.8 the clip rectangle does not have image area into clip rectangle @@ -2841,25 +2939,20 @@ gc.setFont (item.getFont (columnIndex)); if ((style & SWT.MIRRORED) != 0) { rect.x = getClientWidth () - rect.width - rect.x; - clipRect.x = getClientWidth () - clipRect.width - clipRect.x; } - if (!OS.GTK3){ - gc.setClipping (clipRect.x, clipRect.y, clipRect.width, clipRect.height); - } + Rectangle rect2 = DPIUtil.autoScaleDown(new Rectangle(rect.x, rect.y, rect.width, rect.height)); + // Caveat: rect2 is necessary because GC#setClipping(Rectangle) got broken by bug 446075 + gc.setClipping(rect2.x, rect2.y, rect2.width, rect2.height); Event event = new Event (); event.item = item; event.index = columnIndex; event.gc = gc; - event.x = rect.x + contentX [0]; - event.y = rect.y; - event.width = contentWidth [0]; - event.height = rect.height; + Rectangle eventRect = new Rectangle (rect.x + contentX [0], rect.y, contentWidth [0], rect.height); + event.setBounds (DPIUtil.autoScaleDown (eventRect)); event.detail = drawState; - if (!OS.GTK3 || OS.GTK_VERSION > OS.VERSION(3, 14, 8)) { - sendEvent (SWT.PaintItem, event); - } + sendEvent(SWT.PaintItem, event); gc.dispose(); } } @@ -2939,7 +3032,7 @@ } if (item.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); if (item.parent != this) return; - Rectangle rect = item.getBounds(); + Rectangle rect = item.getBoundsInPixels(); int /*long*/ [] path = new int /*long*/ [1]; OS.gtk_widget_realize (handle); if (!OS.gtk_tree_view_get_path_at_pos(handle, rect.x, rect.y, path, null, null, null)) return; @@ -3053,17 +3146,38 @@ super.setBackgroundColor (color); if (!OS.GTK3) { OS.gtk_widget_modify_base (handle, 0, color); - } else { - // Setting the background color overrides the selected background color - // so we have to reset it the default. - GdkColor defaultColor = getDisplay().COLOR_LIST_SELECTION; - GdkRGBA selectedBackground = new GdkRGBA (); - selectedBackground.alpha = 1; - selectedBackground.red = (defaultColor.red & 0xFFFF) / (float)0xFFFF; - selectedBackground.green = (defaultColor.green & 0xFFFF) / (float)0xFFFF; - selectedBackground.blue = (defaultColor.blue & 0xFFFF) / (float)0xFFFF; + } +} - OS.gtk_widget_override_background_color (handle, OS.GTK_STATE_FLAG_SELECTED, selectedBackground); +@Override +void setBackgroundColor (int /*long*/ context, int /*long*/ handle, GdkRGBA rgba) { + /* Setting the background color overrides the selected background color. + * To prevent this, we need to re-set the default. This can be done with CSS + * on GTK3.16+, or by using GtkStateFlags as an argument to + * gtk_widget_override_background_color() on versions of GTK3 less than 3.16. + */ + if (rgba == null) { + GdkColor temp = getDisplay().COLOR_LIST_BACKGROUND; + background = display.toGdkRGBA (temp); + } else { + background = rgba; + } + GdkColor defaultColor = getDisplay().COLOR_LIST_SELECTION; + GdkRGBA selectedBackground = display.toGdkRGBA (defaultColor); + if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { + String name = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "treeview" : "GtkTreeView"; + String css = name + " {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n" + + name + ":selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}"; + + // Cache background color + cssBackground = css; + + // Apply background color and any foreground color + String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND); + gtk_css_provider_load_from_css(context, finalCss); + } else { + super.setBackgroundColor(context, handle, rgba); + OS.gtk_widget_override_background_color(handle, OS.GTK_STATE_FLAG_SELECTED, selectedBackground); } } @@ -3148,7 +3262,15 @@ @Override void setForegroundColor (GdkColor color) { - setForegroundColor (handle, color, false); + if (OS.GTK_VERSION >= OS.VERSION (3, 16, 0)) { + GdkRGBA rgba = null; + if (color != null) { + rgba = display.toGdkRGBA (color); + } + setForegroundColor (handle, rgba); + } else { + setForegroundColor (handle, color, false); + } } /** diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/TypedListener.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/TypedListener.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/TypedListener.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/TypedListener.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -15,9 +15,9 @@ import org.eclipse.swt.*; import org.eclipse.swt.events.*; -/** +/** * Instances of this class are <em>internal SWT implementation</em> - * objects which provide a mapping between the typed and untyped + * objects which provide a mapping between the typed and untyped * listener mechanisms that SWT supports. * <p> * <b>IMPORTANT:</b> This class is <em>not</em> part of the SWT @@ -30,7 +30,7 @@ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public class TypedListener implements Listener { - + /** * The receiver's event listener */ @@ -46,7 +46,7 @@ * </p> * * @param listener the event listener to store in the receiver - * + * * @noreference This method is not intended to be referenced by clients. */ public TypedListener (SWTEventListener listener) { @@ -63,7 +63,7 @@ * </p> * * @return the receiver's event listener - * + * * @noreference This method is not intended to be referenced by clients. */ public SWTEventListener getEventListener () { @@ -79,9 +79,10 @@ * referenced from application code. * </p> * @param e the event to handle - * + * * @noreference This method is not intended to be referenced by clients. */ +@Override public void handleEvent (Event e) { switch (e.type) { case SWT.Activate: { @@ -103,7 +104,7 @@ if (eventListener instanceof TreeListener) { ((TreeListener) eventListener).treeCollapsed(new TreeEvent(e)); } else { - ((ExpandListener) eventListener).itemCollapsed(new ExpandEvent(e)); + ((ExpandListener) eventListener).itemCollapsed(new ExpandEvent(e)); } break; } @@ -131,7 +132,7 @@ if (eventListener instanceof TreeListener) { ((TreeListener) eventListener).treeExpanded(new TreeEvent(e)); } else { - ((ExpandListener) eventListener).itemExpanded(new ExpandEvent(e)); + ((ExpandListener) eventListener).itemExpanded(new ExpandEvent(e)); } break; } @@ -245,7 +246,7 @@ case SWT.Selection: { /* Fields set by Sash */ SelectionEvent event = new SelectionEvent (e); - ((SelectionListener) eventListener).widgetSelected (event); + ((SelectionListener) eventListener).widgetSelected (event); e.x = event.x; e.y = event.y; e.doit = event.doit; diff -Nru swt4-gtk-4.5.0/org/eclipse/swt/widgets/Widget.java swt4-gtk-4.6.0/org/eclipse/swt/widgets/Widget.java --- swt4-gtk-4.5.0/org/eclipse/swt/widgets/Widget.java 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/org/eclipse/swt/widgets/Widget.java 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 IBM Corporation and others. + * Copyright (c) 2000, 2016 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 @@ -104,7 +104,7 @@ /* Bidi "auto" text direction */ static final int HAS_AUTO_DIRECTION = 0; - + /* Bidi flag and for auto text direction */ static final int AUTO_TEXT_DIRECTION = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT; @@ -201,6 +201,7 @@ static final String IS_ACTIVE = "org.eclipse.swt.internal.control.isactive"; //$NON-NLS-1$ static final String KEY_CHECK_SUBWINDOW = "org.eclipse.swt.internal.control.checksubwindow"; //$NON-NLS-1$ + static final String KEY_GTK_CSS = "org.eclipse.swt.internal.gtk.css"; //$NON-NLS-1$ /** * Prevents uninitialized instances from being created outside the package. @@ -538,7 +539,7 @@ if (key.equals (KEY_CHECK_SUBWINDOW)) { return new Boolean ((state & CHECK_SUBWINDOW) != 0); } - if (key.equals(IS_ACTIVE)) return new Boolean(isActive ()); + if (key.equals(IS_ACTIVE)) return Boolean.valueOf(isActive ()); if ((state & KEYED_DATA) != 0) { Object [] table = (Object []) data; for (int i=1; i<table.length; i+=2) { @@ -819,6 +820,8 @@ int /*long*/ gtk_row_activated (int /*long*/ tree, int /*long*/ path, int /*long*/ column) { return 0; + //Note on SWT Tree/Table/List. This signal is no longer used. Instead SendDefaultSelection is + //Manually emitted. See Bug 312568. } int /*long*/ gtk_row_deleted (int /*long*/ model, int /*long*/ path) { @@ -1001,6 +1004,20 @@ } /** + * Returns <code>true</code> if the widget has auto text direction, + * and <code>false</code> otherwise. + * + * @return <code>true</code> when the widget has auto direction and <code>false</code> otherwise + * + * @see SWT#AUTO_TEXT_DIRECTION + * + * @since 3.105 + */ +public boolean isAutoDirection () { + return false; +} + +/** * Returns <code>true</code> if the widget has been disposed, * and <code>false</code> otherwise. * <p> @@ -1254,17 +1271,17 @@ * <p> * The skin event is sent to the receiver's display when appropriate (usually before the next event * is handled). Widgets are automatically marked for skinning upon creation as well as when its skin - * id or class changes. The skin id and/or class can be changed by calling <code>Display.setData(String, Object)</code> - * with the keys SWT.SKIN_ID and/or SWT.SKIN_CLASS. Once the skin event is sent to a widget, it + * id or class changes. The skin id and/or class can be changed by calling {@link Display#setData(String, Object)} + * with the keys {@link SWT#SKIN_ID} and/or {@link SWT#SKIN_CLASS}. Once the skin event is sent to a widget, it * will not be sent again unless <code>reskin(int)</code> is called on the widget or on an ancestor * while specifying the <code>SWT.ALL</code> flag. * </p> * <p> * The parameter <code>flags</code> may be either: * <dl> - * <dt><b>SWT.ALL</b></dt> + * <dt><b>{@link SWT#ALL}</b></dt> * <dd>all children in the receiver's widget tree should be skinned</dd> - * <dt><b>SWT.NONE</b></dt> + * <dt><b>{@link SWT#NONE}</b></dt> * <dd>only the receiver should be skinned</dd> * </dl> * </p> @@ -1317,10 +1334,6 @@ eventTable.unhook (SWT.Dispose, listener); } -static int resolveTextDirection(String text) { - return SWT.NONE; -} - void sendEvent (Event event) { Display display = event.display; if (!display.filterEvent (event)) { @@ -1340,7 +1353,9 @@ if (eventTable == null && !display.filters (eventType)) { return; } - if (event == null) event = new Event (); + if (event == null) { + event = new Event(); + } event.type = eventType; event.display = display; event.widget = this; @@ -1576,6 +1591,15 @@ } } if (key.equals(SWT.SKIN_CLASS) || key.equals(SWT.SKIN_ID)) this.reskin(SWT.ALL); + if (OS.GTK3 && key.equals(KEY_GTK_CSS) && value instanceof String) { + int /*long*/ context = OS.gtk_widget_get_style_context (handle); + int /*long*/ provider = OS.gtk_css_provider_new(); + if (context != 0 && provider != 0) { + OS.gtk_style_context_add_provider (context, provider, OS.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + OS.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (null, (String) value, true), -1, null); + OS.g_object_unref (provider); + } + } } void setFontDescription (int /*long*/ widget, int /*long*/ font) { @@ -1595,14 +1619,12 @@ void setForegroundColor (int /*long*/ handle, GdkColor color, boolean setStateActive) { if (OS.GTK3) { GdkRGBA rgba = null; + GdkRGBA selectedForeground = display.toGdkRGBA(display.COLOR_LIST_SELECTION_TEXT); if (color != null) { - rgba = new GdkRGBA(); - rgba.alpha = 1; - rgba.red = (color.red & 0xFFFF) / (float)0xFFFF; - rgba.green = (color.green & 0xFFFF) / (float)0xFFFF; - rgba.blue = (color.blue & 0xFFFF) / (float)0xFFFF; + rgba = display.toGdkRGBA (color); } OS.gtk_widget_override_color (handle, OS.GTK_STATE_FLAG_NORMAL, rgba); + OS.gtk_widget_override_color (handle, OS.GTK_STATE_FLAG_SELECTED, selectedForeground); int /*long*/ context = OS.gtk_widget_get_style_context (handle); OS.gtk_style_context_invalidate (context); return; @@ -1821,6 +1843,19 @@ } } +/** + * Wrapper function for gdk_event_get_state() + * @param event pointer to the GdkEvent. + * @return the keymask to be used with constants like + * OS.GDK_SHIFT_MASK / OS.GDK_CONTROL_MASK / OS.GDK_MOD1_MASK etc.. + */ +int gdk_event_get_state (int /*long*/ event) { + int [] state = new int [1]; + OS.gdk_event_get_state (event, state); + return state[0]; +} + + int /*long*/ gtk_box_new (int orientation, boolean homogeneous, int spacing) { int /*long*/ box = 0; if (OS.GTK3) { diff -Nru swt4-gtk-4.5.0/os.c swt4-gtk-4.6.0/os.c --- swt4-gtk-4.5.0/os.c 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/os.c 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. All rights reserved. + * Copyright (c) 2000, 2016 IBM Corporation and others. All rights reserved. * The contents of this file are made available under the terms * of the GNU Lesser General Public License (LGPL) Version 2.1 that * accompanies this distribution (lgpl-v21.txt). The LGPL is also @@ -185,18 +185,6 @@ } #endif -#ifndef NO_GTK_1SCROLLED_1WINDOW_1SCROLLBAR_1SPACING -JNIEXPORT jint JNICALL OS_NATIVE(GTK_1SCROLLED_1WINDOW_1SCROLLBAR_1SPACING) - (JNIEnv *env, jclass that, jintLong arg0) -{ - jint rc = 0; - OS_NATIVE_ENTER(env, that, GTK_1SCROLLED_1WINDOW_1SCROLLBAR_1SPACING_FUNC); - rc = (jint)GTK_SCROLLED_WINDOW_SCROLLBAR_SPACING((GtkScrolledWindow *)arg0); - OS_NATIVE_EXIT(env, that, GTK_1SCROLLED_1WINDOW_1SCROLLBAR_1SPACING_FUNC); - return rc; -} -#endif - #ifndef NO_GTK_1TEXTVIEW_1IM_1CONTEXT JNIEXPORT jintLong JNICALL OS_NATIVE(GTK_1TEXTVIEW_1IM_1CONTEXT) (JNIEnv *env, jclass that, jintLong arg0) @@ -221,6 +209,18 @@ } #endif +#ifndef NO_GTK_1WIDGET_1GET_1CLASS +JNIEXPORT jintLong JNICALL OS_NATIVE(GTK_1WIDGET_1GET_1CLASS) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, GTK_1WIDGET_1GET_1CLASS_FUNC); + rc = (jintLong)GTK_WIDGET_GET_CLASS((GtkWidget *)arg0); + OS_NATIVE_EXIT(env, that, GTK_1WIDGET_1GET_1CLASS_FUNC); + return rc; +} +#endif + #ifndef NO_GTK_1WIDGET_1REQUISITION_1HEIGHT JNIEXPORT jint JNICALL OS_NATIVE(GTK_1WIDGET_1REQUISITION_1HEIGHT) (JNIEnv *env, jclass that, jintLong arg0) @@ -3873,6 +3873,129 @@ } #endif +#ifndef NO__1g_1settings_1get +JNIEXPORT void JNICALL OS_NATIVE(_1g_1settings_1get) + (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jbyteArray arg2, jbyteArray arg3, jintArray arg4) +{ + jbyte *lparg1=NULL; + jbyte *lparg2=NULL; + jbyte *lparg3=NULL; + jint *lparg4=NULL; + OS_NATIVE_ENTER(env, that, _1g_1settings_1get_FUNC); + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; + if (arg2) if ((lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL)) == NULL) goto fail; + if (arg3) if ((lparg3 = (*env)->GetByteArrayElements(env, arg3, NULL)) == NULL) goto fail; + if (arg4) if ((lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL)) == NULL) goto fail; +/* + g_settings_get(arg0, lparg1, lparg2, lparg3, lparg4); +*/ + { + OS_LOAD_FUNCTION(fp, g_settings_get) + if (fp) { + ((void (CALLING_CONVENTION*)(jintLong, jbyte *, jbyte *, jbyte *, jint *))fp)(arg0, lparg1, lparg2, lparg3, lparg4); + } + } +fail: + if (arg4 && lparg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0); + if (arg3 && lparg3) (*env)->ReleaseByteArrayElements(env, arg3, lparg3, 0); + if (arg2 && lparg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0); + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, _1g_1settings_1get_FUNC); +} +#endif + +#ifndef NO__1g_1settings_1get_1value +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1settings_1get_1value) + (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1) +{ + jbyte *lparg1=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1settings_1get_1value_FUNC); + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; +/* + rc = (jintLong)g_settings_get_value(arg0, lparg1); +*/ + { + OS_LOAD_FUNCTION(fp, g_settings_get_value) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong, jbyte *))fp)(arg0, lparg1); + } + } +fail: + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, _1g_1settings_1get_1value_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1settings_1new +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1settings_1new) + (JNIEnv *env, jclass that, jbyteArray arg0) +{ + jbyte *lparg0=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1settings_1new_FUNC); + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; +/* + rc = (jintLong)g_settings_new((const gchar *)lparg0); +*/ + { + OS_LOAD_FUNCTION(fp, g_settings_new) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(const gchar *))fp)((const gchar *)lparg0); + } + } +fail: + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + OS_NATIVE_EXIT(env, that, _1g_1settings_1new_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1settings_1schema_1source_1get_1default +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1settings_1schema_1source_1get_1default) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1settings_1schema_1source_1get_1default_FUNC); +/* + rc = (jintLong)g_settings_schema_source_get_default(); +*/ + { + OS_LOAD_FUNCTION(fp, g_settings_schema_source_get_default) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)())fp)(); + } + } + OS_NATIVE_EXIT(env, that, _1g_1settings_1schema_1source_1get_1default_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1settings_1schema_1source_1lookup +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1settings_1schema_1source_1lookup) + (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jboolean arg2) +{ + jbyte *lparg1=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1settings_1schema_1source_1lookup_FUNC); + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; +/* + rc = (jintLong)g_settings_schema_source_lookup(arg0, lparg1, arg2); +*/ + { + OS_LOAD_FUNCTION(fp, g_settings_schema_source_lookup) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong, jbyte *, jboolean))fp)(arg0, lparg1, arg2); + } + } +fail: + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, _1g_1settings_1schema_1source_1lookup_FUNC); + return rc; +} +#endif + #ifndef NO__1g_1signal_1add_1emission_1hook JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1signal_1add_1emission_1hook) (JNIEnv *env, jclass that, jint arg0, jint arg1, jintLong arg2, jintLong arg3, jintLong arg4) @@ -4488,36 +4611,16 @@ jintLong *lparg4=NULL; jintLong rc = 0; OS_NATIVE_ENTER(env, that, _1g_1utf16_1to_1utf8_FUNC); -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail; if (arg2) if ((lparg2 = (*env)->GetPrimitiveArrayCritical(env, arg2, NULL)) == NULL) goto fail; if (arg3) if ((lparg3 = (*env)->GetPrimitiveArrayCritical(env, arg3, NULL)) == NULL) goto fail; if (arg4) if ((lparg4 = (*env)->GetPrimitiveArrayCritical(env, arg4, NULL)) == NULL) goto fail; - } else -#endif - { - if (arg0) if ((lparg0 = (*env)->GetCharArrayElements(env, arg0, NULL)) == NULL) goto fail; - if (arg2) if ((lparg2 = (*env)->GetIntLongArrayElements(env, arg2, NULL)) == NULL) goto fail; - if (arg3) if ((lparg3 = (*env)->GetIntLongArrayElements(env, arg3, NULL)) == NULL) goto fail; - if (arg4) if ((lparg4 = (*env)->GetIntLongArrayElements(env, arg4, NULL)) == NULL) goto fail; - } rc = (jintLong)g_utf16_to_utf8((const gunichar2 *)lparg0, (glong)arg1, (glong *)lparg2, (glong *)lparg3, (GError **)lparg4); fail: -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg4 && lparg4) (*env)->ReleasePrimitiveArrayCritical(env, arg4, lparg4, 0); if (arg3 && lparg3) (*env)->ReleasePrimitiveArrayCritical(env, arg3, lparg3, 0); if (arg2 && lparg2) (*env)->ReleasePrimitiveArrayCritical(env, arg2, lparg2, 0); if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, JNI_ABORT); - } else -#endif - { - if (arg4 && lparg4) (*env)->ReleaseIntLongArrayElements(env, arg4, lparg4, 0); - if (arg3 && lparg3) (*env)->ReleaseIntLongArrayElements(env, arg3, lparg3, 0); - if (arg2 && lparg2) (*env)->ReleaseIntLongArrayElements(env, arg2, lparg2, 0); - if (arg0 && lparg0) (*env)->ReleaseCharArrayElements(env, arg0, lparg0, JNI_ABORT); - } OS_NATIVE_EXIT(env, that, _1g_1utf16_1to_1utf8_FUNC); return rc; } @@ -4575,32 +4678,14 @@ #else OS_NATIVE_ENTER(env, that, _1g_1utf8_1to_1utf16__JJ_3J_3J_3J_FUNC); #endif -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg2) if ((lparg2 = (*env)->GetPrimitiveArrayCritical(env, arg2, NULL)) == NULL) goto fail; if (arg3) if ((lparg3 = (*env)->GetPrimitiveArrayCritical(env, arg3, NULL)) == NULL) goto fail; if (arg4) if ((lparg4 = (*env)->GetPrimitiveArrayCritical(env, arg4, NULL)) == NULL) goto fail; - } else -#endif - { - if (arg2) if ((lparg2 = (*env)->GetIntLongArrayElements(env, arg2, NULL)) == NULL) goto fail; - if (arg3) if ((lparg3 = (*env)->GetIntLongArrayElements(env, arg3, NULL)) == NULL) goto fail; - if (arg4) if ((lparg4 = (*env)->GetIntLongArrayElements(env, arg4, NULL)) == NULL) goto fail; - } rc = (jintLong)g_utf8_to_utf16((const gchar *)arg0, (glong)arg1, (glong *)lparg2, (glong *)lparg3, (GError **)lparg4); fail: -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg4 && lparg4) (*env)->ReleasePrimitiveArrayCritical(env, arg4, lparg4, 0); if (arg3 && lparg3) (*env)->ReleasePrimitiveArrayCritical(env, arg3, lparg3, 0); if (arg2 && lparg2) (*env)->ReleasePrimitiveArrayCritical(env, arg2, lparg2, 0); - } else -#endif - { - if (arg4 && lparg4) (*env)->ReleaseIntLongArrayElements(env, arg4, lparg4, 0); - if (arg3 && lparg3) (*env)->ReleaseIntLongArrayElements(env, arg3, lparg3, 0); - if (arg2 && lparg2) (*env)->ReleaseIntLongArrayElements(env, arg2, lparg2, 0); - } #ifndef JNI64 OS_NATIVE_EXIT(env, that, _1g_1utf8_1to_1utf16__II_3I_3I_3I_FUNC); #else @@ -4627,36 +4712,16 @@ #else OS_NATIVE_ENTER(env, that, _1g_1utf8_1to_1utf16___3BJ_3J_3J_3J_FUNC); #endif -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail; if (arg2) if ((lparg2 = (*env)->GetPrimitiveArrayCritical(env, arg2, NULL)) == NULL) goto fail; if (arg3) if ((lparg3 = (*env)->GetPrimitiveArrayCritical(env, arg3, NULL)) == NULL) goto fail; if (arg4) if ((lparg4 = (*env)->GetPrimitiveArrayCritical(env, arg4, NULL)) == NULL) goto fail; - } else -#endif - { - if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; - if (arg2) if ((lparg2 = (*env)->GetIntLongArrayElements(env, arg2, NULL)) == NULL) goto fail; - if (arg3) if ((lparg3 = (*env)->GetIntLongArrayElements(env, arg3, NULL)) == NULL) goto fail; - if (arg4) if ((lparg4 = (*env)->GetIntLongArrayElements(env, arg4, NULL)) == NULL) goto fail; - } rc = (jintLong)g_utf8_to_utf16((const gchar *)lparg0, (glong)arg1, (glong *)lparg2, (glong *)lparg3, (GError **)lparg4); fail: -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg4 && lparg4) (*env)->ReleasePrimitiveArrayCritical(env, arg4, lparg4, 0); if (arg3 && lparg3) (*env)->ReleasePrimitiveArrayCritical(env, arg3, lparg3, 0); if (arg2 && lparg2) (*env)->ReleasePrimitiveArrayCritical(env, arg2, lparg2, 0); if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, JNI_ABORT); - } else -#endif - { - if (arg4 && lparg4) (*env)->ReleaseIntLongArrayElements(env, arg4, lparg4, 0); - if (arg3 && lparg3) (*env)->ReleaseIntLongArrayElements(env, arg3, lparg3, 0); - if (arg2 && lparg2) (*env)->ReleaseIntLongArrayElements(env, arg2, lparg2, 0); - if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, JNI_ABORT); - } #ifndef JNI64 OS_NATIVE_EXIT(env, that, _1g_1utf8_1to_1utf16___3BI_3I_3I_3I_FUNC); #else @@ -4678,6 +4743,30 @@ } #endif +#ifndef NO__1g_1variant_1dict_1lookup_1value +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1variant_1dict_1lookup_1value) + (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintLong arg2) +{ + jbyte *lparg1=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1variant_1dict_1lookup_1value_FUNC); + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; +/* + rc = (jintLong)g_variant_dict_lookup_value(arg0, lparg1, arg2); +*/ + { + OS_LOAD_FUNCTION(fp, g_variant_dict_lookup_value) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong, jbyte *, jintLong))fp)(arg0, lparg1, arg2); + } + } +fail: + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, _1g_1variant_1dict_1lookup_1value_FUNC); + return rc; +} +#endif + #ifndef NO__1g_1variant_1get_1boolean JNIEXPORT jboolean JNICALL OS_NATIVE(_1g_1variant_1get_1boolean) (JNIEnv *env, jclass that, jintLong arg0) @@ -4846,6 +4935,108 @@ } #endif +#ifndef NO__1g_1variant_1iter_1free +JNIEXPORT void JNICALL OS_NATIVE(_1g_1variant_1iter_1free) + (JNIEnv *env, jclass that, jintLong arg0) +{ + OS_NATIVE_ENTER(env, that, _1g_1variant_1iter_1free_FUNC); +/* + g_variant_iter_free(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, g_variant_iter_free) + if (fp) { + ((void (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1g_1variant_1iter_1free_FUNC); +} +#endif + +#ifndef NO__1g_1variant_1iter_1init +JNIEXPORT jint JNICALL OS_NATIVE(_1g_1variant_1iter_1init) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1variant_1iter_1init_FUNC); +/* + rc = (jint)g_variant_iter_init(arg0, arg1); +*/ + { + OS_LOAD_FUNCTION(fp, g_variant_iter_init) + if (fp) { + rc = (jint)((jint (CALLING_CONVENTION*)(jintLong, jintLong))fp)(arg0, arg1); + } + } + OS_NATIVE_EXIT(env, that, _1g_1variant_1iter_1init_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1variant_1iter_1new +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1variant_1iter_1new) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1variant_1iter_1new_FUNC); +/* + rc = (jintLong)g_variant_iter_new(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, g_variant_iter_new) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1g_1variant_1iter_1new_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1variant_1iter_1next +JNIEXPORT jboolean JNICALL OS_NATIVE(_1g_1variant_1iter_1next) + (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintLong arg2, jintLong arg3) +{ + jbyte *lparg1=NULL; + jboolean rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1variant_1iter_1next_FUNC); + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; +/* + rc = (jboolean)g_variant_iter_next(arg0, lparg1, arg2, arg3); +*/ + { + OS_LOAD_FUNCTION(fp, g_variant_iter_next) + if (fp) { + rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong, jbyte *, jintLong, jintLong))fp)(arg0, lparg1, arg2, arg3); + } + } +fail: + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, _1g_1variant_1iter_1next_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1variant_1iter_1next_1value +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1variant_1iter_1next_1value) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1variant_1iter_1next_1value_FUNC); +/* + rc = (jintLong)g_variant_iter_next_value(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, g_variant_iter_next_value) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1g_1variant_1iter_1next_1value_FUNC); + return rc; +} +#endif + #ifndef NO__1g_1variant_1n_1children JNIEXPORT jlong JNICALL OS_NATIVE(_1g_1variant_1n_1children) (JNIEnv *env, jclass that, jlong arg0) @@ -5038,6 +5229,44 @@ } #endif +#ifndef NO__1g_1variant_1print +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1variant_1print) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1variant_1print_FUNC); +/* + rc = (jintLong)g_variant_print(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, g_variant_print) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1g_1variant_1print_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1variant_1unref +JNIEXPORT void JNICALL OS_NATIVE(_1g_1variant_1unref) + (JNIEnv *env, jclass that, jintLong arg0) +{ + OS_NATIVE_ENTER(env, that, _1g_1variant_1unref_FUNC); +/* + g_variant_unref(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, g_variant_unref) + if (fp) { + ((void (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1g_1variant_1unref_FUNC); +} +#endif + #ifndef NO__1gdk_1atom_1intern JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1atom_1intern) (JNIEnv *env, jclass that, jbyteArray arg0, jboolean arg1) @@ -5045,24 +5274,10 @@ jbyte *lparg0=NULL; jintLong rc = 0; OS_NATIVE_ENTER(env, that, _1gdk_1atom_1intern_FUNC); -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail; - } else -#endif - { - if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; - } rc = (jintLong)gdk_atom_intern((const gchar *)lparg0, arg1); fail: -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, JNI_ABORT); - } else -#endif - { - if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, JNI_ABORT); - } OS_NATIVE_EXIT(env, that, _1gdk_1atom_1intern_FUNC); return rc; } @@ -5097,14 +5312,7 @@ jbyte *lparg1=NULL; jintLong rc = 0; OS_NATIVE_ENTER(env, that, _1gdk_1bitmap_1create_1from_1data_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)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; - } /* rc = (jintLong)gdk_bitmap_create_from_data((GdkWindow *)arg0, (const gchar *)lparg1, (gint)arg2, (gint)arg3); */ @@ -5115,14 +5323,7 @@ } } 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)->ReleaseByteArrayElements(env, arg1, lparg1, JNI_ABORT); - } OS_NATIVE_EXIT(env, that, _1gdk_1bitmap_1create_1from_1data_FUNC); return rc; } @@ -5404,14 +5605,14 @@ } #endif -#ifndef NO__1gdk_1cursor_1new -JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1cursor_1new) - (JNIEnv *env, jclass that, jintLong arg0) +#ifndef NO__1gdk_1cursor_1new_1for_1display +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1cursor_1new_1for_1display) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) { jintLong rc = 0; - OS_NATIVE_ENTER(env, that, _1gdk_1cursor_1new_FUNC); - rc = (jintLong)gdk_cursor_new((GdkCursorType)arg0); - OS_NATIVE_EXIT(env, that, _1gdk_1cursor_1new_FUNC); + OS_NATIVE_ENTER(env, that, _1gdk_1cursor_1new_1for_1display_FUNC); + rc = (jintLong)gdk_cursor_new_for_display((GdkDisplay *)arg0, (GdkCursorType)arg1); + OS_NATIVE_EXIT(env, that, _1gdk_1cursor_1new_1for_1display_FUNC); return rc; } #endif @@ -5871,14 +6072,7 @@ { jint *lparg2=NULL; OS_NATIVE_ENTER(env, that, _1gdk_1draw_1lines_FUNC); -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg2) if ((lparg2 = (*env)->GetPrimitiveArrayCritical(env, arg2, NULL)) == NULL) goto fail; - } else -#endif - { - if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail; - } /* gdk_draw_lines(arg0, arg1, (GdkPoint *)lparg2, (gint)arg3); */ @@ -5889,14 +6083,7 @@ } } fail: -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg2 && lparg2) (*env)->ReleasePrimitiveArrayCritical(env, arg2, lparg2, JNI_ABORT); - } else -#endif - { - if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, JNI_ABORT); - } OS_NATIVE_EXIT(env, that, _1gdk_1draw_1lines_FUNC); } #endif @@ -5943,14 +6130,7 @@ { jint *lparg3=NULL; OS_NATIVE_ENTER(env, that, _1gdk_1draw_1polygon_FUNC); -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg3) if ((lparg3 = (*env)->GetPrimitiveArrayCritical(env, arg3, NULL)) == NULL) goto fail; - } else -#endif - { - if (arg3) if ((lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL)) == NULL) goto fail; - } /* gdk_draw_polygon(arg0, arg1, arg2, lparg3, arg4); */ @@ -5961,14 +6141,7 @@ } } fail: -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg3 && lparg3) (*env)->ReleasePrimitiveArrayCritical(env, arg3, lparg3, JNI_ABORT); - } else -#endif - { - if (arg3 && lparg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, JNI_ABORT); - } OS_NATIVE_EXIT(env, that, _1gdk_1draw_1polygon_FUNC); } #endif @@ -6038,16 +6211,8 @@ jint *lparg1=NULL; jint *lparg2=NULL; OS_NATIVE_ENTER(env, that, _1gdk_1drawable_1get_1size_FUNC); -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg1) if ((lparg1 = (*env)->GetPrimitiveArrayCritical(env, arg1, NULL)) == NULL) goto fail; if (arg2) if ((lparg2 = (*env)->GetPrimitiveArrayCritical(env, arg2, NULL)) == NULL) goto fail; - } else -#endif - { - if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail; - if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail; - } /* gdk_drawable_get_size(arg0, (gint *)lparg1, (gint *)lparg2); */ @@ -6058,16 +6223,8 @@ } } fail: -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg2 && lparg2) (*env)->ReleasePrimitiveArrayCritical(env, arg2, lparg2, 0); if (arg1 && lparg1) (*env)->ReleasePrimitiveArrayCritical(env, arg1, lparg1, 0); - } else -#endif - { - if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); - if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); - } OS_NATIVE_EXIT(env, that, _1gdk_1drawable_1get_1size_FUNC); } #endif @@ -6399,14 +6556,7 @@ { jbyte *lparg2=NULL; OS_NATIVE_ENTER(env, that, _1gdk_1gc_1set_1dashes_FUNC); -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg2) if ((lparg2 = (*env)->GetPrimitiveArrayCritical(env, arg2, NULL)) == NULL) goto fail; - } else -#endif - { - if (arg2) if ((lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL)) == NULL) goto fail; - } /* gdk_gc_set_dashes(arg0, (gint)arg1, (gint8 *)lparg2, (gint)arg3); */ @@ -6417,14 +6567,7 @@ } } fail: -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg2 && lparg2) (*env)->ReleasePrimitiveArrayCritical(env, arg2, lparg2, JNI_ABORT); - } else -#endif - { - if (arg2 && lparg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, JNI_ABORT); - } OS_NATIVE_EXIT(env, that, _1gdk_1gc_1set_1dashes_FUNC); } #endif @@ -7032,16 +7175,8 @@ jint *lparg1=NULL; jint *lparg2=NULL; OS_NATIVE_ENTER(env, that, _1gdk_1pixmap_1get_1size_FUNC); -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg1) if ((lparg1 = (*env)->GetPrimitiveArrayCritical(env, arg1, NULL)) == NULL) goto fail; if (arg2) if ((lparg2 = (*env)->GetPrimitiveArrayCritical(env, arg2, NULL)) == NULL) goto fail; - } else -#endif - { - if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail; - if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail; - } /* gdk_pixmap_get_size(arg0, (gint *)lparg1, (gint *)lparg2); */ @@ -7052,16 +7187,8 @@ } } fail: -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg2 && lparg2) (*env)->ReleasePrimitiveArrayCritical(env, arg2, lparg2, 0); if (arg1 && lparg1) (*env)->ReleasePrimitiveArrayCritical(env, arg1, lparg1, 0); - } else -#endif - { - if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); - if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); - } OS_NATIVE_EXIT(env, that, _1gdk_1pixmap_1get_1size_FUNC); } #endif @@ -7341,6 +7468,57 @@ } #endif +#ifndef NO__1gdk_1rgba_1parse +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1rgba_1parse) + (JNIEnv *env, jclass that, jobject arg0, jbyteArray arg1) +{ + GdkRGBA _arg0, *lparg0=NULL; + jbyte *lparg1=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gdk_1rgba_1parse_FUNC); + if (arg0) if ((lparg0 = getGdkRGBAFields(env, arg0, &_arg0)) == NULL) goto fail; + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; +/* + rc = (jintLong)gdk_rgba_parse((GdkRGBA *)lparg0, (const gchar *)lparg1); +*/ + { + OS_LOAD_FUNCTION(fp, gdk_rgba_parse) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GdkRGBA *, const gchar *))fp)((GdkRGBA *)lparg0, (const gchar *)lparg1); + } + } +fail: + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + if (arg0 && lparg0) setGdkRGBAFields(env, arg0, lparg0); + OS_NATIVE_EXIT(env, that, _1gdk_1rgba_1parse_FUNC); + return rc; +} +#endif + +#ifndef NO__1gdk_1rgba_1to_1string +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1rgba_1to_1string) + (JNIEnv *env, jclass that, jobject arg0) +{ + GdkRGBA _arg0, *lparg0=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gdk_1rgba_1to_1string_FUNC); + if (arg0) if ((lparg0 = getGdkRGBAFields(env, arg0, &_arg0)) == NULL) goto fail; +/* + rc = (jintLong)gdk_rgba_to_string((GdkRGBA *)lparg0); +*/ + { + OS_LOAD_FUNCTION(fp, gdk_rgba_to_string) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GdkRGBA *))fp)((GdkRGBA *)lparg0); + } + } +fail: + if (arg0 && lparg0) setGdkRGBAFields(env, arg0, lparg0); + OS_NATIVE_EXIT(env, that, _1gdk_1rgba_1to_1string_FUNC); + return rc; +} +#endif + #ifndef NO__1gdk_1screen_1get_1default JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1screen_1get_1default) (JNIEnv *env, jclass that) @@ -7423,6 +7601,26 @@ } #endif +#ifndef NO__1gdk_1screen_1get_1monitor_1scale_1factor +JNIEXPORT jint JNICALL OS_NATIVE(_1gdk_1screen_1get_1monitor_1scale_1factor) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, _1gdk_1screen_1get_1monitor_1scale_1factor_FUNC); +/* + rc = (jint)gdk_screen_get_monitor_scale_factor((GdkScreen *)arg0, (gint)arg1); +*/ + { + OS_LOAD_FUNCTION(fp, gdk_screen_get_monitor_scale_factor) + if (fp) { + rc = (jint)((jint (CALLING_CONVENTION*)(GdkScreen *, gint))fp)((GdkScreen *)arg0, (gint)arg1); + } + } + OS_NATIVE_EXIT(env, that, _1gdk_1screen_1get_1monitor_1scale_1factor_FUNC); + return rc; +} +#endif + #ifndef NO__1gdk_1screen_1get_1monitor_1width_1mm JNIEXPORT jint JNICALL OS_NATIVE(_1gdk_1screen_1get_1monitor_1width_1mm) (JNIEnv *env, jclass that, jintLong arg0, jint arg1) @@ -7505,6 +7703,26 @@ } #endif +#ifndef NO__1gdk_1screen_1get_1resolution +JNIEXPORT jdouble JNICALL OS_NATIVE(_1gdk_1screen_1get_1resolution) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jdouble rc = 0; + OS_NATIVE_ENTER(env, that, _1gdk_1screen_1get_1resolution_FUNC); +/* + rc = (jdouble)gdk_screen_get_resolution((GdkScreen *)arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gdk_screen_get_resolution) + if (fp) { + rc = (jdouble)((jdouble (CALLING_CONVENTION*)(GdkScreen *))fp)((GdkScreen *)arg0); + } + } + OS_NATIVE_EXIT(env, that, _1gdk_1screen_1get_1resolution_FUNC); + return rc; +} +#endif + #ifndef NO__1gdk_1screen_1height JNIEXPORT jint JNICALL OS_NATIVE(_1gdk_1screen_1height) (JNIEnv *env, jclass that) @@ -8627,6 +8845,22 @@ } #endif +#ifndef NO__1gtk_1accel_1label_1new +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1accel_1label_1new) + (JNIEnv *env, jclass that, jbyteArray arg0) +{ + jbyte *lparg0=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1accel_1label_1new_FUNC); + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; + rc = (jintLong)gtk_accel_label_new((const gchar *)lparg0); +fail: + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + OS_NATIVE_EXIT(env, that, _1gtk_1accel_1label_1new_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1accel_1label_1set_1accel JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1accel_1label_1set_1accel) (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jint arg2) @@ -8990,6 +9224,26 @@ } #endif +#ifndef NO__1gtk_1box_1pack_1end +JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1box_1pack_1end) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jboolean arg2, jboolean arg3, jint arg4) +{ + OS_NATIVE_ENTER(env, that, _1gtk_1box_1pack_1end_FUNC); + gtk_box_pack_end((GtkBox *)arg0, (GtkWidget *)arg1, (gboolean)arg2, (gboolean)arg3, (guint)arg4); + OS_NATIVE_EXIT(env, that, _1gtk_1box_1pack_1end_FUNC); +} +#endif + +#ifndef NO__1gtk_1box_1reorder_1child +JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1box_1reorder_1child) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2) +{ + OS_NATIVE_ENTER(env, that, _1gtk_1box_1reorder_1child_FUNC); + gtk_box_reorder_child((GtkBox *)arg0, (GtkWidget *)arg1, (gint)arg2); + OS_NATIVE_EXIT(env, that, _1gtk_1box_1reorder_1child_FUNC); +} +#endif + #ifndef NO__1gtk_1box_1set_1child_1packing JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1box_1set_1child_1packing) (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jboolean arg2, jboolean arg3, jint arg4, jint arg5) @@ -9268,6 +9522,31 @@ } #endif +#ifndef NO__1gtk_1cell_1renderer_1get_1fixed_1size +JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1cell_1renderer_1get_1fixed_1size) + (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1, jintArray arg2) +{ + jint *lparg1=NULL; + jint *lparg2=NULL; + OS_NATIVE_ENTER(env, that, _1gtk_1cell_1renderer_1get_1fixed_1size_FUNC); + if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail; + if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail; +/* + gtk_cell_renderer_get_fixed_size((GtkCellRenderer *)arg0, lparg1, lparg2); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_cell_renderer_get_fixed_size) + if (fp) { + ((void (CALLING_CONVENTION*)(GtkCellRenderer *, jint *, jint *))fp)((GtkCellRenderer *)arg0, lparg1, lparg2); + } + } +fail: + if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); + if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, _1gtk_1cell_1renderer_1get_1fixed_1size_FUNC); +} +#endif + #ifndef NO__1gtk_1cell_1renderer_1get_1preferred_1height_1for_1width JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1cell_1renderer_1get_1preferred_1height_1for_1width) (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jintArray arg3, jintArray arg4) @@ -9430,6 +9709,18 @@ } #endif +#ifndef NO__1gtk_1check_1menu_1item_1new +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1check_1menu_1item_1new) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1check_1menu_1item_1new_FUNC); + rc = (jintLong)gtk_check_menu_item_new(); + OS_NATIVE_EXIT(env, that, _1gtk_1check_1menu_1item_1new_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1check_1menu_1item_1new_1with_1label JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1check_1menu_1item_1new_1with_1label) (JNIEnv *env, jclass that, jbyteArray arg0) @@ -9534,6 +9825,26 @@ } #endif +#ifndef NO__1gtk_1color_1chooser_1add_1palette +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1color_1chooser_1add_1palette) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jint arg2, jint arg3, jintLong arg4) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1color_1chooser_1add_1palette_FUNC); +/* + rc = (jintLong)gtk_color_chooser_add_palette((GtkColorChooser *)arg0, (GtkOrientation)arg1, arg2, arg3, (GdkRGBA *)arg4); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_color_chooser_add_palette) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GtkColorChooser *, GtkOrientation, jint, jint, GdkRGBA *))fp)((GtkColorChooser *)arg0, (GtkOrientation)arg1, arg2, arg3, (GdkRGBA *)arg4); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1color_1chooser_1add_1palette_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1color_1chooser_1dialog_1new JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1color_1chooser_1dialog_1new) (JNIEnv *env, jclass that, jbyteArray arg0, jintLong arg1) @@ -9580,6 +9891,26 @@ } #endif +#ifndef NO__1gtk_1color_1chooser_1get_1use_1alpha +JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1color_1chooser_1get_1use_1alpha) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jboolean rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1color_1chooser_1get_1use_1alpha_FUNC); +/* + rc = (jboolean)gtk_color_chooser_get_use_alpha(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_color_chooser_get_use_alpha) + if (fp) { + rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1color_1chooser_1get_1use_1alpha_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1color_1chooser_1set_1rgba JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1color_1chooser_1set_1rgba) (JNIEnv *env, jclass that, jintLong arg0, jobject arg1) @@ -9884,7 +10215,15 @@ (JNIEnv *env, jclass that, jintLong arg0, jboolean arg1) { OS_NATIVE_ENTER(env, that, _1gtk_1combo_1box_1set_1focus_1on_1click_FUNC); +/* gtk_combo_box_set_focus_on_click((GtkComboBox *)arg0, (gboolean)arg1); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_combo_box_set_focus_on_click) + if (fp) { + ((void (CALLING_CONVENTION*)(GtkComboBox *, gboolean))fp)((GtkComboBox *)arg0, (gboolean)arg1); + } + } OS_NATIVE_EXIT(env, that, _1gtk_1combo_1box_1set_1focus_1on_1click_FUNC); } #endif @@ -10054,16 +10393,6 @@ } #endif -#ifndef NO__1gtk_1container_1resize_1children -JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1container_1resize_1children) - (JNIEnv *env, jclass that, jintLong arg0) -{ - OS_NATIVE_ENTER(env, that, _1gtk_1container_1resize_1children_FUNC); - gtk_container_resize_children((GtkContainer *)arg0); - OS_NATIVE_EXIT(env, that, _1gtk_1container_1resize_1children_FUNC); -} -#endif - #ifndef NO__1gtk_1container_1set_1border_1width JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1container_1set_1border_1width) (JNIEnv *env, jclass that, jintLong arg0, jint arg1) @@ -10074,6 +10403,33 @@ } #endif +#ifndef NO__1gtk_1css_1provider_1get_1named +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1css_1provider_1get_1named) + (JNIEnv *env, jclass that, jbyteArray arg0, jbyteArray arg1) +{ + jbyte *lparg0=NULL; + jbyte *lparg1=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1css_1provider_1get_1named_FUNC); + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; +/* + rc = (jintLong)gtk_css_provider_get_named((const gchar *)lparg0, (const gchar *)lparg1); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_css_provider_get_named) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(const gchar *, const gchar *))fp)((const gchar *)lparg0, (const gchar *)lparg1); + } + } +fail: + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + OS_NATIVE_EXIT(env, that, _1gtk_1css_1provider_1get_1named_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1css_1provider_1load_1from_1data JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1css_1provider_1load_1from_1data) (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintLong arg2, jintLongArray arg3) @@ -10121,6 +10477,26 @@ } #endif +#ifndef NO__1gtk_1css_1provider_1to_1string +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1css_1provider_1to_1string) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1css_1provider_1to_1string_FUNC); +/* + rc = (jintLong)gtk_css_provider_to_string(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_css_provider_to_string) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1css_1provider_1to_1string_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1dialog_1add_1button JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1dialog_1add_1button) (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jint arg2) @@ -10826,6 +11202,66 @@ } #endif +#if (!defined(NO__1gtk_1file_1chooser_1dialog_1new___3BIIIIIII) && !defined(JNI64)) || (!defined(NO__1gtk_1file_1chooser_1dialog_1new___3BJIJIJIJ) && defined(JNI64)) +#ifndef JNI64 +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1file_1chooser_1dialog_1new___3BIIIIIII)(JNIEnv *env, jclass that, jbyteArray arg0, jintLong arg1, jint arg2, jintLong arg3, jint arg4, jintLong arg5, jint arg6, jintLong arg7) +#else +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1file_1chooser_1dialog_1new___3BJIJIJIJ)(JNIEnv *env, jclass that, jbyteArray arg0, jintLong arg1, jint arg2, jintLong arg3, jint arg4, jintLong arg5, jint arg6, jintLong arg7) +#endif +{ + jbyte *lparg0=NULL; + jintLong rc = 0; +#ifndef JNI64 + OS_NATIVE_ENTER(env, that, _1gtk_1file_1chooser_1dialog_1new___3BIIIIIII_FUNC); +#else + OS_NATIVE_ENTER(env, that, _1gtk_1file_1chooser_1dialog_1new___3BJIJIJIJ_FUNC); +#endif + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; + rc = (jintLong)gtk_file_chooser_dialog_new((const gchar *)lparg0, (GtkWindow *)arg1, arg2, (const gchar *)arg3, arg4, arg5, arg6, (const gchar *)NULL); +fail: + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, JNI_ABORT); +#ifndef JNI64 + OS_NATIVE_EXIT(env, that, _1gtk_1file_1chooser_1dialog_1new___3BIIIIIII_FUNC); +#else + OS_NATIVE_EXIT(env, that, _1gtk_1file_1chooser_1dialog_1new___3BJIJIJIJ_FUNC); +#endif + return rc; +} +#endif + +#if (!defined(NO__1gtk_1file_1chooser_1dialog_1new___3BII_3BI_3BII) && !defined(JNI64)) || (!defined(NO__1gtk_1file_1chooser_1dialog_1new___3BJI_3BI_3BIJ) && defined(JNI64)) +#ifndef JNI64 +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1file_1chooser_1dialog_1new___3BII_3BI_3BII)(JNIEnv *env, jclass that, jbyteArray arg0, jintLong arg1, jint arg2, jbyteArray arg3, jint arg4, jbyteArray arg5, jint arg6, jintLong arg7) +#else +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1file_1chooser_1dialog_1new___3BJI_3BI_3BIJ)(JNIEnv *env, jclass that, jbyteArray arg0, jintLong arg1, jint arg2, jbyteArray arg3, jint arg4, jbyteArray arg5, jint arg6, jintLong arg7) +#endif +{ + jbyte *lparg0=NULL; + jbyte *lparg3=NULL; + jbyte *lparg5=NULL; + jintLong rc = 0; +#ifndef JNI64 + OS_NATIVE_ENTER(env, that, _1gtk_1file_1chooser_1dialog_1new___3BII_3BI_3BII_FUNC); +#else + OS_NATIVE_ENTER(env, that, _1gtk_1file_1chooser_1dialog_1new___3BJI_3BI_3BIJ_FUNC); +#endif + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; + if (arg3) if ((lparg3 = (*env)->GetByteArrayElements(env, arg3, NULL)) == NULL) goto fail; + if (arg5) if ((lparg5 = (*env)->GetByteArrayElements(env, arg5, NULL)) == NULL) goto fail; + rc = (jintLong)gtk_file_chooser_dialog_new((const gchar *)lparg0, (GtkWindow *)arg1, arg2, (const gchar *)lparg3, arg4, lparg5, arg6, (const gchar *)NULL); +fail: + if (arg5 && lparg5) (*env)->ReleaseByteArrayElements(env, arg5, lparg5, 0); + if (arg3 && lparg3) (*env)->ReleaseByteArrayElements(env, arg3, lparg3, JNI_ABORT); + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, JNI_ABORT); +#ifndef JNI64 + OS_NATIVE_EXIT(env, that, _1gtk_1file_1chooser_1dialog_1new___3BII_3BI_3BII_FUNC); +#else + OS_NATIVE_EXIT(env, that, _1gtk_1file_1chooser_1dialog_1new___3BJI_3BI_3BIJ_FUNC); +#endif + return rc; +} +#endif + #ifndef NO__1gtk_1file_1chooser_1get_1filename JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1file_1chooser_1get_1filename) (JNIEnv *env, jclass that, jintLong arg0) @@ -11901,7 +12337,15 @@ jintLong rc = 0; OS_NATIVE_ENTER(env, that, _1gtk_1image_1menu_1item_1new_1with_1label_FUNC); if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; +/* rc = (jintLong)gtk_image_menu_item_new_with_label((const gchar *)lparg0); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_image_menu_item_new_with_label) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(const gchar *))fp)((const gchar *)lparg0); + } + } fail: if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); OS_NATIVE_EXIT(env, that, _1gtk_1image_1menu_1item_1new_1with_1label_FUNC); @@ -11914,7 +12358,15 @@ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) { OS_NATIVE_ENTER(env, that, _1gtk_1image_1menu_1item_1set_1image_FUNC); +/* gtk_image_menu_item_set_image((GtkImageMenuItem *)arg0, (GtkWidget *)arg1); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_image_menu_item_set_image) + if (fp) { + ((void (CALLING_CONVENTION*)(GtkImageMenuItem *, GtkWidget *))fp)((GtkImageMenuItem *)arg0, (GtkWidget *)arg1); + } + } OS_NATIVE_EXIT(env, that, _1gtk_1image_1menu_1item_1set_1image_FUNC); } #endif @@ -12001,6 +12453,16 @@ } #endif +#ifndef NO__1gtk_1image_1set_1pixel_1size +JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1image_1set_1pixel_1size) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1) +{ + OS_NATIVE_ENTER(env, that, _1gtk_1image_1set_1pixel_1size_FUNC); + gtk_image_set_pixel_size((GtkImage *)arg0, (gint)arg1); + OS_NATIVE_EXIT(env, that, _1gtk_1image_1set_1pixel_1size_FUNC); +} +#endif + #ifndef NO__1gtk_1init_1check JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1init_1check) (JNIEnv *env, jclass that, jintLongArray arg0, jintLongArray arg1) @@ -12444,6 +12906,34 @@ } #endif +#ifndef NO__1gtk_1menu_1item_1new +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1menu_1item_1new) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1menu_1item_1new_FUNC); + rc = (jintLong)gtk_menu_item_new(); + OS_NATIVE_EXIT(env, that, _1gtk_1menu_1item_1new_FUNC); + return rc; +} +#endif + +#ifndef NO__1gtk_1menu_1item_1new_1with_1label +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1menu_1item_1new_1with_1label) + (JNIEnv *env, jclass that, jbyteArray arg0) +{ + jbyte *lparg0=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1menu_1item_1new_1with_1label_FUNC); + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; + rc = (jintLong)gtk_menu_item_new_with_label((const gchar *)lparg0); +fail: + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + OS_NATIVE_EXIT(env, that, _1gtk_1menu_1item_1new_1with_1label_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1menu_1item_1set_1submenu JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1menu_1item_1set_1submenu) (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) @@ -12550,14 +13040,17 @@ #ifndef NO__1gtk_1message_1dialog_1new JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1message_1dialog_1new) - (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jint arg2, jint arg3, jbyteArray arg4) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jint arg2, jint arg3, jbyteArray arg4, jbyteArray arg5) { jbyte *lparg4=NULL; + jbyte *lparg5=NULL; jintLong rc = 0; OS_NATIVE_ENTER(env, that, _1gtk_1message_1dialog_1new_FUNC); if (arg4) if ((lparg4 = (*env)->GetByteArrayElements(env, arg4, NULL)) == NULL) goto fail; - rc = (jintLong)gtk_message_dialog_new((GtkWindow *)arg0, (GtkDialogFlags)arg1, (GtkMessageType)arg2, (GtkButtonsType)arg3, (const gchar *)lparg4); + if (arg5) if ((lparg5 = (*env)->GetByteArrayElements(env, arg5, NULL)) == NULL) goto fail; + rc = (jintLong)gtk_message_dialog_new((GtkWindow *)arg0, (GtkDialogFlags)arg1, (GtkMessageType)arg2, (GtkButtonsType)arg3, (const gchar *)lparg4, (const gchar *)lparg5); fail: + if (arg5 && lparg5) (*env)->ReleaseByteArrayElements(env, arg5, lparg5, 0); if (arg4 && lparg4) (*env)->ReleaseByteArrayElements(env, arg4, lparg4, 0); OS_NATIVE_EXIT(env, that, _1gtk_1message_1dialog_1new_FUNC); return rc; @@ -14482,6 +14975,26 @@ } #endif +#ifndef NO__1gtk_1scrollable_1get_1vadjustment +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1scrollable_1get_1vadjustment) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1scrollable_1get_1vadjustment_FUNC); +/* + rc = (jintLong)gtk_scrollable_get_vadjustment((GtkScrollable *)arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_scrollable_get_vadjustment) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GtkScrollable *))fp)((GtkScrollable *)arg0); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1scrollable_1get_1vadjustment_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1scrollbar_1new JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1scrollbar_1new) (JNIEnv *env, jclass that, jint arg0, jintLong arg1) @@ -14846,7 +15359,15 @@ if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; if (arg2) if ((lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL)) == NULL) goto fail; if (arg3) if ((lparg3 = (*env)->GetByteArrayElements(env, arg3, NULL)) == NULL) goto fail; +/* gtk_settings_set_string_property((GtkSettings *)arg0, (const gchar *)lparg1, (const gchar *)lparg2, (const gchar *)lparg3); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_settings_set_string_property) + if (fp) { + ((void (CALLING_CONVENTION*)(GtkSettings *, const gchar *, const gchar *, const gchar *))fp)((GtkSettings *)arg0, (const gchar *)lparg1, (const gchar *)lparg2, (const gchar *)lparg3); + } + } fail: if (arg3 && lparg3) (*env)->ReleaseByteArrayElements(env, arg3, lparg3, 0); if (arg2 && lparg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0); @@ -15673,6 +16194,25 @@ } #endif +#ifndef NO__1gtk_1text_1buffer_1create_1mark +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1text_1buffer_1create_1mark) + (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jbyteArray arg2, jboolean arg3) +{ + jbyte *lparg1=NULL; + jbyte *lparg2=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1text_1buffer_1create_1mark_FUNC); + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; + if (arg2) if ((lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL)) == NULL) goto fail; + rc = (jintLong)gtk_text_buffer_create_mark((GtkTextBuffer *)arg0, (const gchar *)lparg1, (GtkTextIter *)lparg2, (gboolean)arg3); +fail: + if (arg2 && lparg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0); + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, _1gtk_1text_1buffer_1create_1mark_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1text_1buffer_1cut_1clipboard JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1text_1buffer_1cut_1clipboard) (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jboolean arg2) @@ -16118,16 +16658,6 @@ } #endif -#ifndef NO__1gtk_1text_1view_1scroll_1mark_1onscreen -JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1text_1view_1scroll_1mark_1onscreen) - (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) -{ - OS_NATIVE_ENTER(env, that, _1gtk_1text_1view_1scroll_1mark_1onscreen_FUNC); - gtk_text_view_scroll_mark_onscreen((GtkTextView *)arg0, (GtkTextMark *)arg1); - OS_NATIVE_EXIT(env, that, _1gtk_1text_1view_1scroll_1mark_1onscreen_FUNC); -} -#endif - #ifndef NO__1gtk_1text_1view_1scroll_1to_1iter JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1text_1view_1scroll_1to_1iter) (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jdouble arg2, jboolean arg3, jdouble arg4, jdouble arg5) @@ -16144,6 +16674,16 @@ } #endif +#ifndef NO__1gtk_1text_1view_1scroll_1to_1mark +JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1text_1view_1scroll_1to_1mark) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jdouble arg2, jboolean arg3, jdouble arg4, jdouble arg5) +{ + OS_NATIVE_ENTER(env, that, _1gtk_1text_1view_1scroll_1to_1mark_FUNC); + gtk_text_view_scroll_to_mark((GtkTextView *)arg0, (GtkTextMark *)arg1, (gdouble)arg2, (gboolean)arg3, (gdouble)arg4, (gdouble)arg5); + OS_NATIVE_EXIT(env, that, _1gtk_1text_1view_1scroll_1to_1mark_FUNC); +} +#endif + #ifndef NO__1gtk_1text_1view_1set_1editable JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1text_1view_1set_1editable) (JNIEnv *env, jclass that, jintLong arg0, jboolean arg1) @@ -17875,6 +18415,26 @@ } #endif +#ifndef NO__1gtk_1widget_1class_1get_1css_1name +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1class_1get_1css_1name) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1widget_1class_1get_1css_1name_FUNC); +/* + rc = (jintLong)gtk_widget_class_get_css_name((GtkWidgetClass *)arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_widget_class_get_css_name) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GtkWidgetClass *))fp)((GtkWidgetClass *)arg0); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1widget_1class_1get_1css_1name_FUNC); + return rc; +} +#endif + #if (!defined(NO__1gtk_1widget_1create_1pango_1layout__II) && !defined(JNI64)) || (!defined(NO__1gtk_1widget_1create_1pango_1layout__JJ) && defined(JNI64)) #ifndef JNI64 JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1create_1pango_1layout__II)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) @@ -18123,6 +18683,26 @@ } #endif +#ifndef NO__1gtk_1widget_1get_1name +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1get_1name) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1widget_1get_1name_FUNC); +/* + rc = (jintLong)gtk_widget_get_name(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_widget_get_name) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1widget_1get_1name_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1widget_1get_1pango_1context JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1get_1pango_1context) (JNIEnv *env, jclass that, jintLong arg0) @@ -18292,18 +18872,18 @@ #endif #ifndef NO__1gtk_1widget_1get_1state_1flags -JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1get_1state_1flags) +JNIEXPORT jint JNICALL OS_NATIVE(_1gtk_1widget_1get_1state_1flags) (JNIEnv *env, jclass that, jintLong arg0) { - jintLong rc = 0; + jint rc = 0; OS_NATIVE_ENTER(env, that, _1gtk_1widget_1get_1state_1flags_FUNC); /* - rc = (jintLong)gtk_widget_get_state_flags((GtkWidget *)arg0); + rc = (jint)gtk_widget_get_state_flags((GtkWidget *)arg0); */ { OS_LOAD_FUNCTION(fp, gtk_widget_get_state_flags) if (fp) { - rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GtkWidget *))fp)((GtkWidget *)arg0); + rc = (jint)((jint (CALLING_CONVENTION*)(GtkWidget *))fp)((GtkWidget *)arg0); } } OS_NATIVE_EXIT(env, that, _1gtk_1widget_1get_1state_1flags_FUNC); @@ -18695,6 +19275,24 @@ } #endif +#ifndef NO__1gtk_1widget_1queue_1draw +JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1queue_1draw) + (JNIEnv *env, jclass that, jintLong arg0) +{ + OS_NATIVE_ENTER(env, that, _1gtk_1widget_1queue_1draw_FUNC); +/* + gtk_widget_queue_draw(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_widget_queue_draw) + if (fp) { + ((void (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1widget_1queue_1draw_FUNC); +} +#endif + #ifndef NO__1gtk_1widget_1queue_1resize JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1queue_1resize) (JNIEnv *env, jclass that, jintLong arg0) @@ -18846,6 +19444,24 @@ } #endif +#ifndef NO__1gtk_1widget_1set_1focus_1on_1click +JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1set_1focus_1on_1click) + (JNIEnv *env, jclass that, jintLong arg0, jboolean arg1) +{ + OS_NATIVE_ENTER(env, that, _1gtk_1widget_1set_1focus_1on_1click_FUNC); +/* + gtk_widget_set_focus_on_click((GtkWidget *)arg0, (gboolean)arg1); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_widget_set_focus_on_click) + if (fp) { + ((void (CALLING_CONVENTION*)(GtkWidget *, gboolean))fp)((GtkWidget *)arg0, (gboolean)arg1); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1widget_1set_1focus_1on_1click_FUNC); +} +#endif + #ifndef NO__1gtk_1widget_1set_1halign JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1set_1halign) (JNIEnv *env, jclass that, jintLong arg0, jint arg1) @@ -20148,24 +20764,10 @@ jbyte *lparg0=NULL; jintLong rc = 0; OS_NATIVE_ENTER(env, that, _1pango_1font_1description_1from_1string_FUNC); -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail; - } else -#endif - { - if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; - } rc = (jintLong)pango_font_description_from_string((const char *)lparg0); fail: -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, JNI_ABORT); - } else -#endif - { - if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, JNI_ABORT); - } OS_NATIVE_EXIT(env, that, _1pango_1font_1description_1from_1string_FUNC); return rc; } @@ -20261,24 +20863,10 @@ { jbyte *lparg1=NULL; OS_NATIVE_ENTER(env, that, _1pango_1font_1description_1set_1family_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)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; - } pango_font_description_set_family((PangoFontDescription *)arg0, (const char *)lparg1); 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)->ReleaseByteArrayElements(env, arg1, lparg1, JNI_ABORT); - } OS_NATIVE_EXIT(env, that, _1pango_1font_1description_1set_1family_FUNC); } #endif @@ -20986,24 +21574,10 @@ { jbyte *lparg1=NULL; OS_NATIVE_ENTER(env, that, _1pango_1layout_1set_1text_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)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; - } pango_layout_set_text((PangoLayout *)arg0, (const char *)lparg1, (int)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)->ReleaseByteArrayElements(env, arg1, lparg1, JNI_ABORT); - } OS_NATIVE_EXIT(env, that, _1pango_1layout_1set_1text_FUNC); } #endif @@ -21108,6 +21682,16 @@ } #endif +#ifndef NO__1swt_1debug_1on_1fatal_1warnings +JNIEXPORT void JNICALL OS_NATIVE(_1swt_1debug_1on_1fatal_1warnings) + (JNIEnv *env, jclass that) +{ + OS_NATIVE_ENTER(env, that, _1swt_1debug_1on_1fatal_1warnings_FUNC); + swt_debug_on_fatal_warnings(); + OS_NATIVE_EXIT(env, that, _1swt_1debug_1on_1fatal_1warnings_FUNC); +} +#endif + #ifndef NO__1swt_1fixed_1get_1type JNIEXPORT jintLong JNICALL OS_NATIVE(_1swt_1fixed_1get_1type) (JNIEnv *env, jclass that) @@ -21494,6 +22078,30 @@ #endif } #endif + +#if (!defined(NO_memmove__ILorg_eclipse_swt_internal_gtk_GdkRGBA_2I) && !defined(JNI64)) || (!defined(NO_memmove__JLorg_eclipse_swt_internal_gtk_GdkRGBA_2J) && defined(JNI64)) +#ifndef JNI64 +JNIEXPORT void JNICALL OS_NATIVE(memmove__ILorg_eclipse_swt_internal_gtk_GdkRGBA_2I)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2) +#else +JNIEXPORT void JNICALL OS_NATIVE(memmove__JLorg_eclipse_swt_internal_gtk_GdkRGBA_2J)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2) +#endif +{ + GdkRGBA _arg1, *lparg1=NULL; +#ifndef JNI64 + OS_NATIVE_ENTER(env, that, memmove__ILorg_eclipse_swt_internal_gtk_GdkRGBA_2I_FUNC); +#else + OS_NATIVE_ENTER(env, that, memmove__JLorg_eclipse_swt_internal_gtk_GdkRGBA_2J_FUNC); +#endif + if (arg1) if ((lparg1 = getGdkRGBAFields(env, arg1, &_arg1)) == NULL) goto fail; + memmove((void *)arg0, (const void *)lparg1, (size_t)arg2); +fail: +#ifndef JNI64 + OS_NATIVE_EXIT(env, that, memmove__ILorg_eclipse_swt_internal_gtk_GdkRGBA_2I_FUNC); +#else + OS_NATIVE_EXIT(env, that, memmove__JLorg_eclipse_swt_internal_gtk_GdkRGBA_2J_FUNC); +#endif +} +#endif #if (!defined(NO_memmove__ILorg_eclipse_swt_internal_gtk_GtkAdjustment_2) && !defined(JNI64)) || (!defined(NO_memmove__JLorg_eclipse_swt_internal_gtk_GtkAdjustment_2) && defined(JNI64)) #ifndef JNI64 diff -Nru swt4-gtk-4.5.0/os_custom.c swt4-gtk-4.6.0/os_custom.c --- swt4-gtk-4.5.0/os_custom.c 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/os_custom.c 2016-07-06 19:11:33.000000000 +0000 @@ -62,7 +62,7 @@ rc = (jboolean)1; #else rc = (jboolean)0; -#endif +#endif OS_NATIVE_EXIT(env, that, GDK_1WINDOWING_1X11_FUNC) return rc; } @@ -134,6 +134,7 @@ return rc; } #endif + #ifndef NO_pangoFontFamilyNewProc_1CALLBACK static jintLong superPangoFontFamilyNewProc; static PangoFontFamily * pangoFontFamilyNewProc (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { @@ -151,6 +152,7 @@ return rc; } #endif + #ifndef NO_pangoFontFaceNewProc_1CALLBACK static jintLong superPangoFontFaceNewProc; static PangoFontFace * pangoFontFaceNewProc (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { @@ -186,40 +188,6 @@ } #endif - -#ifndef NO__1gtk_1file_1chooser_1dialog_1new -JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1file_1chooser_1dialog_1new) - (JNIEnv *env, jclass that, jbyteArray arg0, jintLong arg1, jint arg2, jintLong arg3, jint arg4, jintLong arg5, jint arg6, jintLong arg7) -{ - jbyte *lparg0=NULL; - jintLong rc = 0; - OS_NATIVE_ENTER(env, that, _1gtk_1file_1chooser_1dialog_1new_FUNC); - if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; -/* - rc = (jintLong)gtk_file_chooser_dialog_new(lparg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); -*/ - { - /* - * On AMD64, it is critical that functions which have a variable number of - * arguments, indicated by '...', include the '...' in their prototype. This - * changes the calling convention, and leaving it out will cause crashes. - * - * For some reason, we must also explicitly declare all of the arguments we - * are passing in, otherwise it crashes. - */ - typedef jintLong (CALLING_CONVENTION* FPTR)(jbyte *, jintLong, jint, jintLong, jint, jintLong, jint, jintLong, ...); - OS_LOAD_FUNCTION(fp, gtk_file_chooser_dialog_new) - if (fp) { - rc = (jintLong)((FPTR) fp)(lparg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); - } - } -fail: - if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); - OS_NATIVE_EXIT(env, that, _1gtk_1file_1chooser_1dialog_1new_FUNC); - return rc; -} -#endif - #ifndef NO__1gtk_1cell_1layout_1set_1attributes JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1cell_1layout_1set_1attributes) (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jbyteArray arg2, jint arg3, jintLong arg4) @@ -544,7 +512,9 @@ window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); gtk_widget_set_window (widget, window); gdk_window_set_user_data (window, widget); - gtk_style_context_set_background (gtk_widget_get_style_context (widget), window); + if (NULL != gtk_check_version (3, 18, 0)) { + gtk_style_context_set_background (gtk_widget_get_style_context (widget), window); + } } static void swt_fixed_map (GtkWidget *widget) { @@ -563,6 +533,13 @@ } } if (gtk_widget_get_has_window (widget)) { + //NOTE: contrary to most of GTK, swt_fixed_* container does not raise windows upon showing them. + //This has the effect that widgets are drawn *beneath* the previous one. + //E.g if this line is changed to gdk_window_show (..) then widgets are drawn on top of the previous one. + //This affects mostly only the absolute layout with overlapping widgets, e.g minimizied panels that + //pop-out in Eclipse (aka fast-view). + //As such, be attentive to swt_fixed_forall(..); traversing children may need to be done in reverse in some + //cases. gdk_window_show_unraised (gtk_widget_get_window (widget)); } } @@ -614,9 +591,13 @@ if (w == -1) w = requisition.width; if (h == -1) h = requisition.height; } + // Feature in GTK: gtk_widget_preferred_size() has to be called before + // gtk_widget_size_allocate otherwise a warning is thrown. See Bug 486068. + gtk_widget_get_preferred_size (child, &requisition, NULL); + child_allocation.width = w; child_allocation.height = h; - + gtk_widget_size_allocate (child, &child_allocation); } } @@ -696,12 +677,43 @@ GList *list; list = priv->children; + + // NOTE: The direction of the list traversal is conditional. + // + // 1) When we do a *_foreach() traversal (i.e, include_internals==FALSE), we traverse the list as normal + // from front to back. + // This is used to layout higher level widgets inside containers (e.g row/grid etc..) in the expected way. + // If for a non-internal traversal we were to go in reverse, then widgets would get laid out in inverse order. + // 2) When we do a *_forall() traversal (i.e, include_internals==TRUE), we traverse the list in *reverse* order. + // This is an internal traversal of the internals of a widget. Reverse traversal is necessary for things like + // DnD Drop and DnD Motion events to find the correct widget in the case of overlapping widgets on an absolute layout. + // Reversal is required because in swt_fixed_map(..) we do not raise the widget when we show it, as a result + // the stack is in reverse. + if (include_internals) + list = g_list_last(list); + while (list) { SwtFixedChild *child_data = list->data; GtkWidget *child = child_data->widget; - list = list->next; + + if (include_internals) + list = list->prev; + else + list = list->next; + (* callback) (child, callback_data); } } + #endif + +//Add ability to debug gtk warnings for SWT snippets via SWT_FATAL_WARNINGS=1 +// env variable. Please see Eclipse bug 471477 +void swt_debug_on_fatal_warnings() { + // NOTE: gtk_parse_args() must be called before gtk_init() to take effect. + int argcount = 2; + char *argument[] = {"", "--g-fatal-warnings"}; + char **arg2 = (char **) &argument; + gtk_parse_args(&argcount, &arg2); +} diff -Nru swt4-gtk-4.5.0/os_custom.h swt4-gtk-4.6.0/os_custom.h --- swt4-gtk-4.5.0/os_custom.h 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/os_custom.h 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2000, 2015 IBM Corporation and others. All rights reserved. +* Copyright (c) 2000, 2016 IBM Corporation and others. All rights reserved. * The contents of this file are made available under the terms * of the GNU Lesser General Public License (LGPL) Version 2.1 that * accompanies this distribution (lgpl-v21.txt). The LGPL is also @@ -8,11 +8,15 @@ * the LGPL accompanying this distribution and there is any conflict * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. -* +* * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ +/* Include guard */ +#ifndef ORG_ECLIPSE_SWT_GTK_OS_CUSTOM_H +#define ORG_ECLIPSE_SWT_GTK_OS_CUSTOM_H + /* Special sizeof's */ #define GPollFD_sizeof() sizeof(GPollFD) #define GtkFixedClass_sizeof() sizeof(GtkFixedClass) @@ -122,6 +126,7 @@ #define gtk_adjustment_get_value_LIB LIB_GTK #define gtk_adjustment_set_page_increment_LIB LIB_GTK #define gtk_adjustment_set_step_increment_LIB LIB_GTK +#define gtk_scrollable_get_vadjustment_LIB LIB_GTK #define gtk_arrow_new_LIB LIB_GTK #define gtk_arrow_set_LIB LIB_GTK #define gtk_box_new_LIB LIB_GTK @@ -144,6 +149,7 @@ #define gtk_cell_layout_clear_LIB LIB_GTK #define gtk_cell_layout_pack_start_LIB LIB_GTK #define gtk_cell_renderer_get_preferred_size_LIB LIB_GTK +#define gtk_cell_renderer_get_fixed_size_LIB LIB_GTK #define gtk_cell_renderer_get_size_LIB LIB_GTK #define gtk_color_selection_dialog_get_color_selection_LIB LIB_GTK #define gtk_color_selection_dialog_new_LIB LIB_GTK @@ -151,10 +157,12 @@ #define gtk_color_selection_get_current_color_LIB LIB_GTK #define gtk_color_selection_set_current_color_LIB LIB_GTK #define gtk_color_selection_palette_to_string_LIB LIB_GTK +#define gtk_color_chooser_add_palette_LIB LIB_GTK #define gtk_color_chooser_get_rgba_LIB LIB_GTK #define gtk_color_chooser_dialog_new_LIB LIB_GTK #define gtk_color_chooser_set_rgba_LIB LIB_GTK #define gtk_color_chooser_set_use_alpha_LIB LIB_GTK +#define gtk_color_chooser_get_use_alpha_LIB LIB_GTK #define gtk_combo_box_entry_new_text_LIB LIB_GTK #define gtk_combo_box_new_text_LIB LIB_GTK #define gtk_combo_box_text_insert_LIB LIB_GTK @@ -164,6 +172,7 @@ #define gtk_combo_box_text_remove_all_LIB LIB_GTK #define gtk_combo_box_text_new_LIB LIB_GTK #define gtk_combo_box_text_new_with_entry_LIB LIB_GTK +#define gtk_combo_box_set_focus_on_click_LIB LIB_GTK #define gtk_drag_begin_LIB LIB_GTK #define gtk_entry_text_index_to_layout_index_LIB LIB_GTK #define gtk_entry_get_inner_border_LIB LIB_GTK @@ -209,11 +218,13 @@ #define gtk_icon_source_free_LIB LIB_GTK #define gtk_icon_source_new_LIB LIB_GTK #define gtk_icon_source_set_pixbuf_LIB LIB_GTK +#define gtk_image_menu_item_set_image_LIB LIB_GTK #define gtk_image_set_from_gicon_LIB LIB_GTK #define gdk_keyboard_ungrab_LIB LIB_GDK #define gtk_icon_theme_get_default_LIB LIB_GTK #define gtk_menu_shell_set_take_focus_LIB LIB_GTK #define gtk_menu_tool_button_new_LIB LIB_GTK +#define gtk_image_menu_item_new_with_label_LIB LIB_GTK #define gtk_window_set_keep_below_LIB LIB_GTK #define gtk_set_locale_LIB LIB_GTK #define gtk_scrollbar_new_LIB LIB_GTK @@ -299,7 +310,11 @@ #define gdk_pointer_ungrab_LIB LIB_GDK #define gdk_region_polygon_LIB LIB_GDK #define gdk_region_get_rectangles_LIB LIB_GDK +#define gdk_rgba_to_string_LIB LIB_GDK +#define gdk_rgba_parse_LIB LIB_GDK #define gdk_screen_get_default_LIB LIB_GDK +#define gdk_screen_get_resolution_LIB LIB_GDK +#define gdk_screen_get_monitor_scale_factor_LIB LIB_GDK #define gdk_screen_get_monitor_at_point_LIB LIB_GDK #define gdk_screen_get_monitor_at_window_LIB LIB_GDK #define gdk_screen_get_monitor_geometry_LIB LIB_GDK @@ -325,6 +340,7 @@ #define gtk_selection_data_get_format_LIB LIB_GTK #define gtk_selection_data_get_length_LIB LIB_GTK #define gtk_selection_data_get_target_LIB LIB_GTK +#define gtk_settings_set_string_property_LIB LIB_GTK #define gtk_status_icon_set_tooltip_LIB LIB_GTK #define gtk_status_icon_position_menu_LIB LIB_GTK #define gtk_window_get_group_LIB LIB_GTK @@ -351,6 +367,8 @@ #define gtk_window_set_skip_taskbar_hint_LIB LIB_GTK #define gtk_widget_is_composited_LIB LIB_GTK #define gtk_widget_get_allocation_LIB LIB_GTK +#define gtk_widget_get_name_LIB LIB_GTK +#define gtk_widget_class_get_css_name_LIB LIB_GTK #define gtk_widget_size_request_LIB LIB_GTK #define gtk_widget_get_default_style_LIB LIB_GTK #define gtk_widget_get_preferred_size_LIB LIB_GTK @@ -383,6 +401,7 @@ #define gtk_widget_modify_style_LIB LIB_GTK #define gtk_widget_get_style_LIB LIB_GTK #define gtk_widget_get_modifier_style_LIB LIB_GTK +#define gtk_widget_set_focus_on_click_LIB LIB_GTK #define gtk_range_get_slider_range_LIB LIB_GTK #define gdk_x11_screen_get_window_manager_name_LIB LIB_GDK #define gdk_x11_screen_lookup_visual_LIB LIB_GDK @@ -489,6 +508,19 @@ #define g_icon_to_string_LIB LIB_GIO #define g_icon_new_for_string_LIB LIB_GIO #define g_file_query_info_LIB LIB_GIO +#define g_settings_get_LIB LIB_GIO +#define g_settings_new_LIB LIB_GIO +#define g_settings_get_value_LIB LIB_GIO +#define g_variant_dict_lookup_value_LIB LIB_GIO +#define g_variant_iter_next_LIB LIB_GIO +#define g_variant_iter_next_value_LIB LIB_GIO +#define g_variant_iter_init_LIB LIB_GIO +#define g_variant_iter_free_LIB LIB_GIO +#define g_variant_iter_new_LIB LIB_GIO +#define g_variant_unref_LIB LIB_GIO +#define g_variant_print_LIB LIB_GIO +#define g_settings_schema_source_get_default_LIB LIB_GIO +#define g_settings_schema_source_lookup_LIB LIB_GIO // GTK3 only #define gtk_widget_draw_LIB LIB_GTK @@ -518,10 +550,13 @@ #define gtk_cell_renderer_get_preferred_height_for_width_LIB LIB_GTK #define gtk_css_provider_load_from_data_LIB LIB_GTK #define gtk_css_provider_new_LIB LIB_GTK +#define gtk_css_provider_to_string_LIB LIB_GTK +#define gtk_css_provider_get_named_LIB LIB_GTK #define gtk_icon_set_render_icon_pixbuf_LIB LIB_GTK #define gtk_drag_set_icon_surface_LIB LIB_GTK #define gtk_accel_label_set_accel_LIB LIB_GTK #define gtk_drag_begin_with_coordinates_LIB LIB_GTK +#define gtk_widget_queue_draw_LIB LIB_GTK #ifndef g_thread_supported #define g_thread_supported() 0 #endif @@ -558,7 +593,6 @@ #else #define GTK_RANGE_SLIDER_END(arg0) (arg0)->slider_end #endif -#define GTK_SCROLLED_WINDOW_SCROLLBAR_SPACING(arg0) (GTK_SCROLLED_WINDOW_GET_CLASS (arg0)->scrollbar_spacing >= 0 ? GTK_SCROLLED_WINDOW_GET_CLASS (arg0)->scrollbar_spacing : 3) #ifndef GTK_WIDGET_SET_FLAGS #define GTK_WIDGET_SET_FLAGS(arg0, arg1) #endif @@ -574,6 +608,13 @@ #if !GTK_CHECK_VERSION(3,0,0) #define GDK_IS_X11_DISPLAY(arg0) 1 #endif +#if GTK_CHECK_VERSION(3,0,0) +#define NO__1GTK_1STOCK_1CANCEL +#define NO__1GTK_1STOCK_1OK +#endif +#if GTK_CHECK_VERSION(3,0,0) +#define NO__1GTK_1IS_1IMAGE_1MENU_1ITEM +#endif #define GTK_ENTRY_IM_CONTEXT(arg0) (arg0)->im_context #define GTK_TEXTVIEW_IM_CONTEXT(arg0) (arg0)->im_context #define GTK_WIDGET_REQUISITION_WIDTH(arg0) (arg0)->requisition.width @@ -660,3 +701,6 @@ #endif +void swt_debug_on_fatal_warnings() ; + +#endif /* ORG_ECLIPSE_SWT_GTK_OS_CUSTOM_H (include guard, this should be the last line) */ diff -Nru swt4-gtk-4.5.0/os.h swt4-gtk-4.6.0/os.h --- swt4-gtk-4.5.0/os.h 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/os.h 2016-07-06 19:11:33.000000000 +0000 @@ -184,6 +184,12 @@ #define NO__1gtk_1style_1context_1set_1state #define NO__1gtk_1color_1chooser_1get_1rgba #define NO__1gtk_1color_1chooser_1set_1rgba +#define NO__1gtk_1color_1chooser_1add_1palette +#define NO_memmove__ILorg_eclipse_swt_internal_gtk_GdkRGBA_2I +#define NO_memmove__JLorg_eclipse_swt_internal_gtk_GdkRGBA_2J +#define NO__1gdk_1rgba_1to_1string +#define NO__1gdk_1rgba_1parse +#define NO__1gtk_1scrollable_1get_1vadjustment #define NO__1g_1object_1set__I_3BLorg_eclipse_swt_internal_gtk_GdkRGBA_2I #define NO__1g_1object_1set__J_3BLorg_eclipse_swt_internal_gtk_GdkRGBA_2J diff -Nru swt4-gtk-4.5.0/os_stats.c swt4-gtk-4.6.0/os_stats.c --- swt4-gtk-4.5.0/os_stats.c 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/os_stats.c 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. All rights reserved. + * Copyright (c) 2000, 2016 IBM Corporation and others. All rights reserved. * The contents of this file are made available under the terms * of the GNU Lesser General Public License (LGPL) Version 2.1 that * accompanies this distribution (lgpl-v21.txt). The LGPL is also @@ -41,9 +41,9 @@ "GTK_1ENTRY_1IM_1CONTEXT", "GTK_1RANGE_1SLIDER_1END", "GTK_1RANGE_1SLIDER_1START", - "GTK_1SCROLLED_1WINDOW_1SCROLLBAR_1SPACING", "GTK_1TEXTVIEW_1IM_1CONTEXT", "GTK_1TYPE_1ACCESSIBLE", + "GTK_1WIDGET_1GET_1CLASS", "GTK_1WIDGET_1REQUISITION_1HEIGHT", "GTK_1WIDGET_1REQUISITION_1WIDTH", "GTypeInfo_1sizeof", @@ -332,6 +332,11 @@ "_1g_1object_1unref", "_1g_1quark_1from_1string", "_1g_1set_1prgname", + "_1g_1settings_1get", + "_1g_1settings_1get_1value", + "_1g_1settings_1new", + "_1g_1settings_1schema_1source_1get_1default", + "_1g_1settings_1schema_1source_1lookup", "_1g_1signal_1add_1emission_1hook", "_1g_1signal_1connect", "_1g_1signal_1connect_1closure", @@ -410,6 +415,7 @@ "_1g_1utf8_1to_1utf16___3BJ_3J_3J_3J", #endif "_1g_1value_1peek_1pointer", + "_1g_1variant_1dict_1lookup_1value", "_1g_1variant_1get_1boolean", "_1g_1variant_1get_1child_1value", "_1g_1variant_1get_1double", @@ -418,6 +424,11 @@ "_1g_1variant_1get_1type_1string", "_1g_1variant_1get_1uint64", "_1g_1variant_1is_1of_1type", + "_1g_1variant_1iter_1free", + "_1g_1variant_1iter_1init", + "_1g_1variant_1iter_1new", + "_1g_1variant_1iter_1next", + "_1g_1variant_1iter_1next_1value", "_1g_1variant_1n_1children", "_1g_1variant_1new_1boolean", "_1g_1variant_1new_1byte", @@ -427,6 +438,8 @@ "_1g_1variant_1new_1string", "_1g_1variant_1new_1tuple", "_1g_1variant_1new_1uint64", + "_1g_1variant_1print", + "_1g_1variant_1unref", "_1gdk_1atom_1intern", "_1gdk_1atom_1name", "_1gdk_1beep", @@ -445,7 +458,7 @@ "_1gdk_1colormap_1alloc_1color", "_1gdk_1colormap_1free_1colors", "_1gdk_1colormap_1get_1system", - "_1gdk_1cursor_1new", + "_1gdk_1cursor_1new_1for_1display", "_1gdk_1cursor_1new_1from_1pixbuf", "_1gdk_1cursor_1new_1from_1pixmap", "_1gdk_1cursor_1unref", @@ -554,14 +567,18 @@ "_1gdk_1region_1subtract", "_1gdk_1region_1union", "_1gdk_1region_1union_1with_1rect", + "_1gdk_1rgba_1parse", + "_1gdk_1rgba_1to_1string", "_1gdk_1screen_1get_1default", "_1gdk_1screen_1get_1monitor_1at_1point", "_1gdk_1screen_1get_1monitor_1at_1window", "_1gdk_1screen_1get_1monitor_1geometry", + "_1gdk_1screen_1get_1monitor_1scale_1factor", "_1gdk_1screen_1get_1monitor_1width_1mm", "_1gdk_1screen_1get_1monitor_1workarea", "_1gdk_1screen_1get_1n_1monitors", "_1gdk_1screen_1get_1primary_1monitor", + "_1gdk_1screen_1get_1resolution", "_1gdk_1screen_1height", "_1gdk_1screen_1width", "_1gdk_1screen_1width_1mm", @@ -636,6 +653,7 @@ "_1glib_1micro_1version", "_1glib_1minor_1version", "_1gtk_1accel_1group_1new", + "_1gtk_1accel_1label_1new", "_1gtk_1accel_1label_1set_1accel", "_1gtk_1accel_1label_1set_1accel_1widget", "_1gtk_1accelerator_1get_1default_1mod_1mask", @@ -658,6 +676,8 @@ "_1gtk_1bin_1get_1child", "_1gtk_1border_1free", "_1gtk_1box_1new", + "_1gtk_1box_1pack_1end", + "_1gtk_1box_1reorder_1child", "_1gtk_1box_1set_1child_1packing", "_1gtk_1box_1set_1homogeneous", "_1gtk_1box_1set_1spacing", @@ -676,6 +696,7 @@ "_1gtk_1cell_1layout_1get_1cells", "_1gtk_1cell_1layout_1pack_1start", "_1gtk_1cell_1layout_1set_1attributes", + "_1gtk_1cell_1renderer_1get_1fixed_1size", "_1gtk_1cell_1renderer_1get_1preferred_1height_1for_1width", "_1gtk_1cell_1renderer_1get_1preferred_1size", "_1gtk_1cell_1renderer_1get_1size", @@ -685,6 +706,7 @@ "_1gtk_1cell_1renderer_1toggle_1new", "_1gtk_1check_1button_1new", "_1gtk_1check_1menu_1item_1get_1active", + "_1gtk_1check_1menu_1item_1new", "_1gtk_1check_1menu_1item_1new_1with_1label", "_1gtk_1check_1menu_1item_1set_1active", "_1gtk_1check_1version", @@ -694,8 +716,10 @@ "_1gtk_1clipboard_1set_1with_1owner", "_1gtk_1clipboard_1store", "_1gtk_1clipboard_1wait_1for_1contents", + "_1gtk_1color_1chooser_1add_1palette", "_1gtk_1color_1chooser_1dialog_1new", "_1gtk_1color_1chooser_1get_1rgba", + "_1gtk_1color_1chooser_1get_1use_1alpha", "_1gtk_1color_1chooser_1set_1rgba", "_1gtk_1color_1chooser_1set_1use_1alpha", "_1gtk_1color_1selection_1dialog_1get_1color_1selection", @@ -725,10 +749,11 @@ "_1gtk_1container_1get_1border_1width", "_1gtk_1container_1get_1children", "_1gtk_1container_1remove", - "_1gtk_1container_1resize_1children", "_1gtk_1container_1set_1border_1width", + "_1gtk_1css_1provider_1get_1named", "_1gtk_1css_1provider_1load_1from_1data", "_1gtk_1css_1provider_1new", + "_1gtk_1css_1provider_1to_1string", "_1gtk_1dialog_1add_1button", "_1gtk_1dialog_1run", "_1gtk_1drag_1begin", @@ -779,7 +804,16 @@ "_1gtk_1expander_1set_1expanded", "_1gtk_1expander_1set_1label_1widget", "_1gtk_1file_1chooser_1add_1filter", - "_1gtk_1file_1chooser_1dialog_1new", +#ifndef JNI64 + "_1gtk_1file_1chooser_1dialog_1new___3BIIIIIII", +#else + "_1gtk_1file_1chooser_1dialog_1new___3BJIJIJIJ", +#endif +#ifndef JNI64 + "_1gtk_1file_1chooser_1dialog_1new___3BII_3BI_3BII", +#else + "_1gtk_1file_1chooser_1dialog_1new___3BJI_3BI_3BIJ", +#endif "_1gtk_1file_1chooser_1get_1filename", "_1gtk_1file_1chooser_1get_1filenames", "_1gtk_1file_1chooser_1get_1filter", @@ -849,6 +883,7 @@ "_1gtk_1image_1set_1from_1gicon", "_1gtk_1image_1set_1from_1icon_1name", "_1gtk_1image_1set_1from_1pixbuf", + "_1gtk_1image_1set_1pixel_1size", "_1gtk_1init_1check", "_1gtk_1label_1get_1layout", "_1gtk_1label_1get_1mnemonic_1keyval", @@ -906,6 +941,8 @@ "_1gtk_1major_1version", "_1gtk_1menu_1bar_1new", "_1gtk_1menu_1item_1get_1submenu", + "_1gtk_1menu_1item_1new", + "_1gtk_1menu_1item_1new_1with_1label", "_1gtk_1menu_1item_1set_1submenu", "_1gtk_1menu_1new", "_1gtk_1menu_1popdown", @@ -1047,6 +1084,7 @@ "_1gtk_1scale_1new", "_1gtk_1scale_1set_1digits", "_1gtk_1scale_1set_1draw_1value", + "_1gtk_1scrollable_1get_1vadjustment", "_1gtk_1scrollbar_1new", "_1gtk_1scrolled_1window_1add_1with_1viewport", "_1gtk_1scrolled_1window_1get_1hadjustment", @@ -1128,6 +1166,7 @@ "_1gtk_1target_1list_1new", "_1gtk_1target_1list_1unref", "_1gtk_1text_1buffer_1copy_1clipboard", + "_1gtk_1text_1buffer_1create_1mark", "_1gtk_1text_1buffer_1cut_1clipboard", "_1gtk_1text_1buffer_1delete", "_1gtk_1text_1buffer_1get_1bounds", @@ -1165,8 +1204,8 @@ "_1gtk_1text_1view_1get_1visible_1rect", "_1gtk_1text_1view_1get_1window", "_1gtk_1text_1view_1new", - "_1gtk_1text_1view_1scroll_1mark_1onscreen", "_1gtk_1text_1view_1scroll_1to_1iter", + "_1gtk_1text_1view_1scroll_1to_1mark", "_1gtk_1text_1view_1set_1editable", "_1gtk_1text_1view_1set_1justification", "_1gtk_1text_1view_1set_1tabs", @@ -1331,6 +1370,7 @@ "_1gtk_1widget_1add_1accelerator", "_1gtk_1widget_1add_1events", "_1gtk_1widget_1child_1focus", + "_1gtk_1widget_1class_1get_1css_1name", #ifndef JNI64 "_1gtk_1widget_1create_1pango_1layout__II", #else @@ -1353,6 +1393,7 @@ "_1gtk_1widget_1get_1has_1window", "_1gtk_1widget_1get_1mapped", "_1gtk_1widget_1get_1modifier_1style", + "_1gtk_1widget_1get_1name", "_1gtk_1widget_1get_1pango_1context", "_1gtk_1widget_1get_1parent", "_1gtk_1widget_1get_1parent_1window", @@ -1385,6 +1426,7 @@ "_1gtk_1widget_1override_1background_1color", "_1gtk_1widget_1override_1color", "_1gtk_1widget_1override_1font", + "_1gtk_1widget_1queue_1draw", "_1gtk_1widget_1queue_1resize", "_1gtk_1widget_1realize", "_1gtk_1widget_1remove_1accelerator", @@ -1397,6 +1439,7 @@ "_1gtk_1widget_1set_1default_1direction", "_1gtk_1widget_1set_1direction", "_1gtk_1widget_1set_1double_1buffered", + "_1gtk_1widget_1set_1focus_1on_1click", "_1gtk_1widget_1set_1halign", "_1gtk_1widget_1set_1has_1window", "_1gtk_1widget_1set_1mapped", @@ -1570,6 +1613,7 @@ "_1pango_1tab_1array_1get_1tabs", "_1pango_1tab_1array_1new", "_1pango_1tab_1array_1set_1tab", + "_1swt_1debug_1on_1fatal_1warnings", "_1swt_1fixed_1get_1type", "_1swt_1fixed_1move", "_1swt_1fixed_1resize", @@ -1627,6 +1671,11 @@ "memmove__JLorg_eclipse_swt_internal_gtk_GdkEventMotion_2J", #endif #ifndef JNI64 + "memmove__ILorg_eclipse_swt_internal_gtk_GdkRGBA_2I", +#else + "memmove__JLorg_eclipse_swt_internal_gtk_GdkRGBA_2J", +#endif +#ifndef JNI64 "memmove__ILorg_eclipse_swt_internal_gtk_GtkAdjustment_2", #else "memmove__JLorg_eclipse_swt_internal_gtk_GtkAdjustment_2", diff -Nru swt4-gtk-4.5.0/os_stats.h swt4-gtk-4.6.0/os_stats.h --- swt4-gtk-4.5.0/os_stats.h 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/os_stats.h 2016-07-06 19:11:33.000000000 +0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. All rights reserved. + * Copyright (c) 2000, 2016 IBM Corporation and others. All rights reserved. * The contents of this file are made available under the terms * of the GNU Lesser General Public License (LGPL) Version 2.1 that * accompanies this distribution (lgpl-v21.txt). The LGPL is also @@ -51,9 +51,9 @@ GTK_1ENTRY_1IM_1CONTEXT_FUNC, GTK_1RANGE_1SLIDER_1END_FUNC, GTK_1RANGE_1SLIDER_1START_FUNC, - GTK_1SCROLLED_1WINDOW_1SCROLLBAR_1SPACING_FUNC, GTK_1TEXTVIEW_1IM_1CONTEXT_FUNC, GTK_1TYPE_1ACCESSIBLE_FUNC, + GTK_1WIDGET_1GET_1CLASS_FUNC, GTK_1WIDGET_1REQUISITION_1HEIGHT_FUNC, GTK_1WIDGET_1REQUISITION_1WIDTH_FUNC, GTypeInfo_1sizeof_FUNC, @@ -342,6 +342,11 @@ _1g_1object_1unref_FUNC, _1g_1quark_1from_1string_FUNC, _1g_1set_1prgname_FUNC, + _1g_1settings_1get_FUNC, + _1g_1settings_1get_1value_FUNC, + _1g_1settings_1new_FUNC, + _1g_1settings_1schema_1source_1get_1default_FUNC, + _1g_1settings_1schema_1source_1lookup_FUNC, _1g_1signal_1add_1emission_1hook_FUNC, _1g_1signal_1connect_FUNC, _1g_1signal_1connect_1closure_FUNC, @@ -420,6 +425,7 @@ _1g_1utf8_1to_1utf16___3BJ_3J_3J_3J_FUNC, #endif _1g_1value_1peek_1pointer_FUNC, + _1g_1variant_1dict_1lookup_1value_FUNC, _1g_1variant_1get_1boolean_FUNC, _1g_1variant_1get_1child_1value_FUNC, _1g_1variant_1get_1double_FUNC, @@ -428,6 +434,11 @@ _1g_1variant_1get_1type_1string_FUNC, _1g_1variant_1get_1uint64_FUNC, _1g_1variant_1is_1of_1type_FUNC, + _1g_1variant_1iter_1free_FUNC, + _1g_1variant_1iter_1init_FUNC, + _1g_1variant_1iter_1new_FUNC, + _1g_1variant_1iter_1next_FUNC, + _1g_1variant_1iter_1next_1value_FUNC, _1g_1variant_1n_1children_FUNC, _1g_1variant_1new_1boolean_FUNC, _1g_1variant_1new_1byte_FUNC, @@ -437,6 +448,8 @@ _1g_1variant_1new_1string_FUNC, _1g_1variant_1new_1tuple_FUNC, _1g_1variant_1new_1uint64_FUNC, + _1g_1variant_1print_FUNC, + _1g_1variant_1unref_FUNC, _1gdk_1atom_1intern_FUNC, _1gdk_1atom_1name_FUNC, _1gdk_1beep_FUNC, @@ -455,7 +468,7 @@ _1gdk_1colormap_1alloc_1color_FUNC, _1gdk_1colormap_1free_1colors_FUNC, _1gdk_1colormap_1get_1system_FUNC, - _1gdk_1cursor_1new_FUNC, + _1gdk_1cursor_1new_1for_1display_FUNC, _1gdk_1cursor_1new_1from_1pixbuf_FUNC, _1gdk_1cursor_1new_1from_1pixmap_FUNC, _1gdk_1cursor_1unref_FUNC, @@ -564,14 +577,18 @@ _1gdk_1region_1subtract_FUNC, _1gdk_1region_1union_FUNC, _1gdk_1region_1union_1with_1rect_FUNC, + _1gdk_1rgba_1parse_FUNC, + _1gdk_1rgba_1to_1string_FUNC, _1gdk_1screen_1get_1default_FUNC, _1gdk_1screen_1get_1monitor_1at_1point_FUNC, _1gdk_1screen_1get_1monitor_1at_1window_FUNC, _1gdk_1screen_1get_1monitor_1geometry_FUNC, + _1gdk_1screen_1get_1monitor_1scale_1factor_FUNC, _1gdk_1screen_1get_1monitor_1width_1mm_FUNC, _1gdk_1screen_1get_1monitor_1workarea_FUNC, _1gdk_1screen_1get_1n_1monitors_FUNC, _1gdk_1screen_1get_1primary_1monitor_FUNC, + _1gdk_1screen_1get_1resolution_FUNC, _1gdk_1screen_1height_FUNC, _1gdk_1screen_1width_FUNC, _1gdk_1screen_1width_1mm_FUNC, @@ -646,6 +663,7 @@ _1glib_1micro_1version_FUNC, _1glib_1minor_1version_FUNC, _1gtk_1accel_1group_1new_FUNC, + _1gtk_1accel_1label_1new_FUNC, _1gtk_1accel_1label_1set_1accel_FUNC, _1gtk_1accel_1label_1set_1accel_1widget_FUNC, _1gtk_1accelerator_1get_1default_1mod_1mask_FUNC, @@ -668,6 +686,8 @@ _1gtk_1bin_1get_1child_FUNC, _1gtk_1border_1free_FUNC, _1gtk_1box_1new_FUNC, + _1gtk_1box_1pack_1end_FUNC, + _1gtk_1box_1reorder_1child_FUNC, _1gtk_1box_1set_1child_1packing_FUNC, _1gtk_1box_1set_1homogeneous_FUNC, _1gtk_1box_1set_1spacing_FUNC, @@ -686,6 +706,7 @@ _1gtk_1cell_1layout_1get_1cells_FUNC, _1gtk_1cell_1layout_1pack_1start_FUNC, _1gtk_1cell_1layout_1set_1attributes_FUNC, + _1gtk_1cell_1renderer_1get_1fixed_1size_FUNC, _1gtk_1cell_1renderer_1get_1preferred_1height_1for_1width_FUNC, _1gtk_1cell_1renderer_1get_1preferred_1size_FUNC, _1gtk_1cell_1renderer_1get_1size_FUNC, @@ -695,6 +716,7 @@ _1gtk_1cell_1renderer_1toggle_1new_FUNC, _1gtk_1check_1button_1new_FUNC, _1gtk_1check_1menu_1item_1get_1active_FUNC, + _1gtk_1check_1menu_1item_1new_FUNC, _1gtk_1check_1menu_1item_1new_1with_1label_FUNC, _1gtk_1check_1menu_1item_1set_1active_FUNC, _1gtk_1check_1version_FUNC, @@ -704,8 +726,10 @@ _1gtk_1clipboard_1set_1with_1owner_FUNC, _1gtk_1clipboard_1store_FUNC, _1gtk_1clipboard_1wait_1for_1contents_FUNC, + _1gtk_1color_1chooser_1add_1palette_FUNC, _1gtk_1color_1chooser_1dialog_1new_FUNC, _1gtk_1color_1chooser_1get_1rgba_FUNC, + _1gtk_1color_1chooser_1get_1use_1alpha_FUNC, _1gtk_1color_1chooser_1set_1rgba_FUNC, _1gtk_1color_1chooser_1set_1use_1alpha_FUNC, _1gtk_1color_1selection_1dialog_1get_1color_1selection_FUNC, @@ -735,10 +759,11 @@ _1gtk_1container_1get_1border_1width_FUNC, _1gtk_1container_1get_1children_FUNC, _1gtk_1container_1remove_FUNC, - _1gtk_1container_1resize_1children_FUNC, _1gtk_1container_1set_1border_1width_FUNC, + _1gtk_1css_1provider_1get_1named_FUNC, _1gtk_1css_1provider_1load_1from_1data_FUNC, _1gtk_1css_1provider_1new_FUNC, + _1gtk_1css_1provider_1to_1string_FUNC, _1gtk_1dialog_1add_1button_FUNC, _1gtk_1dialog_1run_FUNC, _1gtk_1drag_1begin_FUNC, @@ -789,7 +814,16 @@ _1gtk_1expander_1set_1expanded_FUNC, _1gtk_1expander_1set_1label_1widget_FUNC, _1gtk_1file_1chooser_1add_1filter_FUNC, - _1gtk_1file_1chooser_1dialog_1new_FUNC, +#ifndef JNI64 + _1gtk_1file_1chooser_1dialog_1new___3BIIIIIII_FUNC, +#else + _1gtk_1file_1chooser_1dialog_1new___3BJIJIJIJ_FUNC, +#endif +#ifndef JNI64 + _1gtk_1file_1chooser_1dialog_1new___3BII_3BI_3BII_FUNC, +#else + _1gtk_1file_1chooser_1dialog_1new___3BJI_3BI_3BIJ_FUNC, +#endif _1gtk_1file_1chooser_1get_1filename_FUNC, _1gtk_1file_1chooser_1get_1filenames_FUNC, _1gtk_1file_1chooser_1get_1filter_FUNC, @@ -859,6 +893,7 @@ _1gtk_1image_1set_1from_1gicon_FUNC, _1gtk_1image_1set_1from_1icon_1name_FUNC, _1gtk_1image_1set_1from_1pixbuf_FUNC, + _1gtk_1image_1set_1pixel_1size_FUNC, _1gtk_1init_1check_FUNC, _1gtk_1label_1get_1layout_FUNC, _1gtk_1label_1get_1mnemonic_1keyval_FUNC, @@ -916,6 +951,8 @@ _1gtk_1major_1version_FUNC, _1gtk_1menu_1bar_1new_FUNC, _1gtk_1menu_1item_1get_1submenu_FUNC, + _1gtk_1menu_1item_1new_FUNC, + _1gtk_1menu_1item_1new_1with_1label_FUNC, _1gtk_1menu_1item_1set_1submenu_FUNC, _1gtk_1menu_1new_FUNC, _1gtk_1menu_1popdown_FUNC, @@ -1057,6 +1094,7 @@ _1gtk_1scale_1new_FUNC, _1gtk_1scale_1set_1digits_FUNC, _1gtk_1scale_1set_1draw_1value_FUNC, + _1gtk_1scrollable_1get_1vadjustment_FUNC, _1gtk_1scrollbar_1new_FUNC, _1gtk_1scrolled_1window_1add_1with_1viewport_FUNC, _1gtk_1scrolled_1window_1get_1hadjustment_FUNC, @@ -1138,6 +1176,7 @@ _1gtk_1target_1list_1new_FUNC, _1gtk_1target_1list_1unref_FUNC, _1gtk_1text_1buffer_1copy_1clipboard_FUNC, + _1gtk_1text_1buffer_1create_1mark_FUNC, _1gtk_1text_1buffer_1cut_1clipboard_FUNC, _1gtk_1text_1buffer_1delete_FUNC, _1gtk_1text_1buffer_1get_1bounds_FUNC, @@ -1175,8 +1214,8 @@ _1gtk_1text_1view_1get_1visible_1rect_FUNC, _1gtk_1text_1view_1get_1window_FUNC, _1gtk_1text_1view_1new_FUNC, - _1gtk_1text_1view_1scroll_1mark_1onscreen_FUNC, _1gtk_1text_1view_1scroll_1to_1iter_FUNC, + _1gtk_1text_1view_1scroll_1to_1mark_FUNC, _1gtk_1text_1view_1set_1editable_FUNC, _1gtk_1text_1view_1set_1justification_FUNC, _1gtk_1text_1view_1set_1tabs_FUNC, @@ -1341,6 +1380,7 @@ _1gtk_1widget_1add_1accelerator_FUNC, _1gtk_1widget_1add_1events_FUNC, _1gtk_1widget_1child_1focus_FUNC, + _1gtk_1widget_1class_1get_1css_1name_FUNC, #ifndef JNI64 _1gtk_1widget_1create_1pango_1layout__II_FUNC, #else @@ -1363,6 +1403,7 @@ _1gtk_1widget_1get_1has_1window_FUNC, _1gtk_1widget_1get_1mapped_FUNC, _1gtk_1widget_1get_1modifier_1style_FUNC, + _1gtk_1widget_1get_1name_FUNC, _1gtk_1widget_1get_1pango_1context_FUNC, _1gtk_1widget_1get_1parent_FUNC, _1gtk_1widget_1get_1parent_1window_FUNC, @@ -1395,6 +1436,7 @@ _1gtk_1widget_1override_1background_1color_FUNC, _1gtk_1widget_1override_1color_FUNC, _1gtk_1widget_1override_1font_FUNC, + _1gtk_1widget_1queue_1draw_FUNC, _1gtk_1widget_1queue_1resize_FUNC, _1gtk_1widget_1realize_FUNC, _1gtk_1widget_1remove_1accelerator_FUNC, @@ -1407,6 +1449,7 @@ _1gtk_1widget_1set_1default_1direction_FUNC, _1gtk_1widget_1set_1direction_FUNC, _1gtk_1widget_1set_1double_1buffered_FUNC, + _1gtk_1widget_1set_1focus_1on_1click_FUNC, _1gtk_1widget_1set_1halign_FUNC, _1gtk_1widget_1set_1has_1window_FUNC, _1gtk_1widget_1set_1mapped_FUNC, @@ -1580,6 +1623,7 @@ _1pango_1tab_1array_1get_1tabs_FUNC, _1pango_1tab_1array_1new_FUNC, _1pango_1tab_1array_1set_1tab_FUNC, + _1swt_1debug_1on_1fatal_1warnings_FUNC, _1swt_1fixed_1get_1type_FUNC, _1swt_1fixed_1move_FUNC, _1swt_1fixed_1resize_FUNC, @@ -1637,6 +1681,11 @@ memmove__JLorg_eclipse_swt_internal_gtk_GdkEventMotion_2J_FUNC, #endif #ifndef JNI64 + memmove__ILorg_eclipse_swt_internal_gtk_GdkRGBA_2I_FUNC, +#else + memmove__JLorg_eclipse_swt_internal_gtk_GdkRGBA_2J_FUNC, +#endif +#ifndef JNI64 memmove__ILorg_eclipse_swt_internal_gtk_GtkAdjustment_2_FUNC, #else memmove__JLorg_eclipse_swt_internal_gtk_GtkAdjustment_2_FUNC, diff -Nru swt4-gtk-4.5.0/version.txt swt4-gtk-4.6.0/version.txt --- swt4-gtk-4.5.0/version.txt 2015-07-27 16:14:11.000000000 +0000 +++ swt4-gtk-4.6.0/version.txt 2016-07-06 19:11:33.000000000 +0000 @@ -1 +1 @@ -version 4.527 \ No newline at end of file +version 4.623 \ No newline at end of file