summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBogdan Gheorghe <gheorghe>2007-11-01 16:31:11 +0000
committerBogdan Gheorghe <gheorghe>2007-11-01 16:31:11 +0000
commit05cffc8dc400b90b624030aa360f968df9158b87 (patch)
treece0415560ef0b0a841887b444df06728971b6b86
parentfaaf962699fce0033b23b7367efc2b2325ceb06d (diff)
downloadeclipse.platform.swt-05cffc8dc400b90b624030aa360f968df9158b87.tar.gz
eclipse.platform.swt-05cffc8dc400b90b624030aa360f968df9158b87.tar.xz
eclipse.platform.swt-05cffc8dc400b90b624030aa360f968df9158b87.zip
208209 Combo immediately closes
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java62
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java3
4 files changed, 55 insertions, 20 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
index f394e26bfe..7a74974862 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
@@ -486,6 +486,14 @@ void createHandle (int index) {
entryHandle = combo.entry;
listHandle = combo.list;
+ if (OS.GTK_VERSION < OS.VERSION (2, 4, 0)) {
+ int /*long*/ parentHandle = 0;
+ int /*long*/ temp = listHandle;
+ while ((temp = OS.gtk_widget_get_parent(temp)) != 0) {
+ parentHandle = temp;
+ }
+ popupHandle = parentHandle;
+ }
/*
* Feature in GTK. There is no API to query the arrow
* handle from a combo box although it is possible to
@@ -584,6 +592,18 @@ int /*long*/ findPopupHandle (int /*long*/ oldList) {
return hdl;
}
+void fixModal (int /*long*/ group, int /*long*/ modalGroup) {
+ if (popupHandle != 0) {
+ if (group != 0) {
+ OS.gtk_window_group_add_window (group, popupHandle);
+ } else {
+ if (modalGroup != 0) {
+ OS.gtk_window_group_remove_window (modalGroup, popupHandle);
+ }
+ }
+ }
+}
+
void fixIM () {
/*
* The IM filter has to be called one time for each key press event.
@@ -1789,29 +1809,31 @@ void setOrientation() {
* @since 2.1.2
*/
public void setOrientation (int orientation) {
- checkWidget();
- int flags = SWT.RIGHT_TO_LEFT | SWT.LEFT_TO_RIGHT;
- if ((orientation & flags) == 0 || (orientation & flags) == flags) return;
- style &= ~flags;
- style |= orientation & flags;
- int dir = (orientation & SWT.RIGHT_TO_LEFT) != 0 ? OS.GTK_TEXT_DIR_RTL : OS.GTK_TEXT_DIR_LTR;
- OS.gtk_widget_set_direction (fixedHandle, dir);
- OS.gtk_widget_set_direction (handle, dir);
- if (entryHandle != 0) OS.gtk_widget_set_direction (entryHandle, dir);
- if (listHandle != 0) {
- OS.gtk_widget_set_direction (listHandle, dir);
- int /*long*/ itemsList = OS.gtk_container_get_children (listHandle);
- if (itemsList != 0) {
- int count = OS.g_list_length (itemsList);
- for (int i=count - 1; i>=0; i--) {
- int /*long*/ widget = OS.gtk_bin_get_child (OS.g_list_nth_data (itemsList, i));
- OS.gtk_widget_set_direction (widget, dir);
+ if (OS.GTK_VERSION >= OS.VERSION (2, 4, 0)) {
+ checkWidget();
+ int flags = SWT.RIGHT_TO_LEFT | SWT.LEFT_TO_RIGHT;
+ if ((orientation & flags) == 0 || (orientation & flags) == flags) return;
+ style &= ~flags;
+ style |= orientation & flags;
+ int dir = (orientation & SWT.RIGHT_TO_LEFT) != 0 ? OS.GTK_TEXT_DIR_RTL : OS.GTK_TEXT_DIR_LTR;
+ OS.gtk_widget_set_direction (fixedHandle, dir);
+ OS.gtk_widget_set_direction (handle, dir);
+ if (entryHandle != 0) OS.gtk_widget_set_direction (entryHandle, dir);
+ if (listHandle != 0) {
+ OS.gtk_widget_set_direction (listHandle, dir);
+ int /*long*/ itemsList = OS.gtk_container_get_children (listHandle);
+ if (itemsList != 0) {
+ int count = OS.g_list_length (itemsList);
+ for (int i=count - 1; i>=0; i--) {
+ int /*long*/ widget = OS.gtk_bin_get_child (OS.g_list_nth_data (itemsList, i));
+ OS.gtk_widget_set_direction (widget, dir);
+ }
+ OS.g_list_free (itemsList);
}
- OS.g_list_free (itemsList);
}
+ if (cellHandle != 0) OS.gtk_widget_set_direction (cellHandle, dir);
+ if (popupHandle != 0) OS.gtk_container_forall (popupHandle, display.setDirectionProc, dir);
}
- if (cellHandle != 0) OS.gtk_widget_set_direction (cellHandle, dir);
- if (popupHandle != 0) OS.gtk_container_forall (popupHandle, display.setDirectionProc, dir);
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
index 162123d9d6..0322a95f36 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
@@ -422,6 +422,13 @@ void fixChildren (Shell newShell, Shell oldShell, Decorations newDecorations, De
}
}
+void fixModal(int /*long*/ group, int /*long*/ modalGroup) {
+ Control[] controls = _getChildren ();
+ for (int i = 0; i < controls.length; i++) {
+ controls[i].fixModal (group, modalGroup);
+ }
+}
+
void fixStyle () {
super.fixStyle ();
if (scrolledHandle == 0) fixStyle (handle);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
index 773bb46569..9052a671b2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
@@ -2046,6 +2046,9 @@ int /*long*/ fixedMapProc (int /*long*/ widget) {
return 0;
}
+void fixModal(int /*long*/ group, int /*long*/ modalGroup) {
+}
+
/**
* Forces the receiver to have the <em>keyboard focus</em>, causing
* all keyboard events to be delivered to it.
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
index 4a35e47c56..da2d05ddb0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
@@ -1748,6 +1748,9 @@ void updateModal () {
OS.gtk_window_group_remove_window (modalGroup, shellHandle);
}
}
+ if (OS.GTK_VERSION < OS.VERSION (2, 4, 0)) {
+ fixModal (group, modalGroup);
+ }
modalGroup = group;
}