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
start
offset
* and extending to the character at offset end - 1
to the clipboard.
- *
+ *
* @param e an event object containing the following information:start
offset
* and extending to the character at offset end - 1
to the clipboard.
- *
+ *
* @param e an event object containing the following information:start
offset.
- *
+ *
* @param e an event object containing the following information: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: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: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:start
offset
* and extending to the character at offset end - 1
to the clipboard.
- *
+ *
* @param e an event object containing the following information:start
offset.
- *
+ *
* @param e an event object containing the following information: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: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: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 VectorAccessible
* 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
* Partially visible characters are included in the returned ranges. *
- * + * * @param e an event object containing the following fields:* Partially visible characters are included in the returned ranges. *
- * + * * @param e an event object containing the following fields:* Partially visible characters are included in the returned ranges. *
- * + * * @param e an event object containing the following fields:* Partially visible characters are included in the returned ranges. *
- * + * * @param e an event object containing the following fields:@@ -369,35 +369,35 @@ *
* 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 @@ *
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 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 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 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 @@
* 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.
*
false
otherwise
* @param frameNames the names of the child frames that the function should
* be accessible in
- *
+ *
* @exception IllegalArgumentException 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 * 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
null
if no such cookie exists
- *
+ *
* @exception IllegalArgumentException 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 @@ -280,7 +280,7 @@ * @exception IllegalArgumentException
@@ -307,7 +307,7 @@ * @exception IllegalArgumentException
@@ -335,7 +335,7 @@ * @exception IllegalArgumentException
@@ -362,7 +362,7 @@ * @exception IllegalArgumentException
@@ -413,7 +413,7 @@ * @exception IllegalArgumentException
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 true
if the receiver was disposed, and false
otherwise
- *
+ *
* @exception SWTException
* 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 trustedtrue> 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
*
SWT.MOZILLA
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 @@
* 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 @@
* 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
* 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
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 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 @@
* Browser
whose location is changing
* false
to prevent the location
- * from being loaded
+ * from being loaded
* 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
* Browser
whose location has changed
* 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
* 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 null
. The event.required field
* is true on platforms that don't support a standalone system browser for
- * new window requests.
+ * new window requests.
*
* The navigation is cancelled if the event.required field is set to
* true and the event.browser field is left null
.
@@ -45,16 +45,16 @@
*
Browser
to handle the new window or false otherwise.
- * Browser
that will host the
+ * Browser
that will host the
* content of the new window.
- * Browser
that is requesting to open a
+ * Browser
that is requesting to open a
* new window
* WindowEvent
that needs to be passed a new
* Browser
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.
*
- *
+ *
* @see Sample code and further information
*
* @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 Sample code and further information
*
* @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.
* * @@ -37,14 +37,14 @@ *
Browser
whose current URL is being loaded
* ProgressEvent
related to the loading of the
* current location of a Browser
- *
+ *
* @since 3.0
- */
+ */
public void changed(ProgressEvent event);
-
+
/**
* This method is called when the current location has been completely loaded.
* @@ -53,10 +53,10 @@ *
Browser
whose current URL has been loaded
* ProgressEvent
related to the Browser
* 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 Sample code and further information
*
* @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.
* * *
The following fields in the StatusTextEvent
apply:
@@ -35,10 +35,10 @@
*
Browser
whose status text is changed
* StatusTextEvent
that contains the updated
* status description of a Browser
- *
+ *
* @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 TitleEvent
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 Sample code and further information
*
* @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 @@
* Browser
whose current document's
* title is known or modified
* TitleEvent
that contains the title
* of the document currently displayed in a Browser
- *
+ *
* @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.
*
- *
+ *
* @see Sample code and further information
*
* @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 Browser
+ * This method is called when the window hosting a Browser
* is requested to be hidden. Application would typically hide the
* {@link org.eclipse.swt.widgets.Shell} that hosts the Browser
.
*
@@ -39,17 +39,17 @@
*
* @param event the WindowEvent
that specifies the
* Browser
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 Browser
- * 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 Browser
, if a particular location and size
* are specified. The application would then open that Shell
.
*
@@ -57,35 +57,35 @@ *
The following fields in the WindowEvent
apply:
*
Browser
to display
- * Shell
- * hosting the browser. It is null
if no location is set.
+ * Shell
+ * hosting the browser. It is null
if no location is set.
* Browser
.
* The client area of the Shell
hosting the
* Browser
should be large enough to accommodate that size.
* It is null
if no size is set.
- * true
if the Shell
+ * true
if the Shell
* hosting the Browser
should display an address bar or
* false
otherwise
- * true
if the Shell
+ * true
if the Shell
* hosting the Browser
should display a menu bar or
* false
otherwise
- * true
if the Shell
+ * true
if the Shell
* hosting the Browser
should display a status bar or
* false
otherwise
- * true
if the Shell
+ * true
if the Shell
* hosting the Browser
should display a tool bar or
* false
otherwise
* WindowEvent
that specifies the
* Browser
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
* The following example shows how WindowEvent
's are typically
* handled.
- *
+ *
*
- *
+ *
* 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.
+ *
*
* public static void main(String[] args) {
* Display display = new Display();
@@ -90,10 +90,10 @@
* });
* }
*
Main Browser *
Second Browser *
Browser
to handle the new window.
- *
+ *
* @since 3.1
*/
public boolean required;
-
-
- /**
+
+
+ /**
* Browser
provided by the application.
*/
public Browser browser;
- /**
+ /**
* Requested location for the Shell
hosting the Browser
.
* It is null
if no location has been requested.
*/
public Point location;
- /**
- * Requested Browser
size. The client area of the Shell
- * hosting the Browser
should be large enough to accommodate that size.
+ /**
+ * Requested Browser
size. The client area of the Shell
+ * hosting the Browser
should be large enough to accommodate that size.
* It is null
if no size has been requested.
*/
public Point size;
-
+
/**
* Specifies whether the Shell
hosting the Browser
should
* display an address bar.
- *
+ *
* @since 3.1
*/
public boolean addressBar;
@@ -162,29 +162,29 @@
/**
* Specifies whether the Shell
hosting the Browser
should
* display a menu bar. Note that this is always true
on OS X.
- *
+ *
* @since 3.1
*/
public boolean menuBar;
-
+
/**
* Specifies whether the Shell
hosting the Browser
should
* display a status bar.
- *
+ *
* @since 3.1
*/
public boolean statusBar;
-
+
/**
* Specifies whether the Shell
hosting the Browser
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
- *
+ *
*
* 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.
@@ -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
- * 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: *
* 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" *- * + * *
* 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: *
* The following event fields are used:
* Application code does not need to explicitly release the
* resources managed by each instance when those instances are no longer
* required, and thus no dispose()
method is provided.
*
ST.BULLET_DOT
.
+/**
+ * Create a new bullet with the specified style, and type ST.BULLET_DOT
.
* The style must have a glyph metrics set.
*
- * @param style the style
- *
+ * @param style the style
+ *
* @exception IllegalArgumentException Runnable
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 * IMPORTANT: This class is not intended to be subclassed. *
- * + * * @see Sample code and further information * * @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. *
* 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.
@@ -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
true
if the CBanner is rendered
* with a simple, traditional shape.
- *
+ *
* @return true
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 true
if the CBanner should render itself in a simple, traditional style
- *
+ *
* @exception SWTException
* 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.
@@ -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; ideselectAll()
.
*
String
s which are the items
- * in the receiver's list.
+ * in the receiver's list.
* * 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. *
* * @return the items in the receiver's list @@ -764,7 +767,7 @@ *setTextLimit()
, it will be the constant
* Combo.LIMIT
.
- *
+ *
* @return the text limit
- *
+ *
* @exception SWTException Combo
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.
* * 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 @@ *
- * 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: *
* ignores the indent in left align mode @@ -34,7 +34,7 @@ *
* This class may be subclassed for the purpose of overriding the default string
* shortening algorithm that is implemented in method shortenText()
.
@@ -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 @@
*
* 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.
@@ -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 null
.
- *
+ *
* @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
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:
*- * 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}); ** - * @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
null
- * clears the background gradient; the value null
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 null
+ * clears the background gradient; the value null
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 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:
*- * 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); ** - * @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
null
- * clears the background gradient; the value null
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 null
+ * clears the background gradient; the value null
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 null
clears it.
- *
+ *
* @param image the image to be displayed in the label or null
- *
+ *
* @exception SWTException Here is an example of using a ControlEditor:
*
* Note: The Control provided as the editor must 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 Sample code and further information
- *
+ *
* @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.
*
* The default behaviour is to close the CTabItem.
*
* The default behaviour is to do nothing.
*
* The default behaviour is to do nothing.
*
* The default behaviour is to do nothing.
*
- * 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.
*
* 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
- * Note: Only one of the styles TOP and BOTTOM
+ * Note: Only one of the styles TOP and BOTTOM
* may be specified.
*
* IMPORTANT: This class is not intended to be subclassed.
@@ -49,9 +51,9 @@
* @see Sample code and further information
* @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 @@
*
* The style value is either one of the style constants defined in
* class
* 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
false
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 CTabFolderListener
interface.
- *
+ *
* @see CTabFolderListener
* @see CTabFolderEvent
* @see Sample code and further information
*/
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 Sample code and further information
+ * @see Sample code and further information
*/
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 @@
* 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.
@@ -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
*
- *
+ *
* @exception SWTException
*
- *
+ *
* @since 3.0
*/
public boolean getBorderVisible() {
@@ -838,7 +844,7 @@
* SelectionListener
@@ -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 @@
*
false
otherwise.
* * 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. *
* 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).
@@ -1087,7 +1093,7 @@ *true
if the CTabFolder is rendered
* with a simple, traditional shape.
- *
+ *
* @return true
if the CTabFolder is rendered with a simple shape
- *
+ *
* @since 3.0
*/
public boolean getSimple() {
@@ -1205,9 +1211,9 @@
/**
* Returns true
if the CTabFolder only displays the selected tab
* and false
if the CTabFolder displays multiple tabs.
- *
+ *
* @return true
if the CTabFolder only displays the selected tab and false
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 SWT.RIGHT
or SWT.FILL
- *
+ * SWT.RIGHT
or SWT.FILL
+ *
* @exception SWTException true
if the close button appears
+ * Returns true
if the close button appears
* when the user hovers over an unselected tabs.
- *
+ *
* @return true
if the close button appears on unselected tabs
- *
+ *
* @since 3.0
*/
public boolean getUnselectedCloseVisible() {
@@ -1303,11 +1309,11 @@
return showUnselectedClose;
}
/**
- * Returns true
if an image appears
+ * Returns true
if an image appears
* in unselected tabs.
- *
+ *
* @return true
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 - * 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}); ** - * @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
null
clears the
- * background gradient. The value null
can be used inside the array of
+ * background gradient. The value null
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 percents
* array must be one less than the size of the colors
array.
- *
+ *
* @exception SWTException - * 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); ** - * @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
null
clears the
- * background gradient. The value null
can be used inside the array of
+ * background gradient. The value null
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 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 true
,
- * and marks it invisible otherwise.
+ * and marks it invisible otherwise.
*
* @param visible the new visibility state
*
@@ -2893,7 +2902,7 @@
* true
,
- * and marks it invisible otherwise.
+ * and marks it invisible otherwise.
*
* @param visible the new visibility state
*
@@ -2957,7 +2966,7 @@
* * 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).
@@ -3037,7 +3046,7 @@ *- * 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}); ** - * @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
null
clears the
- * background gradient. The value null
can be used inside the array of
+ * background gradient. The value null
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 - * 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); ** - * @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
null
clears the
- * background gradient. The value null
can be used inside the array of
+ * background gradient. The value null
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 true
if the CTabFolder should render itself in a simple, traditional style
- *
+ *
* @exception SWTException true
if only the selected tab should be displayed otherwise, multiple tabs will be shown.
- *
+ *
* @exception SWTException SWT.TOP
for tabs along the top or SWT.BOTTOM
for tabs along the bottom
- *
+ *
* @exception SWTException
* The alignment parameter sets the layout of the control in the tab area.
- * SWT.RIGHT
will cause the control to be positioned on the far
- * right of the folder and it will have its default size. SWT.FILL
+ * SWT.RIGHT
will cause the control to be positioned on the far
+ * right of the folder and it will have its default size. SWT.FILL
* 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.
* SWT.RIGHT | SWT.WRAP
will allow the control to wrap below the
@@ -3518,7 +3527,7 @@
*
true
makes the close button appear
- *
+ *
* @exception SWTException true
makes the image appear
- *
+ *
* @exception SWTException
* The flags parameter sets the layout of the control in the tab area.
-* SWT.LEAD
will cause the control to be positioned on the left
+* SWT.LEAD
will cause the control to be positioned on the left
* of the tabs. SWT.TRAIL
will cause the control to be positioned on
-* the far right of the folder and it will have its default size. SWT.TRAIL
-* can be combined with SWT.FILL
to fill all the available space to the
-* right of the last tab. SWT.WRAP
can also be added to SWT.TRAIL
+* the far right of the folder and it will have its default size. SWT.TRAIL
+* can be combined with SWT.FILL
to fill all the available space to the
+* right of the last tab. SWT.WRAP
can also be added to SWT.TRAIL
* only to cause a control to wrap if there is not enough space to display it in its
* entirety.
*
CTabFolder
. 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 SWT.DEFAULT
is passed for the hint.
+ * To indicate that the caller does not wish to constrain a particular
+ * dimension, the constant SWT.DEFAULT
is passed for the hint.
*
- * The part
value indicated what component the preferred size is
+ * The part
value indicated what component the preferred size is
* to be calculated for. Valid values are any of the part constants:
- *
- * The state
parameter may be one of the following:
+ * The state
parameter may be one of the following:
*
SWT.DEFAULT
)
* @param hHint the height hint (can be SWT.DEFAULT
)
* @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).
*
- *
- * @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 part
of the CTabFolder using the provided bounds
and GC
.
+ * Draw a specified part
of the CTabFolder using the provided bounds
and GC
.
* The valid CTabFolder part
constants are:
*
- * The state
parameter may be a combination of:
+ * The state
parameter may be a combination of:
*
* 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.
@@ -91,7 +91,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.
@@ -165,14 +165,14 @@
}
/**
* Get the image displayed in the tab if the tab is disabled.
- *
+ *
* @return the disabled image or null
- *
+ *
* @exception SWTException
CTabFolder
.
*
* @return the receiver's parent
- *
+ *
* @exception SWTException true
to indicate that the receiver's close button should be shown.
* Otherwise return false
. The initial value is defined by the style (SWT.CLOSE)
* that was used to create the receiver.
- *
+ *
* @return true
if the close button should be shown
*
* @exception SWTException true
if the item will be rendered in the visible area of the CTabFolder. Returns false otherwise.
-*
+*
* @return true
if the item will be rendered in the visible area of the CTabFolder. Returns false otherwise.
-*
+*
* @exception SWTException true
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 * 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. *
* 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"); - VectorStyledTextContent> 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.
* lineCount
is updated to reflect the new entry.
*
@@ -61,8 +62,8 @@
lines[lineCount] = range;
lineCount++;
}
-/**
- * Adds a line index to the end of linesArray
. Increases the
+/**
+ * Adds a line index to the end of linesArray
. Increases the
* size of the array if necessary and returns a new array.
*
*
@@ -85,10 +86,10 @@
return newLines;
}
/**
- * Adds a TextChangeListener
listening for
- * TextChangingEvent
and TextChangedEvent
. A
+ * Adds a TextChangeListener
listening for
+ * TextChangingEvent
and TextChangedEvent
. A
* TextChangingEvent
is sent before changes to the text occur.
- * A TextChangedEvent
is sent after changes to the text
+ * A TextChangedEvent
is sent after changes to the text
* occurred.
*
*
@@ -97,6 +98,7 @@
*
- ERROR_NULL_ARGUMENT when listener is null
*
* @@ -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. *
* @@ -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. *
* @@ -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. *
* @@ -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 @@ *
StyledTextContent
interface.
* @@ -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 @@ *
* * @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 @@ *
* - * @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
@@ -661,7 +669,7 @@ System.arraycopy(lines, 0, newLines, 0, size); lines = newLines; } -/** +/** * Reports an SWT error. *
* @@ -670,7 +678,7 @@ void error (int code) { SWT.error(code); } -/** +/** * Returns whether or not a gap exists in the text store. *
* @@ -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 @@ *
* * @param listener the listener which should no longer be notified - * + * * @exception IllegalArgumentException
newText
starting at position start
+ * Replaces the text with newText
starting at position start
* for a length of replaceLength
. Notifies the appropriate listeners.
*
*
- * When sending the TextChangingEvent, newLineCount
is the number of
- * lines that are going to be inserted and replaceLineCount
is
- * the number of lines that are going to be deleted, based on the change
+ * When sending the TextChangingEvent, newLineCount
is the number of
+ * lines that are going to be inserted and replaceLineCount
is
+ * the number of lines that are going to be deleted, based on the change
* that occurs visually. For example:
*
* * @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 Sample code and further information */ 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 Sample code and further information */ 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 Sample code and further information */ 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 Sample code and further information * * @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. - * + * *
* The following event fields are used:
* The following event fields are used:
* The following event fields are used:
-* 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
* 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.
@@ -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.
- *
+ *
*
* To retrieve the bidi orientation of the SashForm use {@link #getStyle()}
* and test if the SWT.RIGHT_TO_LEFT or SWT.LEFT_TO_RIGHT bits are set.
*
- * 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. *
- * + * * @param orientation SWT.HORIZONTAL or SWT.VERTICAL, SWT.RIGHT_TO_LEFT or SWT.LEFT_TO_RIGHT - * + * * @see Control#setOrientation(int) - * + * * @exception SWTExceptionThere are two ways to use the ScrolledComposite: - * + * *
- * 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().
- *
+ *
*
* The style value is either one of the style constants defined in
* class
* 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 @@
*
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.
@@ -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 true
if the content control
+ * Returns true
if the content control
* will be expanded to fill available horizontal space.
*
* @return the receiver's horizontal expansion state
@@ -238,7 +243,7 @@
*
true
if the content control
+ * Returns true
if the content control
* will be expanded to fill available vertical space.
*
* @return the receiver's vertical expansion state
@@ -256,7 +261,7 @@
* true
if the receiver automatically scrolls to a focused child control
+ * Returns true
if the receiver automatically scrolls to a focused child control
* to make it visible. Otherwise, returns false
.
- *
+ *
* @return a boolean indicating whether focused child controls are automatically scrolled into the viewport
*
* @exception SWTException false
, show a focused control is off.
+ *
+ * If show is false
, show a focused control is off.
* By default, show a focused control is off.
- *
+ *
* @param show true
to show a focused control.
- *
+ *
* @exception SWTException Here is an example which places ten buttons in a stack layout and + * + *
Here is an example which places ten buttons in a stack layout and * flips between them: - * + * *
* 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();
+ * }
* }
*
*
@@ -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 Sample code and further information
*/
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.
* * - * @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. *
* - * @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: *
- * NOTE: When there is no text (i.e., no lines), getOffsetAtLine(0) + * NOTE: When there is no text (i.e., no lines), getOffsetAtLine(0) * is a valid call that should return 0. *
* * @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: ** - * @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 @@ *
* * @param listener the listener which should no longer be notified - * + * * @exception IllegalArgumentException
- * Implementors have to notify the TextChangeListeners that were added
- * using addTextChangeListener
before and after the content
- * is changed. A TextChangingEvent
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 addTextChangeListener
before and after the content
+ * is changed. A TextChangingEvent
has to be sent to the
+ * textChanging method before the content is changed and a
* TextChangedEvent
has to be sent to the textChanged method
* after the content has changed.
- * The text change that occurs after the TextChangingEvent
- * has been sent has to be consistent with the data provided in the
+ * The text change that occurs after the TextChangingEvent
+ * has been sent has to be consistent with the data provided in the
* TextChangingEvent
.
- * 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
* TextChangedEvent
is received.
*
* The TextChangingEvent
should be set as follows:
*
TextChangedEvent
to the
- * textSet method of the TextChangeListeners that were added using
+ * Implementors have to send a TextChangedEvent
to the
+ * textSet method of the TextChangeListeners that were added using
* addTextChangeListener
.
*
*
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 StyledText
.
- *
+ *
*
Classes that wish to provide their own drag under effect for a StyledText
* can extend this class, override the StyledTextDropTargetEffect.dragOver
- * method and override any other applicable methods in StyledTextDropTargetEffect
to
+ * method and override any other applicable methods in StyledTextDropTargetEffect
to
* display their own drag under effect.
super
method to get the default drag under effect implementation.
*
- * The feedback value is either one of the FEEDBACK constants defined in
- * class DND
which is applicable to instances of this class,
- * or it must be built by bitwise OR'ing together
+ *
The feedback value is either one of the FEEDBACK constants defined in
+ * class DND
which is applicable to instances of this class,
+ * or it must be built by bitwise OR'ing together
* (that is, using the int
"|" operator) two or more
- * of those DND
effect constants.
+ * of those DND
effect constants.
*
*
StyledTextDropTargetEffect
to handle the drag under effect on the specified
+ * Creates a new StyledTextDropTargetEffect
to handle the drag under effect on the specified
* StyledText
.
- *
+ *
* @param styledText the StyledText
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 dragEnter
provides a default drag under effect
* for the feedback specified in event.feedback
.
- *
+ *
* For additional information see DropTargetAdapter.dragEnter
.
- *
+ *
* Subclasses that override this method should call super.dragEnter(event)
* 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 dragLeave
provides a default drag under effect
* for the feedback specified in event.feedback
.
- *
+ *
* For additional information see DropTargetAdapter.dragLeave
.
- *
+ *
* Subclasses that override this method should call super.dragLeave(event)
* 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 dragOver
provides a default drag under effect
* for the feedback specified in event.feedback
.
- *
+ *
* For additional information see DropTargetAdapter.dragOver
.
- *
+ *
* Subclasses that override this method should call super.dragOver(event)
* 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 dropAccept
provides a default drag under effect
* for the feedback specified in event.feedback
.
- *
+ *
* For additional information see DropTargetAdapter.dropAccept
.
- *
+ *
* Subclasses that override this method should call super.dropAccept(event)
* 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 - * 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. *
- * 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: *
* 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: *
* 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. *
*
Printing
is returned in the
- * StyledText#print(Printer) API. The run() method may be
+ * An instance of Printing
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;
- HashtablePrinting
.
- * Copies the widget content and rendering data that needs
+ * Copies the widget content and rendering data that needs
* to be requested from listeners.
*
* @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.
*
- * @param printerContent StyledTextContent
to request
+ * @param printerContent StyledTextContent
to request
* line data for.
*/
void cacheLineData(StyledText styledText) {
@@ -282,7 +285,7 @@
}
Point screenDPI = styledText.getDisplay().getDPI();
Point printerDPI = printer.getDPI();
- resources = new HashtableRTFWriter
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.
* - * 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. *
* 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. *
*/ class RTFWriter extends TextWriter { static final int DEFAULT_FOREGROUND = 0; static final int DEFAULT_BACKGROUND = 1; - Vectorstart
and length
can be set to specify partial
+ * in the document. start
and length
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 VectortoString()
does not return a valid RTF string until
+ * NOTE: toString()
does not return a valid RTF string until
* close()
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 TextWriter
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.
*
- * NOTE: toString()
is guaranteed to return a valid string only after close()
+ * NOTE: toString()
is guaranteed to return a valid string only after close()
* has been called.
*
start
and length
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. close()
must be called before toString()
+ * Returns the string. close()
must be called before toString()
* 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
* 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.
@@ -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.
*
- * 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. *
* * @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
* When widgetSelected
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.
+ *
* widgetDefaultSelected
is not called for StyledTexts.
*
* The text will be put on the clipboard in plain text format and RTF format.
* The DND.CLIPBOARD
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.
*
- * The clipboardType is one of the clipboard constants defined in class
- * DND
. The DND.CLIPBOARD
clipboard is
- * used for data that is transferred by keyboard accelerator (such as Ctrl+C/Ctrl+V)
- * or by menu action. The DND.SELECTION_CLIPBOARD
- * clipboard is used for data that is transferred by selecting text and pasting
+ * The clipboardType is one of the clipboard constants defined in class
+ * DND
. The DND.CLIPBOARD
clipboard is
+ * used for data that is transferred by keyboard accelerator (such as Ctrl+C/Ctrl+V)
+ * or by menu action. The DND.SELECTION_CLIPBOARD
+ * clipboard is used for data that is transferred by selecting text and pasting
* with the middle mouse button.
*
* Returns only the first line if the widget has the SWT.SINGLE style. *
* - * @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- * 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. *
* @@ -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. *- * 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. *
* @@ -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. *- * 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. *
* 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. *- * 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. *
@@ -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
- * 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). *
* @@ -4092,17 +4123,17 @@ * Returns the line height at the given offset. * * @param offset the offset - * + * * @return line height in pixels - * + * * @exception SWTException- * 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. *
- * - * @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 givenindex
.
- *
+ *
* @param index the index of the line
- *
- * @return the tab stops for the line
- *
+ *
+ * @return the tab stops for the line
+ *
* @exception SWTException index
.
- *
+ *
* @param index the index of the line
- *
+ *
* @return the wrap indentation
- *
+ *
* @exception SWTException * The return value reflects the character offset that the caret will @@ -4411,9 +4442,9 @@ * the returned offset will be behind the character. *
* - * @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
* 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 getStyleRanges(int, int, boolean)
.
*
* 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
* 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 *
* - * @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* 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. *
* - * @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- * 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. *
* Note: Because a StyleRange includes the start and length, the @@ -4947,7 +4978,7 @@ *- * 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. *
* Note: When includeRanges
is true, the start and length
@@ -4967,18 +4998,18 @@
* false, getRanges(int, int)
can be used to get the
* associated ranges.
*
- * 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. *
* 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 StyleRange
will have a starting offset >= start
- * and the last returned StyleRange
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 StyleRange
will have a starting offset >= start
+ * and the last returned StyleRange
will have an ending
* offset <= start + length - 1
*
* @exception SWTException
- * 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. *
* Note: When includeRanges
is true, the start and length
@@ -5037,15 +5068,15 @@
* false, getRanges(int, int)
can be used to get the
* associated ranges.
*
StyleRange
will have a starting offset >= start
- * and the last returned StyleRange
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 StyleRange
will have a starting offset >= start
+ * and the last returned StyleRange
will have an ending
* offset <= start + length - 1
*
* @exception SWTException - * 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. *
* @@ -5256,7 +5287,7 @@ checkWidget(); return topIndex; } -/** +/** * Returns the top margin. * * @return the top margin. @@ -5264,7 +5295,7 @@ *- * 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. *
* @@ -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
* NOTE: 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 true
if any text in the widget is selected,
* and false
otherwise.
- *
+ *
* @return the text selection state
* @exception SWTException
DND.CLIPBOARD
- * 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 DND.CLIPBOARD
+ * 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 @@
* * The runnable may be run in a non-UI thread. *
- * + * * @param printer the printer to print to * * @return aRunnable
for printing the receiver's text
@@ -7408,7 +7477,7 @@
* * The runnable may be run in a non-UI thread. *
- * + * * @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. *
* Recalculates the content width for all lines in the bounds.
- * When a LineStyleListener
is used a redraw call
- * is the only notification to the widget that styles have changed
+ * When a LineStyleListener
is used a redraw call
+ * is the only notification to the widget that styles have changed
* and that the content width may have changed.
*
all
flag
* is true
, any children of the receiver which
* intersect with the specified area will also paint their
- * intersecting areas. If the all
flag is
+ * intersecting areas. If the all
flag is
* false
, the children will not be painted.
*
* Marks the content width of all lines in the specified rectangle
* as unknown. Recalculates the content width of all visible lines.
- * When a LineStyleListener
is used a redraw call
- * is the only notification to the widget that styles have changed
+ * When a LineStyleListener
is used a redraw call
+ * is the only notification to the widget that styles have changed
* and that the content width may have changed.
*
* 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, setStyleRanges(int, int, int[], StyleRange[])
* can be used to share styles and reduce memory usage.
*
- * 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. *
* * @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* NOTE: During the replace operation the current selection is * changed as follows: - *
- * 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. *
* * @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 ofSWT.LEFT
,
+ * Sets the alignment of the widget. The argument should be one of SWT.LEFT
,
* SWT.CENTER
or SWT.RIGHT
. The alignment applies for all lines.
*
* Note that if SWT.MULTI
is set, then SWT.WRAP
must also be set
* in order to stabilize the right edge before setting alignment.
*
- * NOTE: The horizontal index is reset to 0 when new text is set in the + * NOTE: The horizontal index is reset to 0 when new text is set in the * widget. *
* - * @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- * NOTE: The horizontal pixel offset is reset to 0 when new text + * NOTE: The horizontal pixel offset is reset to 0 when new text * is set in the widget. *
* - * @param pixel horizontal pixel offset relative to the start + * @param pixel horizontal pixel offset relative to the start * of the line. * @exception SWTException- * 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. *
- * + * * @param indent the new indent - * + * * @exception SWTException- * 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). *
* - * @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 SWTExceptionSWT.LEFT
,
+ * Sets the alignment of the specified lines. The argument should be one of SWT.LEFT
,
* SWT.CENTER
or SWT.RIGHT
.
*
* Note that if SWT.MULTI
is set, then SWT.WRAP
must also be set
* in order to stabilize the right edge before setting alignment.
*
- * 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. *
- * 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
* 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. *
- * 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. *
- * 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. *
- * 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 color is applied to, 0 based * @param lineCount number of lines the color applies to. * @param background line background color @@ -9081,7 +9150,7 @@ *- * 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. *
- * 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. *
- * 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. *
* * @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- * 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. *
- * 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. *
- * 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. *
* * @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- * 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. *
- * 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. *
- * 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. *
- * + * * @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
- * 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.
*
- * 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. *
- * 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. *
- * + * * @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
- * 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.
*
- * 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. *
- * 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. *
* * @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 SWTExceptionSWT.LEFT_TO_RIGHT
or SWT.RIGHT_TO_LEFT
.
*
* @param orientation new orientation style
- *
+ *
* @exception SWTException * 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 *
* @@ -9544,13 +9613,13 @@ ** Note that this is a HINT. 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
* 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 *
* - * @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 @@ *- * 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. *
* * @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. ** 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
* 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. *
- * 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. *
* @@ -9750,7 +9821,7 @@ *start
and
+/**
+ * Clears the styles in the range specified by start
and
* length
and adds the new styles.
* * 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. *
- * 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. *
* @@ -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* 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. *
- * 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. *
* * @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
* Note: Because a StyleRange includes the start and length, the
@@ -9951,12 +10022,12 @@
* multiple StyleRanges, setStyleRanges(int[], StyleRange[])
* can be used to share styles and reduce memory usage.
*
- * 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. *
* * @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- * Note: Only a single line of text should be set when the SWT.SINGLE + * Note: Only a single line of text should be set when the SWT.SINGLE * style is used. *
* - * @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- * 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. *
* - * @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* 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. *
- * + * * @param wrapIndent the new wrap indent - * + * * @exception SWTException- * 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. *
* @@ -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 @@ * ** 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(); ** @@ -49,7 +49,7 @@ *
left, center, right = <page> | #CDATA
*Header and footer are defined as three separate regions for arbitrary
* text or the page number placeholder <page>
- * (StyledTextPrintOptions.PAGE_TAG
). The three regions are
+ * (StyledTextPrintOptions.PAGE_TAG
). The three regions are
* left aligned, centered and right aligned. They are separated by a tab
* character (StyledTextPrintOptions.SEPARATOR
).
*/
@@ -60,7 +60,7 @@
*
left, center, right = <page> | #CDATA
*Header and footer are defined as three separate regions for arbitrary
* text or the page number placeholder <page>
- * (StyledTextPrintOptions.PAGE_TAG
). The three regions are
+ * (StyledTextPrintOptions.PAGE_TAG
). The three regions are
* left aligned, centered and right aligned. They are separated by a tab
* character (StyledTextPrintOptions.SEPARATOR
).
*/
@@ -69,7 +69,7 @@
* Name of the print job.
*/
public String jobName = null;
-
+
/**
* Print the text foreground color. Default value is false
.
*/
@@ -86,19 +86,19 @@
* Print the line background color. Default value is false
.
*/
public boolean printLineBackground = false;
-
+
/**
* Print line numbers. Default value is false
.
- *
+ *
* @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;
/**
* StyleRange
defines a set of styles for a specified
@@ -26,13 +25,13 @@
*
* @see Sample code and further information
*/
-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 font
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 true
when passed to
+ * Returns an integer hash code for the receiver. Any two
+ * objects that return true
when passed to
* equals
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 @@
*
* 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 . - * + * *
* 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.
@@ -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
Note: The Control provided as the editor must 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. * *
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 @@ * } * }); * -* +* * @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 @@ * *
Note: The Control provided as the editor must 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 @@ *
* 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.
@@ -77,7 +79,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.
@@ -110,7 +112,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.
@@ -142,7 +144,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.
@@ -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
* 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. *
* * @return the receiver's items @@ -500,7 +502,7 @@ /** * Gets the index of the specified item. - * + * *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
* Note: Only one of the styles SINGLE, and MULTI may be specified. *
- * + * * @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 @@ *
* 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.
@@ -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.
- *
+ *
*
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 @@ *
* - * @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. *
* - * @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 @@ *
* 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 . - * + * *
SWT
style constants. The class description lists the style constants that are
* applicable to the class. Style bits are also inherited from superclasses.
*
- *
+ *
* @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 SWT.CHECK
.
* widgetDefaultSelected
is typically called when an item is double-clicked.
*
- *
+ *
* @param listener the listener which should be notified
- *
+ *
* @exception IllegalArgumentException null
if none
- *
+ *
* @exception SWTException Note: The Control provided as the editor must 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 @@ * *
Note: The Control provided as the editor must 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. *
@@ -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 @@ *
* 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.
@@ -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
@@ -69,80 +69,80 @@ *
*/ 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 usinggetData(String)
. 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 getData(String)
. When a drop target
+ * is created for a control, it is stored as a property in the control
* using setData(String, Object)
.
- *
+ *
* @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 getData(String)
. 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 getData(String)
. When a drag source
+ * is created for a control, it is stored as a property in the control
* using setData(String, Object)
.
- *
+ *
* @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 DragSourceListener
interface.
- *
+ *
* Classes that wish to deal with DragSourceEvent
s can
* extend this class and override only the methods which they are
* interested in.
dragStart
permits the drag operation to start.
* For additional information see DragSourceListener.dragStart
.
- *
+ *
* @param event the information associated with the drag start event
*/
+@Override
public void dragStart(DragSourceEvent event){}
/**
* This implementation of dragFinished
does nothing.
* For additional information see DragSourceListener.dragFinished
.
- *
+ *
* @param event the information associated with the drag finished event
*/
+@Override
public void dragFinished(DragSourceEvent event){}
/**
* This implementation of dragSetData
does nothing.
* For additional information see DragSourceListener.dragSetData
.
- *
+ *
* @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.
- *
- * The drag source effect has the same API as the
- * DragSourceAdapter
so that it can provide custom visual
- * feedback when a DragSourceEvent
occurs.
+ * does not provide any visual feedback.
+ *
+ *
The drag source effect has the same API as the
+ * DragSourceAdapter
so that it can provide custom visual
+ * feedback when a DragSourceEvent
occurs.
*
Classes that wish to provide their own drag source effect such as
- * displaying a default source image during a drag can extend the DragSourceEffect
- * class, override the DragSourceAdapter.dragStart
method and set
+ * displaying a default source image during a drag can extend the DragSourceEffect
+ * class, override the DragSourceAdapter.dragStart
method and set
* the field DragSourceEvent.image
with their own image.
* The image should be disposed when DragSourceAdapter.dragFinished
is called.
- *
DragSourceEffect
to handle drag effect from the specified Control
.
*
* @param control the Control
that the user clicks on to initiate the drag
- *
+ *
* @exception IllegalArgumentException 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.
*In dragSetData:
- *This will be set to true when the call to dragSetData is made. Set it to + *
This will be set to true when the call to dragSetData is made. Set it to * false to cancel the drag.
*In dragFinished:
- *Flag to indicate if the operation was performed successfully. + *
Flag to indicate if the operation was performed successfully. * True if the operation was performed successfully.
*/ 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. *A value of null indicates that no drag image will be displayed.
*The default value is null.
- * + * * @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 implementingdragSetData
. In the dragSetData, the application
* must support all the data types that were specified in the DragSource#setTransfer method.
*
- * After the drop has completed successfully or has been aborted, the application which defines the
- * DragSource
is required to take the appropriate cleanup action. In the case of a successful
+ *
After the drop has completed successfully or has been aborted, the application which defines the
+ * DragSource
is required to take the appropriate cleanup action. In the case of a successful
* move operation, the application must remove the data that was transferred.
The following fields in the DragSourceEvent apply: @@ -38,7 +38,7 @@ *
The following fields in the DragSourceEvent apply: @@ -74,7 +74,7 @@ *
The drop target effect has the same API as the
- * DropTargetAdapter
so that it can provide custom visual
- * feedback when a DropTargetEvent
occurs.
+ *
+ *
The drop target effect has the same API as the
+ * DropTargetAdapter
so that it can provide custom visual
+ * feedback when a DropTargetEvent
occurs.
*
Classes that wish to provide their own drag under effect
- * can extend the DropTargetEffect
and override any applicable methods
+ * can extend the DropTargetEffect
and override any applicable methods
* in DropTargetAdapter
to display their own drag under effect.
The feedback value is either one of the FEEDBACK constants defined in
- * class DND
which is applicable to instances of this class,
- * or it must be built by bitwise OR'ing together
+ *
The feedback value is either one of the FEEDBACK constants defined in
+ * class DND
which is applicable to instances of this class,
+ * or it must be built by bitwise OR'ing together
* (that is, using the int
"|" operator) two or more
- * of those DND
effect constants.
+ * of those DND
effect constants.
*
*
DropTargetEffect
to handle the drag under effect on the specified
+ * Creates a new DropTargetEffect
to handle the drag under effect on the specified
* Control
.
- *
+ *
* @param control the Control
over which the user positions the cursor to drop the data
- *
+ *
* @exception IllegalArgumentException Display
*/
public int x;
-
+
/**
* The y-cordinate of the cursor relative to the Display
*/
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 DropTargetListener
class provides event notification to the application
+ * The DropTargetListener
class provides event notification to the application
* for DropTarget events.
*
- * 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 + *
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.
* - *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 + *
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.
- * + * * @see DropTargetEvent * */ public interface DropTargetListener extends SWTEventListener { - + /** * The cursor has entered the drop target boundaries. * @@ -51,34 +51,34 @@ *The operations
value is determined by the modifier keys pressed by the user.
- * If no keys are pressed the event.detail
field is set to DND.DROP_DEFAULT.
- * If the application does not set the event.detail
to something other
- * than DND.DROP_DEFAULT
the operation will be set to the platform defined standard
+ *
The operations
value is determined by the modifier keys pressed by the user.
+ * If no keys are pressed the event.detail
field is set to DND.DROP_DEFAULT.
+ * If the application does not set the event.detail
to something other
+ * than DND.DROP_DEFAULT
the operation will be set to the platform defined standard
* default.
The currentDataType
is determined by the first transfer agent specified in
+ *
+ *
The currentDataType
is determined by the first transfer agent specified in
* setTransfer() that matches a data type provided by the drag source.
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.
- * - *The application can change the operation that will be performed by modifying the
- * detail
field but the choice must be one of the values in the operations
+ *
+ *
The application can change the operation that will be performed by modifying the
+ * detail
field but the choice must be one of the values in the operations
* field or DND.DROP_NONE.
The application can also change the type of data being requested by
- * modifying the currentDataTypes
field but the value must be one of the values
+ *
+ *
The application can also change the type of data being requested by
+ * modifying the currentDataTypes
field but the value must be one of the values
* in the dataTypes
list.
The following fields in the DropTargetEvent apply: @@ -116,24 +116,24 @@ *
The operations
value is determined by the modifier keys pressed by the user.
- * If no keys are pressed the event.detail
field is set to DND.DROP_DEFAULT.
- * If the application does not set the event.detail
to something other than
+ *
The operations
value is determined by the modifier keys pressed by the user.
+ * If no keys are pressed the event.detail
field is set to DND.DROP_DEFAULT.
+ * If the application does not set the event.detail
to something other than
* DND.DROP_DEFAULT
the operation will be set to the platform defined standard default.
The currentDataType
value is determined by the value assigned to
+ *
+ *
The currentDataType
value is determined by the value assigned to
* currentDataType
in previous dragEnter and dragOver calls.
The application can change the operation that will be performed by modifying the
- * detail
field but the choice must be one of the values in the operations
+ *
+ *
The application can change the operation that will be performed by modifying the
+ * detail
field but the choice must be one of the values in the operations
* field.
The application can also change the type of data being requested by modifying
- * the currentDataTypes
field but the value must be one of the values in the
+ *
+ *
The application can also change the type of data being requested by modifying
+ * the currentDataTypes
field but the value must be one of the values in the
* dataTypes
list.
The operations
value is determined by the value assigned to
+ *
The operations
value is determined by the value assigned to
* currentDataType
in previous dragEnter and dragOver calls.
The currentDataType
value is determined by the value assigned to
+ *
+ *
The currentDataType
value is determined by the value assigned to
* currentDataType
in previous dragEnter and dragOver calls.
The application can change the operation that will be performed by modifying the
- * detail
field but the choice must be one of the values in the operations
+ *
+ *
The application can change the operation that will be performed by modifying the
+ * detail
field but the choice must be one of the values in the operations
* field.
The application can also change the type of data being requested by modifying the
- * currentDataTypes
field but the value must be one of the values in the
+ *
+ *
The application can also change the type of data being requested by modifying the
+ * currentDataTypes
field but the value must be one of the values in the
* dataTypes
list.
NOTE: At this point the data
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
+ *
+ *
NOTE: At this point the data
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:
* public void dragOver(DropTargetEvent event) {
* TextTransfer textTransfer = TextTransfer.getInstance();
@@ -184,40 +184,40 @@
*
*
* @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.
*
* The following fields in DropTargetEvent apply: *
The application can refuse to perform the drop operation by setting the detail + *
The application can refuse to perform the drop operation by setting the detail * field to DND.DROP_NONE.
* * @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. - * + * *The following fields in the DropTargetEvent apply: *
The application can veto the drop by setting the event.detail
field to
+ *
The application can veto the drop by setting the event.detail
field to
* DND.DROP_NONE
.
The application can change the operation that will be performed by modifying the
- * detail
field but the choice must be one of the values in the
+ *
The application can change the operation that will be performed by modifying the
+ * detail
field but the choice must be one of the values in the
* operations
field.
The application can also change the type of data being requested by modifying the + * + *
The application can also change the type of data being requested by modifying the
* currentDataTypes
field but the value must be one of the values in the <
* code>dataTypes list.
* 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 Sample code and further information - * + * * @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 @@ *
* * @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 Sample code and further information - * + * * @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 Sample code and further information - * + * * @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 @@ * *
* After creating an instance of a class that implements
- * this interface it can be added to a ExpandBar
+ * this interface it can be added to a ExpandBar
* control using the addExpandListener
method and
- * removed using the removeExpandListener
method.
+ * removed using the removeExpandListener
method.
* When a item of the ExpandBar
is expanded or
* collapsed, the appropriate method will be invoked.
*
GestureEvent
fields that contain valid data.
*/
public int detail;
@@ -52,7 +52,7 @@
* The meaning of this field is dependent on the value of the detail
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 detail
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 @@
*
* If detail
is GESTURE_SWIPE
then a positive value indicates a swipe
* to the right and a negative value indicates a swipe to the left.
- *
+ *
* If detail
is GESTURE_PAN
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 GESTURE_PAN
. Both xDirection
and yDirection
* can be valid for an individual gesture. The meaning of this field is dependent on the value
* of the detail
field.
- *
+ *
* If detail
is GESTURE_SWIPE
then a positive value indicates a downward
* swipe and a negative value indicates an upward swipe.
- *
+ *
* If detail
is GESTURE_PAN
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 removeGestureListener
method. When a
* gesture is triggered, the appropriate method will be invoked.
*
+ * Warning: This API is currently only implemented on Windows and Cocoa. + * SWT doesn't send Gesture or Touch events on GTK. + *
* * @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 classSWT
.
@@ -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.
*
- *
+ *
* @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 false
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 false
will cancel the operation.
@@ -49,19 +49,19 @@
* MENU_MOUSE
),
* or by a focus-based device such as a keyboard (MENU_KEYBOARD
).
* If the trigger was MENU_KEYBOARD
, 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 MouseListener
interface.
*
- * Classes that wish to deal with MouseEvent
s
+ * Classes that wish to deal with MouseEvent
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.
*
* Note: The button
field is an integer that
@@ -31,7 +31,7 @@
*/
public class MouseEvent extends TypedEvent {
-
+
/**
* the button that was pressed or released;
*
* 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 @@ *
* 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" *- * + * *
* 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: *
lineText
relative to text (always zero for single line widget)
+ /**
+ * The start offset of the lineText
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.
* * The following event fields are used:
Sash
ScrollBar and Slider
+ * Note: 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. + *
+ * + * @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 tofalse
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 false
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 Sample code and further information
- *
+ *
* @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 touch
method
* will be invoked.
*
+ * + * Warning: This API is currently only implemented on Windows and Cocoa. + * SWT doesn't send Gesture or Touch events on GTK. + *
* * @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. * - * + * * @see TraverseListener * @see Sample code and further information */ public final class TraverseEvent extends KeyEvent { - + /** * The traversal type. *TRAVERSE_NONE
* causes no traversal action to be taken.
- *
+ *
* When used in conjunction with the doit
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 Sample code and further information
*/
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 RGB
or RGBA
.
+ * 0 to 255 or provide an instance of an RGB
or RGBA
.
*
* Application code must explicitly invoke the Color.dispose()
* 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.
*
- * You must dispose the color when it is no longer required. + * You must dispose the color when it is no longer required. *
* * @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 *RGBA
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.
* - * You must dispose the color when it is no longer required. + * You must dispose the color when it is no longer required. *
* * @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 *RGB
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.
* - * You must dispose the color when it is no longer required. + * You must dispose the color when it is no longer required. *
* * @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. ** IMPORTANT: This method is not 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. *
* IMPORTANT: This field is not 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. *
@@ -29,7 +29,7 @@ * This field is platform dependent. ** IMPORTANT: This field is not 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. *
@@ -42,7 +42,7 @@ * This field is platform dependent. ** IMPORTANT: This field is not 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. *
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) *@@ -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. *
- * + * * @see Device * @see Image * @see GC */ public interface Drawable { -/** +/** * Invokes platform specific functionality to allocate a new GC handle. ** IMPORTANT: This method is not part of the public @@ -39,15 +39,15 @@ * application code. *
* - * @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. ** IMPORTANT: This method is not part of the public @@ -58,8 +58,8 @@ *
* * @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
+ * IMPORTANT: This method is not part of the public
+ * API for FontMetrics
. 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.
+ *
GC
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 @@
*
* Application code does not need to explicitly release the
* resources managed by each instance when those instances are no longer
* required, and thus no dispose()
method is provided.
*
true
when passed to
+ * Returns an integer hash code for the receiver. Any two
+ * objects that return true
when passed to
* equals
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
* Image
.
*
- * Note that the public fields x
, y
,
+ * Note that the public fields x
, y
,
* disposalMethod
and delayTime
are
* typically only used when the image is in a set of images used
* for animation.
@@ -34,8 +35,8 @@
* @see Sample code and further information
*/
-public final class ImageData implements CloneableCompatibility {
-
+public final class ImageData implements Cloneable {
+
/**
* The width of the image, in pixels.
*/
@@ -121,7 +122,7 @@
*
@@ -132,7 +133,7 @@ *
*/ public byte[] alphaData; - + /** * The global alpha value to be used for every pixel. *@@ -148,7 +149,7 @@ /** * The type of file from which the image was read. - * + * * It is expressed as one of the following values: *
IMAGE_BMP
DM_UNSPECIFIED
* 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
* ImageLoader.load()
.
*
* This constructor may be used to load a resource as follows: @@ -358,7 +359,7 @@ *
* 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
* ImageLoader.load()
.
*
@@ -505,7 +506,7 @@ *
* This method is for internal use, and is not described further. *
- * + * * @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. * - * + * * @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. * - * + * * @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. * - * + * * @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. * - * + * * @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 * returnnull
. For zoom == 100
, returning
* null
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 null
. For zoom == 100
, returning
* null
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 ImageData
based on the receiver
+ * Returns an ImageData
based on the receiver.
* Modifications made to this ImageData
will not
* affect the Image.
*
- * @return an ImageData
containing the image's data and attributes
+ * @return an ImageData
containing the image's data and
+ * attributes at 100% zoom level.
*
* @exception SWTException ImageData
based on the receiver.
+ * Modifications made to this ImageData
will not
+ * affect the Image.
+ *
+ * @return an ImageData
containing the image's data
+ * and attributes at the current zoom level.
+ *
+ * @exception SWTException ImageData
for specified zoom, based on the receiver
+ * Modifications made to this ImageData
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 ImageData
containing the image's data and
+ * attributes at specified zoom if present else null is returned.
+ *
+ * @exception SWTException * IMPORTANT: This method is not 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 @@ * Notes: *
endOfImage
flag in the event will be set to true
* after each individual image is loaded.endOfImage
flag is false, then this is a
* partially complete copy of the current ImageData
,
@@ -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 Sample code and further information
*/
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.
* - * 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. *
- * 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. *
- * + * * @since 3.8 */ public int compression; - + /* * the set of ImageLoader event listeners, created on demand */ - Vector
* 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
* imageDataLoaded
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
true
if the receiver has image loader
* listeners, and false
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.
*
* 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 dispose()
method is provided.
*
true
when passed to
+ * Returns an integer hash code for the receiver. Any two
+ * objects that return true
when passed to
* equals
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
- * Application code must explicitly invoke the Path.dispose()
+ * Application code must explicitly invoke the Path.dispose()
* method to release the operating system resources managed by each instance
* when those instances are no longer required.
*
* You must dispose the path when it is no longer required. *
- * + * * @param device the device on which to allocate the path - * + * * @exception IllegalArgumentException* You must dispose the path when it is no longer required. *
- * + * * @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* You must dispose the path when it is no longer required. *
- * + * * @param device the device on which to allocate the path * @param data the data for the path - * + * * @exception IllegalArgumentException
- * The resulting arc begins at startAngle
and extends
+ * The resulting arc begins at startAngle
and extends
* for arcAngle
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.
*
- * The center of the arc is the center of the rectangle whose origin
- * is (x
, y
) and whose size is specified by the
- * width
and height
arguments.
+ * The center of the arc is the center of the rectangle whose origin
+ * is (x
, y
) and whose size is specified by the
+ * width
and height
arguments.
*
* The resulting arc covers an area width + 1
pixels wide
* by height + 1
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
- * Application code must explicitly invoke the Pattern.dispose()
+ * Application code must explicitly invoke the Pattern.dispose()
* method to release the operating system resources managed by each instance
* when those instances are no longer required.
*
* You must dispose the pattern when it is no longer required. *
- * + * * @param device the device on which to allocate the pattern * @param image the image that the pattern will draw - * + * * @exception IllegalArgumentException* You must dispose the pattern when it is no longer required. *
- * + * * @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* You must dispose the pattern when it is no longer required. *
- * + * * @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
* Application code does not need to explicitly release the
@@ -38,20 +38,20 @@
* @see Sample code and further information
*/
-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 true
when passed to
+ * Returns an integer hash code for the receiver. Any two
+ * objects that return true
when passed to
* equals
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.
*
* Application code does not need to explicitly release the
@@ -41,32 +42,32 @@
* @see Sample code and further information
*/
-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 true
when passed to
+ * Returns an integer hash code for the receiver. Any two
+ * objects that return true
when passed to
* equals
must return the same value for this
* method.
*
@@ -183,7 +184,7 @@
* @exception IllegalArgumentException
* 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 true
if the receiver does not cover any
* area in the (x, y) coordinate plane, and false
if
* the receiver does cover some area in the plane.
*
- * A rectangle is considered to cover area in the - * (x, y) coordinate plane if both its width and height are + * A rectangle is considered to cover area in the + * (x, y) coordinate plane if both its width and height are * non-zero. *
* 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 @@ ** You must dispose the region when it is no longer required. *
- * + * * @exception SWTError
* IMPORTANT: This class is intended to be subclassed only
@@ -32,11 +32,11 @@
* @see #dispose
* @see #isDisposed
* @see Sample code and further information
- *
+ *
* @since 3.1
*/
public abstract class Resource {
-
+
/**
* the device where this resource was created
*/
@@ -73,7 +73,7 @@
* created.
*
* @return Device
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.
*
* Application code does not need to explicitly release the @@ -39,19 +40,19 @@ * @see Sample code and further information * @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 *
true
when passed to
+ * Returns an integer hash code for the receiver. Any two
+ * objects that return true
when passed to
* equals
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.
*
* * Application code does not need to explicitly release the @@ -38,25 +39,25 @@ * @see Sample code and further information */ -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 @@ *
true
when passed to
+ * Returns an integer hash code for the receiver. Any two
+ * objects that return true
when passed to
* equals
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.*;
/**
* TextLayout
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 @@
* SWT.RIGHT_TO_LEFT
.
+ * of SWT.LEFT_TO_RIGHT
, SWT.RIGHT_TO_LEFT
+ * or SWT.AUTO_TEXT_DIRECTION
.
*
* * Warning: 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. *
*
* Application code does not need to explicitly release the
* resources managed by each instance when those instances are no longer
* required, and thus no dispose()
method is provided.
*
SWT.UNDERLINE_SINGLE
.
- *
- *
+ *
+ *
* @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
* underline
is false.
- * + *
* This value should be one of SWT.UNDERLINE_SINGLE
,
* SWT.UNDERLINE_DOUBLE
, SWT.UNDERLINE_ERROR
,
* SWT.UNDERLINE_SQUIGGLE
, or SWT.UNDERLINE_LINK
.
*
SWT.NONE
.
- * + *
* This value should be one of SWT.BORDER_SOLID
,
* SWT.BORDER_DASH
,SWT.BORDER_DOT
or
* SWT.NONE
.
*
GlyphMetrics
.
*
- *
+ *
* @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, null
if none
- * @param foreground the foreground color of the style, null
if none
+ * @param font the font of the style, null
if none
+ * @param foreground the foreground color of the style, null
if none
* @param background the background color of the style, null
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 true
when passed to
+ * Returns an integer hash code for the receiver. Any two
+ * objects that return true
when passed to
* equals
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.
*
- * Application code must explicitly invoke the Transform.dispose()
+ * Application code must explicitly invoke the Transform.dispose()
* method to release the operating system resources managed by each instance
* when those instances are no longer required.
*
@@ -55,11 +55,11 @@ * platforms. *
*- * You must dispose the transform when it is no longer required. + * You must dispose the transform when it is no longer required. *
- * + * * @param device the device on which to allocate the Transform - * + * * @exception IllegalArgumentException* This operation requires the operating system's advanced @@ -85,12 +85,12 @@ * platforms. *
*- * You must dispose the transform when it is no longer required. + * You must dispose the transform when it is no longer required. *
- * + * * @param device the device on which to allocate the Transform * @param elements an array of floats that describe the transformation matrix - * + * * @exception IllegalArgumentException* This operation requires the operating system's advanced @@ -117,9 +117,9 @@ * platforms. *
*- * You must dispose the transform when it is no longer required. + * You must dispose the transform when it is no longer required. *
- * + * * @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
* 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 Class
* 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 @@
*
* Note: This should not be called by application code. *
- * + * * @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. - *- * 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. - *
- *- * Note: java.lang.Cloneable is not part of CLDC. - *
- */ -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 @@ * ** 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. *
*- * IMPORTANT: the j2me version has an additional restriction on - * the argument. length must be between -32767 and 32767 (inclusive). - *
- * - * @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). - *- * IMPORTANT: the j2me version has an additional restriction on - * the argument. length must be between -32767 and 32767 (inclusive). - *
- * - * @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. ** 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). *
- * + * * @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 ornull
- * @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 null
- * @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.
- * - * The new process inherits the environment of the caller. - *
- * - * @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. *
@@ -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. - *
- * Note that this is not available on CLDC. - *
- */ -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. + *+ * The {@code autoScaleUp(..)} methods convert from API coordinates (in + * SWT points) to internal high DPI coordinates (in pixels) that interface with + * native widgets. + *
+ *+ * The {@code autoScaleDown(..)} convert from high DPI pixels to API coordinates + * (in SWT points). + *
+ * + * @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. + ** Note: This method gets called from the org.eclipse.e4.ui.swt.gtk fragment. *
- * + * * @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; jbuf
. 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 length
bytes from this LEDataInputStream and
+ * Reads at most length
bytes from this LEDataInputStream and
* stores them in byte array buffer
starting at offset
.
*
- * 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 count
.
*
b
.
*
- * 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 b
,
+ * 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 b
,
* an IOException will be thrown and no byte will be pushed back.
*
- * 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. - *
- *- * Note: java.io.Serializable is not part of CLDC. - *
- */ -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. ** 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. *
*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. *
* 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. *
*
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.*;
/**
- * FillLayout
is the simplest layout class. It lays out
- * controls in a single row or column, forcing them to be the same size.
+ * FillLayout
is the simplest layout class. It lays out
+ * controls in a single row or column, forcing them to be the same size.
*
- * Initially, the controls will all be as tall as the tallest control,
- * and as wide as the widest. FillLayout
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 Group
. FillLayout
can also be used
- * when a Composite
only has one child. For example,
- * if a Shell
has a single Group
child,
- * FillLayout
will cause the Group
to
+ * Initially, the controls will all be as tall as the tallest control,
+ * and as wide as the widest. FillLayout
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 Group
. FillLayout
can also be used
+ * when a Composite
only has one child. For example,
+ * if a Shell
has a single Group
child,
+ * FillLayout
will cause the Group
to
* completely fill the Shell
(if margins are 0).
*
* Example code: first a FillLayout
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
* Composite
. Note that in a FillLayout
,
* children are always the same size, and they fill all available space.
*
@@ -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 @@ *
FormLayout
.
+ * within a FormLayout
.
*
* FormAttachments
are set into the top, bottom, left,
* and right fields of the FormData
for a control.
@@ -31,10 +31,10 @@
*
* A FormAttachment
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:
*
@@ -50,8 +50,8 @@ * FormAttachment attach = new FormAttachment (button, 10); ** specifies that the side to which the
FormAttachment
- * object belongs will lie in the same position as the adjacent side of
- * the button
control, plus 10 pixels. The control side can
+ * object belongs will lie in the same position as the adjacent side of
+ * the button
control, plus 10 pixels. The control side can
* also be attached to the opposite side of the specified control.
* For example:
* @@ -59,8 +59,8 @@ * data.left = new FormAttachment (button, 0, SWT.LEFT); ** specifies that the left side of the control will lie in the same position - * as the left side of the
button
control. The control can also
- * be attached in a position that will center the control on the specified
+ * as the left side of the button
control. The control can also
+ * be attached in a position that will center the control on the specified
* control. For example:
* * data.left = new FormAttachment (button, 0, SWT.CENTER); @@ -69,11 +69,11 @@ * centered between the left and right sides of thebutton
control. * If the alignment is not specified, the default is to attach to the adjacent side. * - * + * * @see FormLayout * @see FormData * @see Sample code and further information - * + * * @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. *- * 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. *
- * + * *
Possible values are:
FormLayout
.
+ * Instances of this class are used to define the attachments
+ * of a control in a FormLayout
.
*
- * To set a FormData
object into a control, you use the
- * setLayoutData ()
method. To define attachments for the
+ * To set a FormData
object into a control, you use the
+ * setLayoutData ()
method. To define attachments for the
* FormData
, set the fields directly, like this:
*
* FormData data = new FormData(); @@ -30,23 +30,23 @@ ** *
- * FormData
contains the FormAttachments
for
+ * FormData
contains the FormAttachments
for
* each edge of the control that the FormLayout
uses to
* determine the size and position of the control. FormData
* objects also allow you to set the width and height of controls within
- * a FormLayout
.
+ * a FormLayout
.
*
FormAttachments
* to optionally configure the left, top, right and bottom edges of
* each child.
@@ -51,7 +51,7 @@
*
*
*
- * 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 Composite
by
* creating instances of FormAttachment
and setting them into
* the top, bottom, left, and right fields of the child's FormData
.
@@ -77,17 +77,17 @@
* button1
. This will over constrain the layout, causing undefined
* behavior. The algorithm will terminate, but the results are undefined.
*
GridData
is the layout data object associated with
- * GridLayout
. To set a GridData
object into a
- * control, you use the Control.setLayoutData(Object)
method.
+ * GridData
is the layout data object associated with
+ * GridLayout
. To set a GridData
object into a
+ * control, you use the Control.setLayoutData(Object)
method.
*
- * There are two ways to create a GridData
object with certain
+ * There are two ways to create a GridData
object with certain
* fields set. The first is to set the fields directly, like this:
*
* 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); *- * The second is to take advantage of
GridData
convenience constructors, for example:
+ * The second is to take advantage of GridData
convenience constructors, for example:
* * button1.setLayoutData(new GridData (SWT.FILL, SWT.CENTER, true, false)); * button2.setLayoutData(new GridData (SWT.FILL, SWT.FILL, true, true, 2, 1)); ** *
- * NOTE: Do not reuse GridData
objects. Every control in a
+ * NOTE: Do not reuse GridData
objects. Every control in a
* Composite
that is managed by a GridLayout
- * must have a unique GridData
object. If the layout data
- * for a control in a GridLayout
is null at layout time,
+ * must have a unique GridData
object. If the layout data
+ * for a control in a GridLayout
is null at layout time,
* a unique GridData
object is created for it.
*
grabExcessHorizontalSpace specifies whether the width of the cell - * changes depending on the size of the parent Composite. If + *
grabExcessHorizontalSpace specifies whether the width of the cell
+ * changes depending on the size of the parent Composite. If
* grabExcessHorizontalSpace is true
, the following rules
* apply to the width of the cell:
The default value is false.
- * + * * @see GridData#minimumWidth * @see GridData#widthHint - */ + */ public boolean grabExcessHorizontalSpace = false; - + /** - *grabExcessVerticalSpace specifies whether the height of the cell - * changes depending on the size of the parent Composite. If + *
grabExcessVerticalSpace specifies whether the height of the cell
+ * changes depending on the size of the parent Composite. If
* grabExcessVerticalSpace is true
, the following rules
* apply to the height of the cell:
The default value is false.
- * + * * @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 istrue
,
* the size and position of the control will not be managed by the
- * layout. If this value is false
, the size and
+ * layout. If this value is false
, the size and
* position of the control will be computed and assigned.
- *
+ *
* The default value is false
.
- *
+ *
* @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 new GridData(int)
.
* Position the control at the top of the cell.
- * Not recommended. Use
+ * Not recommended. Use
* new GridData(int, SWT.BEGINNING, boolean, boolean)
* instead.
*/
public static final int VERTICAL_ALIGN_BEGINNING = 1 << 1;
-
+
/**
- * Style bit for new GridData(int)
to position the
+ * Style bit for new GridData(int)
to position the
* control in the vertical center of the cell.
* Not recommended. Use
* new GridData(int, SWT.CENTER, boolean, boolean)
* instead.
*/
public static final int VERTICAL_ALIGN_CENTER = 1 << 2;
-
+
/**
- * Style bit for new GridData(int)
to position the
+ * Style bit for new GridData(int)
to position the
* control at the bottom of the cell.
* Not recommended. Use
* new GridData(int, SWT.END, boolean, boolean)
* instead.
*/
public static final int VERTICAL_ALIGN_END = 1 << 3;
-
+
/**
- * Style bit for new GridData(int)
to resize the
+ * Style bit for new GridData(int)
to resize the
* control to fill the cell vertically.
* Not recommended. Use
* new GridData(int, SWT.FILL, boolean, boolean)
* instead
*/
public static final int VERTICAL_ALIGN_FILL = 1 << 4;
-
+
/**
- * Style bit for new GridData(int)
to position the
+ * Style bit for new GridData(int)
to position the
* control at the left of the cell.
* Not recommended. Use
* new GridData(SWT.BEGINNING, int, boolean, boolean)
* instead.
*/
public static final int HORIZONTAL_ALIGN_BEGINNING = 1 << 5;
-
+
/**
- * Style bit for new GridData(int)
to position the
+ * Style bit for new GridData(int)
to position the
* control in the horizontal center of the cell.
* Not recommended. Use
* new GridData(SWT.CENTER, int, boolean, boolean)
* instead.
*/
public static final int HORIZONTAL_ALIGN_CENTER = 1 << 6;
-
+
/**
- * Style bit for new GridData(int)
to position the
+ * Style bit for new GridData(int)
to position the
* control at the right of the cell.
* Not recommended. Use
* new GridData(SWT.END, int, boolean, boolean)
* instead.
*/
public static final int HORIZONTAL_ALIGN_END = 1 << 7;
-
+
/**
- * Style bit for new GridData(int)
to resize the
+ * Style bit for new GridData(int)
to resize the
* control to fill the cell horizontally.
* Not recommended. Use
* new GridData(SWT.FILL, int, boolean, boolean)
* instead.
*/
public static final int HORIZONTAL_ALIGN_FILL = 1 << 8;
-
+
/**
- * Style bit for new GridData(int)
to resize the
+ * Style bit for new GridData(int)
to resize the
* control to fit the remaining horizontal space.
* Not recommended. Use
* new GridData(int, int, true, boolean)
* instead.
*/
public static final int GRAB_HORIZONTAL = 1 << 9;
-
+
/**
- * Style bit for new GridData(int)
to resize the
+ * Style bit for new GridData(int)
to resize the
* control to fit the remaining vertical space.
* Not recommended. Use
* new GridData(int, int, boolean, true)
* instead.
*/
public static final int GRAB_VERTICAL = 1 << 10;
-
+
/**
- * Style bit for new GridData(int)
to resize the
+ * Style bit for new GridData(int)
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
* new GridData(int, SWT.FILL, boolean, true)
* instead.
- */
+ */
public static final int FILL_VERTICAL = VERTICAL_ALIGN_FILL | GRAB_VERTICAL;
-
+
/**
- * Style bit for new GridData(int)
to resize the
+ * Style bit for new GridData(int)
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
* new GridData(SWT.FILL, int, true, boolean)
* instead.
- */
+ */
public static final int FILL_HORIZONTAL = HORIZONTAL_ALIGN_FILL | GRAB_HORIZONTAL;
-
+
/**
- * Style bit for new GridData(int)
to resize the
- * control to fill the cell horizontally and vertically and
+ * Style bit for new GridData(int)
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
* new GridData(SWT.FILL, SWT.FILL, true, true)
* 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
- * Composite
in a grid.
+ * Instances of this class lay out the control children of a
+ * Composite
in a grid.
*
- * GridLayout
has a number of configuration fields, and the
- * controls it lays out can have an associated layout data object, called
- * GridData
. The power of GridLayout
lies in the
- * ability to configure GridData
for each control in the layout.
+ * GridLayout
has a number of configuration fields, and the
+ * controls it lays out can have an associated layout data object, called
+ * GridData
. The power of GridLayout
lies in the
+ * ability to configure GridData
for each control in the layout.
*
* The following code creates a shell managed by a GridLayout
@@ -33,19 +33,19 @@
* gridLayout.numColumns = 3;
* shell.setLayout(gridLayout);
*
- * The numColumns
field is the most important field in a
- * GridLayout
. Widgets are laid out in columns from left
- * to right, and a new row is created when numColumns
+ 1
+ * The numColumns
field is the most important field in a
+ * GridLayout
. Widgets are laid out in columns from left
+ * to right, and a new row is created when numColumns
+ 1
* controls are added to the Composite
.
*
RowData
object
+ * Each control controlled by a RowLayout
can have its initial
+ * width and height specified by setting a RowData
object
* into the control.
*
* The following code uses a RowData
object to change the initial
@@ -29,14 +29,14 @@
* button1.setLayoutData(new RowData(50, 40));
*
*
true
,
* the size and position of the control will not be managed by the
- * layout. If this value is false
, the size and
+ * layout. If this value is false
, the size and
* position of the control will be computed and assigned.
- *
+ *
* The default value is false
.
- *
+ *
* @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 Composite
by placing them either in
- * horizontal rows or vertical columns within the parent Composite
.
+ * Instances of this class determine the size and position of the
+ * children of a Composite
by placing them either in
+ * horizontal rows or vertical columns within the parent Composite
.
*
* RowLayout
aligns all controls in one row if the
* type
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. RowLayout
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. RowLayout
has a number of configuration
+ * fields. In addition, the height and width of each control in a
* RowLayout
can be specified by setting a RowData
* object into the control using setLayoutData ()
.
*
- * The following example code creates a RowLayout
, sets all
- * of its fields to non-default values, and then sets it into a
- * Shell
.
+ * The following example code creates a RowLayout
, sets all
+ * of its fields to non-default values, and then sets it into a
+ * Shell
.
*
* RowLayout rowLayout = new RowLayout(); * rowLayout.wrap = false; @@ -49,45 +49,45 @@ * shell.setLayout(new RowLayout()); ** - * + * * @see RowData * @see RowLayout snippets * @see SWT Example: LayoutExample * @see Sample code and further information */ 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:
scope
field value indicating that
* all pages should be printed
- */
+ */
public static final int ALL_PAGES = 0;
-
+
/**
* scope
field value indicating that
* the range of pages specified by startPage and endPage
* should be printed
- */
+ */
public static final int PAGE_RANGE = 1;
-
+
/**
* scope
field value indicating that
* the current selection should be printed
- */
+ */
public static final int SELECTION = 2;
-
+
/**
* orientation
field value indicating
* portrait paper orientation
- *
+ *
* @since 3.5
*/
public static final int PORTRAIT = 1;
-
+
/**
* orientation
field value indicating
* landscape paper orientation
- *
+ *
* @since 3.5
*/
public static final int LANDSCAPE = 2;
-
+
/**
* duplex
field value indicating
* single-sided printing.
* * This is also known as simplex printing. *
- * + * * @since 3.7 */ public static final int DUPLEX_NONE = 0; - + /** *duplex
field value indicating
* double-sided printing for binding on the long edge.
@@ -192,11 +192,11 @@
* * This is also known as duplex printing. *
- * + * * @since 3.7 */ public static final int DUPLEX_LONG_EDGE = 1; - + /** *duplex
field value indicating
* double-sided printing for binding on the short edge.
@@ -206,11 +206,11 @@
* * This is also known as duplex tumble printing. *
- * + * * @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 thePrintDialog
.
* 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 Hashtablethrowable
field which holds the underlying
* throwable that caused the problem (if this information is
@@ -29,7 +27,7 @@
* still catch them.
* * 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. *
@@ -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. Specifyingnull
* 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 null
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.
*
* @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 throwable
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 null
* 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 null
as the message is
* equivalent to specifying an empty string.
@@ -98,7 +96,7 @@
* in order for inherited printStackTrace() methods to work.
*
* @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 Sample code and further information
*/
-
+
/* 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.
*
- *
+ *
* @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).
* * The IME composition event is sent to allow * custom text editors to implement in-line - * editing of international text. - *
- * + * editing of international text. + * + * * The detail field indicates the action to be taken: *
* On some platforms the orientation of text widgets
* can be changed by keyboard shortcut.
* The application can use the doit
field
* of the event to stop the change from happening.
- *
* The skin event is sent by the display when a widget needs to - * be skinned. + * be skinned. *
- * + * * @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). - * + * *- * 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. *
- * + * * @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). - * + * ** 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). - * + * *
* This event is sent when a gesture has been performed. *
- * + * * @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). - * + * ** This event is sent when text content has been changed. *
- * + * * @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). - * + * *Used By:
Composite
layoutUsed By:
Composite
layoutUsed By:
Text
Used By:
Text
@@ -1435,7 +1436,7 @@ *
Decorations
and subclassesUsed By:
Note that this is a HINT. + *
Used By:
Shell
Used By:
Scrollable
and subclassesTree
Table
Control
and subclasses@@ -1582,7 +1595,7 @@ *
Dialog
and subclassesShell
and subclassesUsed By:
Table
Tree
StyledText
TextLayout
TextLayout
Used By:
Used By:
Composite
Used By:
Composite
@@ -1767,13 +1780,13 @@ *
Used By:
Control
Menu
GC
GC
@@ -1787,41 +1800,41 @@ *
Used By:
Control
Menu
GC
GC
Used By:
Control
Menu
Used By:
Composite
Used By:
Table
Tree
Used By:
Control
@@ -1847,11 +1860,11 @@ *
@@ -1861,32 +1874,51 @@ *
Used By:
Control
+ * When the bit is set, text direction is derived from the direction of the + * first strong Bidi character. + *
+ *Used By:
Button
with ARROW
styleTracker
Table
Tree
Control
TextLayout
Used By:
Button
with ARROW
styleTracker
Table
Tree
Used By:
TextStyle
Used By:
TextStyle
Used By:
TextStyle
Used By:
TextStyle
@@ -1934,7 +1966,7 @@ *
Used By:
TextStyle
Used By:
TextStyle
Used By:
TextStyle
Used By:
TextStyle
Tracker
FormAttachment
in a FormLayout
- * 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. *
*/ @@ -2039,18 +2071,18 @@ *Tracker
FormAttachment
in a FormLayout
- * 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. *
*/ @@ -2105,7 +2137,7 @@ *Used By:
DateTime
Used By:
DateTime
Used By:
DateTime
Used By:
DateTime
Used By:
DateTime
Used By:
DateTime
Used By:
Browser
Used By:
Browser
Used By:
Used By:
char
with value 127).
*/
public static final char DEL = 0x7F;
-
+
/**
* ASCII character convenience constant for the escape character
* (value is the char
with value 27).
@@ -2289,33 +2321,33 @@
/**
* ASCII character convenience constant for the tab character
* (value is the char
'\t').
- *
+ *
* @since 2.1
*/
public static final char TAB = '\t';
-
+
/**
* ASCII character convenience constant for the space character
* (value is the char
' ').
- *
+ *
* @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.
- *
+ *
* (stateMask & SWT.MODIFIER_MASK) != 0
.
- *
+ *
* @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.
- *
+ *
* (stateMask & SWT.BUTTON_MASK) != 0
.
- *
+ *
* @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.
* * {@link #CTRL} on most platforms ({@link #COMMAND} on the Mac). *
- * + * * @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. ** {@link #SHIFT} on most platforms. *
- * + * * @since 2.1 */ public static final int MOD2; @@ -2437,7 +2469,7 @@ ** {@link #ALT} on most platforms. *
- * + * * @since 2.1 */ public static final int MOD3; @@ -2448,17 +2480,17 @@ ** Undefined on most platforms ({@link #CTRL} on the Mac). *
- * + * * @since 2.1 */ public static final int MOD4; - + /** * Constants to indicate line scrolling (value is 1). *Used By:
Control
Used By:
Control
((SWT.MOD1 | SWT.MOD2 | 'T') & SWT.KEYCODE_BIT) != 0
.
- *
+ *
* The following expression is true:
- *
+ *
* ((SWT.MOD3 | SWT.F2) & SWT.KEYCODE_BIT) != 0
.
- *
+ *
* (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 KEYCODE_BIT
* 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 MessageBox
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 Text
in combination with SWT.SEARCH
*
(value is 1<<9).
- * Used By:
Text
Text
in combination with SWT.SEARCH
*
(value is 1<<8).
- * Used By:
Text
MessageBox
style constant for an OK button;
@@ -2998,7 +3030,7 @@
* The MessageBox
style constant for a CANCEL button;
* valid combinations are OK|CANCEL, YES|NO|CANCEL, RETRY|CANCEL
* (value is 1<<8).
- *
+ *
* Used By:
MessageBox
Composite
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 Composite
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).
* @@ -3282,11 +3314,11 @@ * background on Windows only whereas {@link org.eclipse.swt.widgets.Table * Table} supports transparent background on GTK3 only.
Used By:
TextLayout
Used By:
TextLayout
checkSubclass()
method
* (value is 43).
- *
- * For additional information see the comment in
+ *
+ * For additional information see the comment in
* Widget.checkSubclass()
.
*
* @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 Image
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 Image
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).
* Used By:
ProgressBar
Used By:
ProgressBar
ProgressBar
@@ -3714,185 +3746,185 @@
*
*/
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).
- *
+ *
* Used By:
Composite
layout+ * 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)}. + *
+ * * @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. + *+ * 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)}. + *
+ * * @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$ - + /** * TheScrollable
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
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; ilayout(true)
+ * 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.
+ *
* This is equivalent to calling layout(true)
.
*
@@ -943,6 +973,13 @@ * children has changed state since the last layout. * If the receiver does not have a layout, do nothing. *
+ * 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. + *
+ *
* 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 layout(false)
).
*
+ * 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. + *
+ ** 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. *
+ * 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. + *
+ *
* 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
* The preferred size 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.
*
* The preferred size 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
+ * 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.
+ * x
and
* y
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.
* x
and
* y
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.
*
+ * 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. + *
* * @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. * + *+ * 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. + *
* - * @param size the new size for the receiver + * @param size the new size in points for the receiver * * @exception IllegalArgumentException+ * 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. + *
* - * @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+ * Warning: This API is currently only implemented on Windows and Cocoa. + * SWT doesn't send Gesture or Touch events on GTK. + *
* * @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. * + *+ * Warning: This API is currently only implemented on Windows and Cocoa. + * SWT doesn't send Gesture or Touch events on GTK. + *
* * @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 @@ *+ * The control will not be repositioned synchronously. This method is + * fast-running and only marks the control for future participation in + * a deferred layout. + *
+ * 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.
- * In CSS, values are typically integers between 0-255.
- * 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 SWT.LEFT_TO_RIGHT
,
- * SWT.RIGHT_TO_LEFT
, or a bitwise disjunction
- * SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT
. 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.
+ * SWT.RIGHT_TO_LEFT
, or SWT.AUTO_TEXT_DIRECTION
.
*
* setOrientation
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 @@
*
* IMPORTANT: This class is not intended to be subclassed. *
- * + * * @see CoolBar snippets * @see SWT Example: ControlExample * @see Sample code and further information @@ -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. *
* 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.
@@ -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 @@
*
* 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. *
* * @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 @@ ** 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. *
* * @return the current visual order of the receiver's items @@ -933,7 +934,7 @@ int index = 0; while (index* IMPORTANT: This class is not intended to be subclassed. *
- * + * * @see Sample code and further information * @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 aCoolBar
) and a style value
@@ -60,7 +60,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.
@@ -96,7 +96,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.
@@ -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 SWT.DEFAULT
is passed for the hint.
+ * To indicate that the caller does not wish to constrain a particular
+ * dimension, the constant SWT.DEFAULT
is passed for the hint.
*
SWT.DEFAULT
)
@@ -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 * 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
if the widget has auto text direction, + * andPRIMARY_MODAL
- * is not supported by a particular dialog, it would be upgraded to + * is not supported by a particular dialog, it would be upgraded to *APPLICATION_MODAL
. 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. * - * + * * @see Shell * @see SWT Example: ControlExample * @see Sample code and further information @@ -103,7 +103,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 theint
"|" operator) two or more * of thoseSWT
style constants. The class description * lists the style constants that are applicable to the class. @@ -118,7 +118,7 @@ * @exception SWTException*
- * + * * @see SWT#PRIMARY_MODAL * @see SWT#APPLICATION_MODAL * @see SWT#SYSTEM_MODAL @@ -218,7 +218,7 @@ *- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
** Note that, the value which is returned by this method may * not match the value which was provided to the constructor - * when the receiver was created. + * when the receiver was created. *
* * @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 - * title. If the text has not previously been set, + * title. 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 - * title, to the argument, which must not be null. + * title, 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 */ + ArrayListcolorList; + + /* 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 @@ * */ 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. * - * + * * @see Listener * @see org.eclipse.swt.events.TypedEvent * @see SWT Example: ControlExample, Listeners @@ -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 SWT
@@ -50,27 +51,27 @@ * @see org.eclipse.swt.SWT */ public int type; - + /** * the event specific detail field, as defined by the detail constants * in classSWT
- * + * * @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 classSWT
. @@ -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 *SWT.LEFT
,SWT.RIGHT
,SWT.KEYPAD
, * orSWT.NONE
representing the main keyboard area. *- * 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. *
- * + * * @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 @@ ** 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 theint
"|" operator) two or more * of thoseSWT
style constants. The class description * lists the style constants that are applicable to the class. @@ -72,7 +73,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 theint
"|" operator) two or more * of thoseSWT
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- *
* @exception SWTException- ERROR_INVALID_ARGUMENT - if the image has been disposed
+ *- ERROR_INVALID_ARGUMENT - if the image has been disposed
**
- * + * * @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 @@ * */ 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 @@ * */ 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- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
@@ -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. * - * + * * @param string the new text * * @exception IllegalArgumentException@@ -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 Sample code and further information */ @@ -28,8 +28,8 @@ * Computes and returns the size of the specified * composite's client area according to this layout. *
- * + * * @since 3.4 */ public TabItem getItem(Point point) { @@ -411,11 +491,11 @@ /** * Returns an array of- * 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 (
SWT.DEFAULT
for preferred size) * @param flushCachetrue
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 *control
. - * + * * @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+ *
+ * @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. + *- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ *- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ *+ * Note: This operation is a hint and may be overridden by the platform. + *
+ * @param color the new color (or null) + * + * @exception IllegalArgumentException+ *
+ * @exception SWTException- ERROR_INVALID_ARGUMENT - if the argument has been disposed
+ *+ *
+ * @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. *- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ *- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ ** 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
Listener
provide a simple - *handleEvent()
method that is used internally + * Implementers ofListener
provide a simple + *handleEvent()
method that is used internally * by SWT to dispatch events. ** 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 *
@@ -29,10 +29,10 @@ * providing the untyped listener API. Typically, widgets will * also provide a higher-level typed listener API, that is based * on the standardaddListener(int eventType, Listener handler)
method and - * removed using the - *removeListener (int eventType, Listener handler)
method. + * removed using the + *removeListener (int eventType, Listener handler)
method. * When the specified event occurs,handleEvent(...)
will * be sent to the instance. *java.util.EventListener
pattern. - * + * ** 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. *
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. * - * * @param string the new item * * @exception IllegalArgumentException@@ -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. *
* * @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 @@ *- * Note: This operation is a hint and is not supported on + * Note: This operation is a HINT 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. *
* - * @param image the image to display + * @param image the image to display on the receiver (may be null) * * @exception SWTException*
*/ 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 Monitor snippets * @see Sample code and further information - * + * * @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 same 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- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
@@ -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 @@ *true
when passed to + * Returns an integer hash code for the receiver. Any two + * objects that returntrue
when passed to *equals
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 toAPPLICATION_MODAL
. **
- Styles:
- *- BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE, ON_TOP, TOOL, SHEET
+ *- BORDER, CLOSE, MIN, MAX, NO_MOVE, NO_TRIM, RESIZE, TITLE, ON_TOP, TOOL, SHEET
*- APPLICATION_MODAL, MODELESS, PRIMARY_MODAL, SYSTEM_MODAL
*- Events:
*- Activate, Close, Deactivate, Deiconify, Iconify
@@ -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 @@ ** 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 theint
"|" operator) two or more * of thoseSWT
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 @@ *- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
*- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*TabItem
s which are the items - * in the receiver. + * in the receiver. ** 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. *
* * @return the items in the receiver @@ -440,7 +520,7 @@ ** 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. *
* @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= 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 @@ * - 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.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 @@ * */ 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 @@ * */ 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 @@ * */ 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. - * + * *- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
+ *- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
+ **
- * + * * @see Display#getSystemTaskBar * @see Sample code and further information - * + * * @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- Styles:
*- (none)
*- Events:
*- (none)
*TaskItem
for the givenShell
or theTaskItem
+ * Returns theTaskItem
for the givenShell
or theTaskItem
* for the application if theShell
parameter isnull
. * If the requested item is not supported by the platform it returnsnull
. - * + * * @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 ofTaskItem
s which are the items - * in the receiver. + * in the receiver. ** 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. *
* * @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* Styles: *(none) @@ -25,9 +25,9 @@ * * * @see Sample code and further information - * + * * @since 3.6 - * + * * @noextend This class is not intended to be subclassed by clients. */ public class TaskItem extends Item { @@ -47,7 +47,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 theint
"|" operator) two or more * of thoseSWT
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 @@ *ERROR_WIDGET_DISPOSED - if the receiver has been disposed *ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver * - * + * */ 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. - * + * ** 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 @@ *
* 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.
+ * in the native menu. * * @param menu the new pop up menu * * @exception IllegalArgumentException*
* @exception SWTException- ERROR_MENU_NOT_POP_UP - the menu is not a pop up menu
- *- ERROR_INVALID_ARGUMENT - if the menu has been disposed
+ *- ERROR_INVALID_ARGUMENT - if the menu has been disposed
**
- * + * * #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. * - * * @param string the new text * * @exception IllegalArgumentException- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
@@ -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. * *@@ -249,13 +249,13 @@ * *
* For better cross platform support, the application code should - * first try to set this feature on the
* * @param overlayImage the new overlay image (may be null) * * @exception IllegalArgumentExceptionTaskItem
for the + * first try to set this feature on theTaskItem
for the * main shell then on theTaskItem
for the application.- *
* @exception SWTException- ERROR_INVALID_ARGUMENT - if the overlayImage has been disposed
+ *- ERROR_INVALID_ARGUMENT - if the overlayImage has been disposed
**
- * - * The percentage of progress shown by the states- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
@@ -281,7 +281,7 @@ * ** For better cross platform support, the application code should - * first try to set this feature on the
* * @param overlayText the new overlay text @@ -310,8 +310,8 @@ *TaskItem
for the + * first try to set this feature on theTaskItem
for the * main shell then on theTaskItem
for the application.- {@link SWT#ERROR}
*- {@link SWT#INDETERMINATE}
*SWT#NORMAL
,SWT#PAUSED
, + * + * The percentage of progress shown by the statesSWT#NORMAL
,SWT#PAUSED
, *SWT#ERROR
is set withsetProgress()
.
* The stateSWT#DEFAULT
indicates that no progress should be shown. * @@ -323,16 +323,16 @@ * ** For better cross platform support, the application code should - * first try to set this feature on the
* - * @param progressState the new progress state + * @param progressState the new progress state * * @exception SWTExceptionTaskItem
for the + * first try to set this feature on theTaskItem
for the * main shell then on theTaskItem
for the application.*
- * + * * #see {@link #setProgress(int)} */ public void setProgressState (int progressState) { @@ -354,7 +354,7 @@ * *- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
*- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
** For better cross platform support, the application code should - * first try to set this feature on the
* * @param progress the new progress @@ -363,7 +363,7 @@ *TaskItem
for the + * first try to set this feature on theTaskItem
for the * main shell then on theTaskItem
for the application.- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
*- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*@@ -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
*/ public Rectangle getBounds () { + checkWidget (); + return DPIUtil.autoScaleDown (getBoundsInPixels ()); +} + +Rectangle getBoundsInPixels () { checkWidget(); parent.forceResize (); int /*long*/ topHandle = topHandle (); @@ -466,6 +458,11 @@ * */ 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 @@ * */ 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 Sample code and further information - * + * * @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= 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 @@ * TouchEvent
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. *- * When an instance is indirect (more precisely, not direct), the touch source is a track pad or + * When an instance is indirect (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 Sample code and further information - * + * * @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. - * + * * *
- Styles:
*- (none)
@@ -26,11 +26,11 @@ ** IMPORTANT: This class is not intended to be subclassed. *
- * + * * @see Display#getSystemTray * @see Tray, TrayItem snippets * @see Sample code and further information - * + * * @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 ofTrayItem
s which are the items - * in the receiver. + * in the receiver. ** 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. *
* * @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*/ 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 @@ * */ 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 @@ * */ 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 @@ * */ 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 internal SWT implementation - * 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. * * IMPORTANT: This class is not part of the SWT @@ -30,7 +30,7 @@ * @see Sample code and further information */ public class TypedListener implements Listener { - + /** * The receiver's event listener */ @@ -46,7 +46,7 @@ *
* * @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 @@ * * * @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. * * @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; itrue false
otherwise. + * + * @returntrue
when the widget has auto direction andfalse
otherwise + * + * @see SWT#AUTO_TEXT_DIRECTION + * + * @since 3.105 + */ +public boolean isAutoDirection () { + return false; +} + +/** * Returnstrue
if the widget has been disposed, * andfalse
otherwise. *@@ -1254,17 +1271,17 @@ *
* 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
*Display.setData(String, Object)
- * 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 unlessreskin(int)
is called on the widget or on an ancestor * while specifying theSWT.ALL
flag. ** The parameter
flags
may be either: *