Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Ufimtsev2015-07-07 14:16:01 -0400
committerLeo Ufimtsev2015-08-10 17:00:10 -0400
commit80fd1b61e5505220ee017b3bdf198512f5d401da (patch)
tree4e4e3f543cab4e555b99b0e7a070ae406d3a673b
parentffb9fd6ce8f944a56421e9ea16ab7709d5ef95f9 (diff)
downloadeclipse.platform.swt-80fd1b61e5505220ee017b3bdf198512f5d401da.tar.gz
eclipse.platform.swt-80fd1b61e5505220ee017b3bdf198512f5d401da.tar.xz
eclipse.platform.swt-80fd1b61e5505220ee017b3bdf198512f5d401da.zip
Bug 312568 (part 3) - [GTK] Editor does not get focus after double click
from Project/Package Explorer. Refactoring code to better match swt style. Tested, works as before. Change-Id: I87990a451a9cda562f1af07fc57be11965fe2ad2 Signed-off-by: Leo Ufimtsev <lufimtse@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java15
4 files changed, 12 insertions, 33 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
index de0b290d65..53bb002f1a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
@@ -837,18 +837,16 @@ void keyPressDefaultSelectionHandler (long /*int*/ event, int key) {
switch (key) {
case OS.GDK_Return:
//Send Default selection return only when no other modifier is pressed.
- if (!valueContainsFlag (keymask, new int [] {OS.GDK_MOD1_MASK, OS.GDK_SHIFT_MASK, OS.GDK_CONTROL_MASK,
- OS.GDK_SUPER_MASK, OS.GDK_META_MASK, OS.GDK_HYPER_MASK, }))
- {
+ 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 (!valueContainsFlag (keymask, new int [] {OS.GDK_MOD1_MASK, OS.GDK_CONTROL_MASK,
- OS.GDK_SUPER_MASK, OS.GDK_META_MASK, OS.GDK_HYPER_MASK, }))
- {
+ 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;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
index e6656b171c..e9aa9c6097 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
@@ -1919,18 +1919,16 @@ void keyPressDefaultSelectionHandler (long /*int*/ event, int key) {
switch (key) {
case OS.GDK_Return:
//Send Default selection return only when no other modifier is pressed.
- if (!valueContainsFlag (keymask, new int [] {OS.GDK_MOD1_MASK, OS.GDK_SHIFT_MASK, OS.GDK_CONTROL_MASK,
- OS.GDK_SUPER_MASK, OS.GDK_META_MASK, OS.GDK_HYPER_MASK, }))
- {
+ 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 (!valueContainsFlag (keymask, new int [] {OS.GDK_MOD1_MASK, OS.GDK_CONTROL_MASK,
- OS.GDK_SUPER_MASK, OS.GDK_META_MASK, OS.GDK_HYPER_MASK, }))
- {
+ 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;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
index 8794995394..62fbf3d090 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
@@ -1905,18 +1905,16 @@ void keyPressDefaultSelectionHandler (long /*int*/ event, int key) {
switch (key) {
case OS.GDK_Return:
//Send Default selection return only when no other modifier is pressed.
- if (!valueContainsFlag (keymask, new int [] {OS.GDK_MOD1_MASK, OS.GDK_SHIFT_MASK, OS.GDK_CONTROL_MASK,
- OS.GDK_SUPER_MASK, OS.GDK_META_MASK, OS.GDK_HYPER_MASK, }))
- {
+ 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 (!valueContainsFlag (keymask, new int [] {OS.GDK_MOD1_MASK, OS.GDK_CONTROL_MASK,
- OS.GDK_SUPER_MASK, OS.GDK_META_MASK, OS.GDK_HYPER_MASK, }))
- {
+ 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;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
index 7a2ef90feb..6288d4e137 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
@@ -2077,19 +2077,4 @@ void gtk_image_set_from_pixbuf (long /*int*/ imageHandle, long /*int*/ pixbuf){
}
}
-/**
- * Convienience method to check if one of the provided bit-flags is inside a value.
- * This is most useful for when you need to check against many flags.
- * @param value that you want
- * @param flags
- * @return
- */
-static boolean valueContainsFlag(long value, int flags[]) {
- for (int i = 0; i < flags.length; i++) {
- if ((value & flags[i]) != 0)
- return true;
- }
- return false;
-}
-
}

Back to the top