summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse
diff options
context:
space:
mode:
authorSilenio Quarti <silenio>2004-05-25 20:19:03 +0000
committerSilenio Quarti <silenio>2004-05-25 20:19:03 +0000
commit613ef52a512ea94b5664ef2017085c02bc3c04da (patch)
treee3233fec6bedc419cf76eba2fed653a4f0893c9e /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse
parentee1541799783b7a2d49deac3fcb18abcfaa6358c (diff)
downloadeclipse.platform.swt-613ef52a512ea94b5664ef2017085c02bc3c04da.tar.gz
eclipse.platform.swt-613ef52a512ea94b5664ef2017085c02bc3c04da.tar.xz
eclipse.platform.swt-613ef52a512ea94b5664ef2017085c02bc3c04da.zip
17346
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java96
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java35
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java40
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java4
9 files changed, 125 insertions, 79 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 9c528ed054..5474bc1009 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
@@ -514,10 +514,6 @@ public void deselectAll () {
setItems (items, false, false);
}
-void enableWidget (boolean enabled) {
- OS.gtk_widget_set_sensitive (handle, enabled);
-}
-
GdkColor getBackgroundColor () {
return getBaseColor ();
}
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 729e6189c3..57aadfdccd 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
@@ -248,17 +248,8 @@ void deregister () {
}
void enableWidget (boolean enabled) {
- //NOT DONE - take into account current enabled scroll bar state
- if (scrolledHandle != 0) {
- if (horizontalBar != null) {
- int /*long*/ barHandle = OS.GTK_SCROLLED_WINDOW_HSCROLLBAR (scrolledHandle);
- OS.gtk_widget_set_sensitive (barHandle, enabled);
- }
- if (verticalBar != null) {
- int /*long*/ barHandle = OS.GTK_SCROLLED_WINDOW_VSCROLLBAR (scrolledHandle);
- OS.gtk_widget_set_sensitive (barHandle, enabled);
- }
- }
+ if ((state & CANVAS) != 0) return;
+ super.enableWidget (enabled);
}
Menu [] findMenus (Control control) {
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 9912234c1b..bcb078f7d0 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
@@ -38,7 +38,7 @@ import org.eclipse.swt.accessibility.*;
*/
public abstract class Control extends Widget implements Drawable {
int /*long*/ fixedHandle;
- int /*long*/ redrawWindow;
+ int /*long*/ redrawWindow, enableWindow;
int drawCount;
Composite parent;
Cursor cursor;
@@ -108,8 +108,7 @@ boolean drawGripper (int x, int y, int width, int height) {
}
void enableWidget (boolean enabled) {
- int /*long*/ topHandle = topHandle ();
- OS.gtk_widget_set_sensitive (topHandle, enabled);
+ OS.gtk_widget_set_sensitive (handle, enabled);
}
int /*long*/ eventHandle () {
@@ -487,7 +486,12 @@ boolean setBounds (int x, int y, int width, int height, boolean move, boolean re
int oldX = OS.GTK_WIDGET_X (topHandle);
int oldY = OS.GTK_WIDGET_Y (topHandle);
sameOrigin = x == oldX && y == oldY;
- if (!sameOrigin) moveHandle (x, y);
+ if (!sameOrigin) {
+ if (enableWindow != 0) {
+ OS.gdk_window_move (enableWindow, x, y);
+ }
+ moveHandle (x, y);
+ }
}
if (resize) {
width = Math.max (1, width);
@@ -499,6 +503,9 @@ boolean setBounds (int x, int y, int width, int height, boolean move, boolean re
if (redrawWindow != 0) {
OS.gdk_window_resize (redrawWindow, width, height);
}
+ if (enableWindow != 0) {
+ OS.gdk_window_resize (enableWindow, width, height);
+ }
resizeHandle (width, height);
}
}
@@ -2170,6 +2177,10 @@ void releaseWidget () {
OS.gtk_im_context_reset (imHandle);
OS.gtk_im_context_set_client_window (imHandle, 0);
}
+ if (enableWindow != 0) {
+ OS.gdk_window_destroy (enableWindow);
+ enableWindow = 0;
+ }
if (menu != null && !menu.isDisposed ()) {
menu.dispose ();
}
@@ -2456,6 +2467,44 @@ public void setEnabled (boolean enabled) {
state |= DISABLED;
}
enableWidget (enabled);
+ if (enabled) {
+ if (enableWindow != 0) {
+ OS.gdk_window_destroy (enableWindow);
+ enableWindow = 0;
+ }
+ } else {
+ OS.gtk_widget_realize (handle);
+ int /*long*/ parentHandle = parent.parentingHandle ();
+ int /*long*/ window = OS.GTK_WIDGET_WINDOW (parentHandle);
+ Rectangle rect = getBounds ();
+ GdkWindowAttr attributes = new GdkWindowAttr ();
+ attributes.x = rect.x;
+ attributes.y = rect.y;
+ attributes.width = rect.width;
+ attributes.height = rect.height;
+ attributes.event_mask = (0xFFFFFFFF & ~OS.ExposureMask);
+ attributes.wclass = OS.GDK_INPUT_ONLY;
+ attributes.window_type = OS.GDK_WINDOW_CHILD;
+ enableWindow = OS.gdk_window_new (window, attributes, OS.GDK_WA_X | OS.GDK_WA_Y);
+ if (enableWindow != 0) {
+ OS.gdk_window_set_user_data (enableWindow, parentHandle);
+ if (!OS.GDK_WINDOWING_X11 ()) {
+ OS.gdk_window_raise (enableWindow);
+ } else {
+ int /*long*/ topHandle = topHandle ();
+ int /*long*/ topWindow = OS.GTK_WIDGET_WINDOW (topHandle);
+ int /*long*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (topWindow);
+ int /*long*/ xWindow = OS.gdk_x11_drawable_get_xid (enableWindow);
+ int xScreen = OS.XDefaultScreen (xDisplay);
+ int flags = OS.CWStackMode | OS.CWSibling;
+ XWindowChanges changes = new XWindowChanges ();
+ changes.sibling = OS.gdk_x11_drawable_get_xid (topWindow);
+ changes.stack_mode = OS.Above;
+ OS.XReconfigureWMWindow (xDisplay, xWindow, xScreen, flags, changes);
+ }
+ OS.gdk_window_show (enableWindow);
+ }
+ }
if (fixFocus) fixFocus ();
}
@@ -2679,9 +2728,11 @@ public void setRedraw (boolean redraw) {
attributes.event_mask = OS.GDK_EXPOSURE_MASK;
attributes.window_type = OS.GDK_WINDOW_CHILD;
redrawWindow = OS.gdk_window_new (window, attributes, 0);
- OS.gdk_window_set_back_pixmap (redrawWindow, 0, false);
- OS.gdk_window_raise (redrawWindow);
- OS.gdk_window_show (redrawWindow);
+ if (redrawWindow != 0) {
+ OS.gdk_window_set_back_pixmap (redrawWindow, 0, false);
+ OS.gdk_window_raise (redrawWindow);
+ OS.gdk_window_show (redrawWindow);
+ }
}
}
}
@@ -2774,15 +2825,24 @@ void setZOrder (Control sibling, boolean above, boolean fixChildren) {
int /*long*/ siblingHandle = sibling != null ? sibling.topHandle () : 0;
int /*long*/ window = OS.GTK_WIDGET_WINDOW (topHandle);
if (window != 0) {
- int /*long*/ siblingWindow = sibling != null ? OS.GTK_WIDGET_WINDOW (siblingHandle) : 0;
+ int /*long*/ siblingWindow = 0;
+ if (sibling != null) {
+ if (above && sibling.enableWindow != 0) {
+ siblingWindow = enableWindow;
+ } else {
+ siblingWindow = OS.GTK_WIDGET_WINDOW (siblingHandle);
+ }
+ }
int /*long*/ redrawWindow = fixChildren ? parent.redrawWindow : 0;
if (!OS.GDK_WINDOWING_X11 () || (siblingWindow == 0 && redrawWindow == 0)) {
- if (above) {
- OS.gdk_window_raise (window);
- if (redrawWindow != 0) OS.gdk_window_raise (redrawWindow);
- } else {
- OS.gdk_window_lower (window);
- }
+ if (above) {
+ OS.gdk_window_raise (window);
+ if (redrawWindow != 0) OS.gdk_window_raise (redrawWindow);
+ if (enableWindow != 0) OS.gdk_window_raise (enableWindow);
+ } else {
+ if (enableWindow != 0) OS.gdk_window_lower (enableWindow);
+ OS.gdk_window_lower (window);
+ }
} else {
XWindowChanges changes = new XWindowChanges ();
changes.sibling = OS.gdk_x11_drawable_get_xid (siblingWindow != 0 ? siblingWindow : redrawWindow);
@@ -2801,7 +2861,13 @@ void setZOrder (Control sibling, boolean above, boolean fixChildren) {
* When the receiver is not a top level shell, XReconfigureWMWindow ()
* behaves the same as XConfigureWindow ().
*/
- OS.XReconfigureWMWindow (xDisplay, xWindow, xScreen, flags, changes);
+ OS.XReconfigureWMWindow (xDisplay, xWindow, xScreen, flags, changes);
+ if (enableWindow != 0) {
+ changes.sibling = OS.gdk_x11_drawable_get_xid (window);
+ changes.stack_mode = OS.Above;
+ xWindow = OS.gdk_x11_drawable_get_xid (enableWindow);
+ OS.XReconfigureWMWindow (xDisplay, xWindow, xScreen, flags, changes);
+ }
}
}
if (fixChildren) {
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 286b9e13fd..83983730ad 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
@@ -779,7 +779,6 @@ int /*long*/ eventProc (int /*long*/ event, int /*long*/ data) {
addGdkEvent (OS.gdk_event_copy (event));
return 0;
}
- boolean forward = false;
Control control = null;
int /*long*/ window = 0;
switch (gdkEvent.type) {
@@ -799,55 +798,25 @@ int /*long*/ eventProc (int /*long*/ event, int /*long*/ data) {
Widget widget = getWidget (handle);
if (widget != null && widget instanceof Control) {
control = (Control) widget;
- if (control.isEnabled ()) break;
- forward = true;
+ break;
}
}
} while ((window = OS.gdk_window_get_parent (window)) != 0);
}
}
Shell shell = null;
- GdkEventButton gdkEventButton = null;
- int /*long*/ oldWindow = 0;
- double oldX = 0, oldY = 0;
if (control != null ) {
- if (window == 0) return 0;
- if (forward) {
- switch (gdkEvent.type) {
- case OS.GDK_ENTER_NOTIFY:
- case OS.GDK_LEAVE_NOTIFY:
- return 0;
- }
- gdkEventButton = new GdkEventButton ();
- OS.memmove (gdkEventButton, event, GdkEventButton.sizeof);
- oldWindow = gdkEventButton.window;
- oldX = gdkEventButton.x;
- oldY = gdkEventButton.y;
- int /*long*/ eventHandle = control.eventHandle ();
- gdkEventButton.window = OS.GTK_WIDGET_WINDOW (eventHandle);
- int [] origin_x = new int [1], origin_y = new int [1];
- OS.gdk_window_get_origin (gdkEventButton.window, origin_x, origin_y);
- gdkEventButton.x = gdkEventButton.x_root - origin_x [0];
- gdkEventButton.y = gdkEventButton.y_root - origin_y [0];
- OS.memmove (event, gdkEventButton, GdkEventButton.sizeof);
- }
shell = control.getShell ();
if ((shell.style & SWT.ON_TOP) != 0) {
OS.gtk_grab_add (shell.shellHandle);
}
}
OS.gtk_main_do_event (event);
- if (dispatchEvents == null) putGdkEvents();
+ if (dispatchEvents == null) putGdkEvents ();
if (control != null ) {
if (shell != null && !shell.isDisposed () && (shell.style & SWT.ON_TOP) != 0) {
OS.gtk_grab_remove (shell.shellHandle);
}
- if (forward) {
- gdkEventButton.window = oldWindow;
- gdkEventButton.x = oldX;
- gdkEventButton.y = oldY;
- OS.memmove (event, gdkEventButton, GdkEventButton.sizeof);
- }
}
return 0;
}
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 e4929b7d55..8243cbcd5b 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
@@ -894,6 +894,9 @@ void resizeBounds (int width, int height, boolean notify) {
if (redrawWindow != 0) {
OS.gdk_window_resize (redrawWindow, width, height);
}
+ if (enableWindow != 0) {
+ OS.gdk_window_resize (enableWindow, width, height);
+ }
int border = OS.gtk_container_get_border_width (shellHandle);
int menuHeight = 0;
if (menuBar != null) {
@@ -941,6 +944,43 @@ boolean setBounds (int x, int y, int width, int height, boolean move, boolean re
return move || resize;
}
+public void setEnabled (boolean enabled) {
+ checkWidget();
+ if (((state & DISABLED) == 0) == enabled) return;
+ if (enabled) {
+ state &= ~DISABLED;
+ } else {
+ state |= DISABLED;
+ }
+ if (enabled) {
+ if (enableWindow != 0) {
+ OS.gdk_window_destroy (enableWindow);
+ enableWindow = 0;
+ }
+ } else {
+ int /*long*/ parentHandle = shellHandle;
+ OS.gtk_widget_realize (parentHandle);
+ int /*long*/ window = OS.GTK_WIDGET_WINDOW (parentHandle);
+ Rectangle rect = getBounds ();
+ GdkWindowAttr attributes = new GdkWindowAttr ();
+ attributes.width = rect.width;
+ attributes.height = rect.height;
+ attributes.event_mask = (0xFFFFFFFF & ~OS.ExposureMask);
+ attributes.wclass = OS.GDK_INPUT_ONLY;
+ attributes.window_type = OS.GDK_WINDOW_CHILD;
+ enableWindow = OS.gdk_window_new (window, attributes, 0);
+ if (enableWindow != 0) {
+ if (cursor != null) {
+ OS.gdk_window_set_cursor (enableWindow, cursor.handle);
+ OS.gdk_flush ();
+ }
+ OS.gdk_window_set_user_data (enableWindow, parentHandle);
+ OS.gdk_window_raise (enableWindow);
+ OS.gdk_window_show (enableWindow);
+ }
+ }
+}
+
/**
* Sets the input method editor mode to the argument which
* should be the result of bitwise OR'ing together one or more
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
index 3a155c5479..9332917851 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
@@ -304,10 +304,6 @@ void destroyItem (TabItem item) {
}
}
-void enableWidget (boolean enabled) {
- OS.gtk_widget_set_sensitive (handle, enabled);
-}
-
int /*long*/ eventHandle () {
return fixedHandle;
}
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 58790b34c3..25d8b3d375 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
@@ -837,10 +837,6 @@ void destroyItem (TableItem item) {
if (itemCount == 0) resetCustomDraw ();
}
-void enableWidget (boolean enabled) {
- OS.gtk_widget_set_sensitive (scrolledHandle, enabled);
-}
-
GdkColor getBackgroundColor () {
return getBaseColor ();
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
index 94c778dde9..fae37d117f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
@@ -149,10 +149,6 @@ void createHandle (int index) {
}
}
-void enableWidget (boolean enabled) {
- /* Do nothing - Tool bar items are individually enabled by the application */
-}
-
public Point computeSize (int wHint, int hHint, boolean changed) {
checkWidget ();
if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0;
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 082111c3e0..bfdec9f965 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
@@ -358,10 +358,6 @@ void destroyWidget () {
super.destroyWidget ();
}
-void enableWidget (boolean enabled) {
- OS.gtk_widget_set_sensitive (scrolledHandle, enabled);
-}
-
GdkColor getBackgroundColor () {
return getBaseColor ();
}