Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java17
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java20
5 files changed, 47 insertions, 24 deletions
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 bcb078f7d0..57c01858ab 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
@@ -1881,12 +1881,11 @@ int /*long*/ gtk_preedit_changed (int /*long*/ imcontext) {
}
int /*long*/ gtk_realize (int /*long*/ widget) {
- int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle());
- int /*long*/ imHandle = imHandle();
- if (imHandle != 0) OS.gtk_im_context_set_client_window (imHandle, window);
- if (cursor != null && cursor.isDisposed()) return 0;
- int /*long*/ gdkCursor = cursor != null ? cursor.handle : 0;
- OS.gdk_window_set_cursor (window, gdkCursor);
+ int /*long*/ imHandle = imHandle ();
+ if (imHandle != 0) {
+ int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle ());
+ OS.gtk_im_context_set_client_window (imHandle, window);
+ }
return 0;
}
@@ -2151,6 +2150,7 @@ public void redraw (int x, int y, int width, int height, boolean all) {
}
void redrawWidget (int x, int y, int width, int height, boolean all) {
+ if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) == 0) return;
int /*long*/ window = paintWindow ();
GdkRectangle rect = new GdkRectangle ();
rect.x = x;
@@ -2436,10 +2436,13 @@ public void setCursor (Cursor cursor) {
checkWidget();
if (cursor != null && cursor.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
this.cursor = cursor;
- int /*long*/ gdkCursor = cursor != null ? cursor.handle : 0;
- int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle ());
+ setCursor (cursor != null ? cursor.handle : 0);
+}
+
+void setCursor (int /*long*/ cursor) {
+ int /*long*/ window = paintWindow ();
if (window != 0) {
- OS.gdk_window_set_cursor (window, gdkCursor);
+ OS.gdk_window_set_cursor (window, cursor);
OS.gdk_flush ();
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
index 83983730ad..afc9a6e677 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
@@ -99,6 +99,7 @@ public class Display extends Device {
public int [] dispatchEvents;
/* Events Dispatching and Callback */
+ boolean wake;
int gdkEventCount;
int /*long*/ [] gdkEvents;
Widget [] gdkEventWidgets;
@@ -2782,7 +2783,8 @@ public boolean sleep () {
} catch (Exception e) {
return false;
}
- } while (true);
+ } while (!wake);
+ wake = false;
return true;
}
@@ -2983,6 +2985,7 @@ public void wake () {
}
void wakeThread () {
+ wake = true;
// NOT IMPLEMENTED - need to wake up the event loop
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
index 535c44c7c3..39c3abdbe3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
@@ -362,9 +362,7 @@ int /*long*/ gtk_motion_notify_event (int /*long*/ widget, int /*long*/ eventPtr
}
int /*long*/ gtk_realize (int /*long*/ widget) {
- int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle());
- int /*long*/ gdkCursor = cursor != null && !cursor.isDisposed() ? cursor.handle : defaultCursor;
- OS.gdk_window_set_cursor (window, gdkCursor);
+ setCursor (cursor != null ? cursor.handle : 0);
return 0;
}
@@ -404,15 +402,8 @@ public void removeSelectionListener(SelectionListener listener) {
eventTable.unhook (SWT.DefaultSelection,listener);
}
-public void setCursor (Cursor cursor) {
- checkWidget();
- if (cursor != null && cursor.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
- this.cursor = cursor;
- int /*long*/ gdkCursor = cursor != null ? cursor.handle : defaultCursor;
- int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle ());
- if (window != 0) {
- OS.gdk_window_set_cursor (window, gdkCursor);
- OS.gdk_flush ();
- }
+void setCursor (int /*long*/ cursor) {
+ super.setCursor (cursor != 0 ? cursor : defaultCursor);
}
+
}
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 8243cbcd5b..fd3fc68aef 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
@@ -944,6 +944,14 @@ boolean setBounds (int x, int y, int width, int height, boolean move, boolean re
return move || resize;
}
+void setCursor (int /*long*/ cursor) {
+ if (enableWindow != 0) {
+ OS.gdk_window_set_cursor (enableWindow, cursor);
+ OS.gdk_flush ();
+ }
+ super.setCursor (cursor);
+}
+
public void setEnabled (boolean enabled) {
checkWidget();
if (((state & DISABLED) == 0) == enabled) return;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
index a55b4fc84c..d9836d2507 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
@@ -977,6 +977,11 @@ int /*long*/ gtk_delete_text (int /*long*/ widget, int /*long*/ start_pos, int /
return 0;
}
+int /*long*/ gtk_event_after (int /*long*/ widget, int /*long*/ gdkEvent) {
+ if (cursor != null) setCursor (cursor.handle);
+ return super.gtk_event_after (widget, gdkEvent);
+}
+
int /*long*/ gtk_insert_text (int /*long*/ widget, int /*long*/ new_text, int /*long*/ new_text_length, int /*long*/ position) {
if (!hooks (SWT.Verify) && !filters (SWT.Verify)) return 0;
if ((style & SWT.SINGLE) != 0) {
@@ -1110,7 +1115,13 @@ public void insert (String string) {
}
int /*long*/ paintWindow () {
- if ((style & SWT.SINGLE) != 0) return super.paintWindow ();
+ if ((style & SWT.SINGLE) != 0) {
+ int /*long*/ window = super.paintWindow ();
+ int /*long*/ children = OS.gdk_window_get_children (window);
+ if (children != 0) window = OS.g_list_data (children);
+ OS.g_list_free (children);
+ return window;
+ }
OS.gtk_widget_realize (handle);
return OS.gtk_text_view_get_window (handle, OS.GTK_TEXT_WINDOW_TEXT);
}
@@ -1246,6 +1257,13 @@ void setBackgroundColor (GdkColor color) {
OS.gtk_widget_modify_base (handle, 0, color);
}
+void setCursor (int /*long*/ cursor) {
+ int /*long*/ defaultCursor = 0;
+ if (cursor == 0) defaultCursor = OS.gdk_cursor_new (OS.GDK_XTERM);
+ super.setCursor (cursor != 0 ? cursor : defaultCursor);
+ if (cursor == 0) OS.gdk_cursor_destroy (defaultCursor);
+}
+
/**
* Sets the double click enabled flag.
* <p>

Back to the top