Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti2004-05-17 20:48:31 +0000
committerSilenio Quarti2004-05-17 20:48:31 +0000
commitf304fd949d33aeaf7168524a4af52e038b23993e (patch)
tree2c7fe200737b46a0efb204750084c5e5ad61f777
parent89eb385b1da972fcbe2914fa0139ceb359ab6ba8 (diff)
downloadeclipse.platform.swt-f304fd949d33aeaf7168524a4af52e038b23993e.tar.gz
eclipse.platform.swt-f304fd949d33aeaf7168524a4af52e038b23993e.tar.xz
eclipse.platform.swt-f304fd949d33aeaf7168524a4af52e038b23993e.zip
53791
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java36
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java33
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java55
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Shell.java6
4 files changed, 100 insertions, 30 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 4015922160..82a112aa07 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,6 +38,7 @@ import org.eclipse.swt.accessibility.*;
*/
public abstract class Control extends Widget implements Drawable {
int /*long*/ fixedHandle;
+ int /*long*/ redrawWindow;
int drawCount;
Composite parent;
Cursor cursor;
@@ -494,7 +495,12 @@ boolean setBounds (int x, int y, int width, int height, boolean move, boolean re
int oldWidth = OS.GTK_WIDGET_WIDTH (topHandle);
int oldHeight = OS.GTK_WIDGET_HEIGHT (topHandle);
sameExtent = width == oldWidth && height == oldHeight;
- if (!sameExtent) resizeHandle (width, height);
+ if (!sameExtent) {
+ if (redrawWindow != 0) {
+ OS.gdk_window_resize (redrawWindow, width, height);
+ }
+ resizeHandle (width, height);
+ }
}
if (!sameOrigin || !sameExtent) {
/*
@@ -2657,10 +2663,27 @@ public void setRedraw (boolean redraw) {
checkWidget();
if (redraw) {
if (--drawCount == 0) {
-// redrawWidget (handle, true);
+ if (redrawWindow != 0) {
+ OS.gdk_window_destroy (redrawWindow);
+ redrawWindow = 0;
+ }
}
} else {
- drawCount++;
+ if (drawCount++ == 0) {
+ if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) != 0) {
+ int /*long*/ window = paintWindow ();
+ Rectangle rect = getBounds ();
+ GdkWindowAttr attributes = new GdkWindowAttr ();
+ attributes.width = rect.width;
+ attributes.height = rect.height;
+ 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);
+ }
+ }
}
}
@@ -2752,16 +2775,19 @@ void setZOrder (Control sibling, boolean above, boolean fixChildren) {
int /*long*/ window = OS.GTK_WIDGET_WINDOW (topHandle);
if (window != 0) {
int /*long*/ siblingWindow = sibling != null ? OS.GTK_WIDGET_WINDOW (siblingHandle) : 0;
- if (!OS.GDK_WINDOWING_X11 () || siblingWindow == 0) {
+ 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);
}
} else {
XWindowChanges changes = new XWindowChanges ();
- changes.sibling = OS.gdk_x11_drawable_get_xid (siblingWindow);
+ changes.sibling = OS.gdk_x11_drawable_get_xid (siblingWindow != 0 ? siblingWindow : redrawWindow);
changes.stack_mode = above ? OS.Above : OS.Below;
+ if (redrawWindow != 0 && siblingWindow == 0) changes.stack_mode = OS.Below;
int /*long*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (window);
int /*long*/ xWindow = OS.gdk_x11_drawable_get_xid (window);
int xScreen = OS.XDefaultScreen (xDisplay);
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 39f76f0dc4..51f258ebcc 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
@@ -713,29 +713,23 @@ int /*long*/ gtk_focus (int /*long*/ widget, int /*long*/ directionType) {
}
int /*long*/ gtk_focus_in_event (int /*long*/ widget, int /*long*/ event) {
- int /*long*/ result = super.gtk_focus_in_event (widget, event);
- // widget could be disposed at this point
- if (handle == 0) return 0;
- if (widget == shellHandle) {
- if (tooltipsHandle != 0) OS.gtk_tooltips_enable (tooltipsHandle);
- hasFocus = true;
- sendEvent (SWT.Activate);
- return 0;
+ if (widget != shellHandle) {
+ return super.gtk_focus_in_event (widget, event);
}
- return result;
+ if (tooltipsHandle != 0) OS.gtk_tooltips_enable (tooltipsHandle);
+ hasFocus = true;
+ sendEvent (SWT.Activate);
+ return 0;
}
int /*long*/ gtk_focus_out_event (int /*long*/ widget, int /*long*/ event) {
- int /*long*/ result = super.gtk_focus_out_event (widget, event);
- // widget could be disposed at this point
- if (handle == 0) return 0;
- if (widget == shellHandle) {
- if (tooltipsHandle != 0) OS.gtk_tooltips_disable (tooltipsHandle);
- hasFocus = false;
- sendEvent (SWT.Deactivate);
- return 0;
+ if (widget != shellHandle) {
+ return super.gtk_focus_out_event (widget, event);
}
- return result;
+ if (tooltipsHandle != 0) OS.gtk_tooltips_disable (tooltipsHandle);
+ hasFocus = false;
+ sendEvent (SWT.Deactivate);
+ return 0;
}
int /*long*/ gtk_map_event (int /*long*/ widget, int /*long*/ event) {
@@ -897,6 +891,9 @@ void setActiveControl (Control control) {
}
void resizeBounds (int width, int height, boolean notify) {
+ if (redrawWindow != 0) {
+ OS.gdk_window_resize (redrawWindow, width, height);
+ }
int border = OS.gtk_container_get_border_width (shellHandle);
int menuHeight = 0;
if (menuBar != null) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java
index 67ee507247..06db2b8c9e 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java
@@ -37,6 +37,7 @@ import org.eclipse.swt.accessibility.*;
* </p>
*/
public abstract class Control extends Widget implements Drawable {
+ int drawCount, redrawWindow;
Composite parent;
Cursor cursor;
Menu menu;
@@ -1884,6 +1885,10 @@ boolean setBounds (int x, int y, int width, int height, boolean move, boolean re
boolean sameOrigin = (x == (short) argList [1]) && (y == (short) argList [3]);
boolean sameExtent = (width == argList [5]) && (height == argList [7]);
if (sameOrigin && sameExtent) return false;
+ if (redrawWindow != 0) {
+ int xDisplay = OS.XtDisplay (handle);
+ OS.XResizeWindow (xDisplay, redrawWindow, width, height);
+ }
OS.XtConfigureWidget (topHandle, x, y, width, height, argList [9]);
updateIM ();
if (!sameOrigin) sendEvent (SWT.Move);
@@ -1909,6 +1914,10 @@ boolean setBounds (int x, int y, int width, int height, boolean move, boolean re
width = Math.max (width - (argList [5] * 2), 1);
height = Math.max (height - (argList [5] * 2), 1);
if (width == argList [1] && height == argList [3]) return false;
+ if (redrawWindow != 0) {
+ int xDisplay = OS.XtDisplay (handle);
+ OS.XResizeWindow (xDisplay, redrawWindow, width, height);
+ }
OS.XtResizeWidget (topHandle, width, height, argList [5]);
updateIM ();
sendEvent (SWT.Resize);
@@ -2295,6 +2304,31 @@ boolean setRadioSelection (boolean value) {
*/
public void setRedraw (boolean redraw) {
checkWidget();
+ if (redraw) {
+ if (--drawCount == 0) {
+ if (redrawWindow != 0) {
+ int xDisplay = OS.XtDisplay(handle);
+ OS.XDestroyWindow(xDisplay, redrawWindow);
+ redrawWindow = 0;
+ }
+ }
+ } else {
+ if (drawCount++ == 0) {
+ int xDisplay = OS.XtDisplay (handle);
+ if (xDisplay == 0) return;
+ int xWindow = OS.XtWindow (handle);
+ if (xWindow == 0) return;
+ Rectangle rect = getBounds();
+ XSetWindowAttributes attributes = new XSetWindowAttributes ();
+ attributes.background_pixmap = OS.None;
+ attributes.event_mask = OS.ExposureMask;
+ int mask = OS.CWDontPropagate | OS.CWEventMask | OS.CWBackPixmap;
+ redrawWindow = OS.XCreateWindow (xDisplay, xWindow, 0, 0, rect.width, rect.height,
+ 0,OS.CopyFromParent, OS.CopyFromParent, OS.CopyFromParent, mask, attributes);
+ OS.XRaiseWindow (xDisplay, redrawWindow);
+ OS.XMapWindow (xDisplay, redrawWindow);
+ }
+ }
}
boolean setTabGroupFocus (boolean next) {
return setTabItemFocus (next);
@@ -2417,7 +2451,8 @@ void setZOrder (Control control, boolean above, boolean fixChildren) {
}
int window1 = OS.XtWindow (topHandle1);
if (window1 == 0) return;
- if (control == null) {
+ int redrawWindow = fixChildren ? parent.redrawWindow : 0;
+ if (control == null && redrawWindow == 0) {
if (above) {
OS.XRaiseWindow (display, window1);
if (fixChildren) parent.moveAbove (topHandle1, 0);
@@ -2427,17 +2462,23 @@ void setZOrder (Control control, boolean above, boolean fixChildren) {
}
return;
}
- int topHandle2 = control.topHandle ();
- if (display != OS.XtDisplay (topHandle2)) return;
- if (!OS.XtIsRealized (topHandle2)) {
- Shell shell = control.getShell ();
- shell.realizeWidget ();
+ int window2, topHandle2 = 0;
+ if (control != null) {
+ topHandle2 = control.topHandle ();
+ if (display != OS.XtDisplay (topHandle2)) return;
+ if (!OS.XtIsRealized (topHandle2)) {
+ Shell shell = control.getShell ();
+ shell.realizeWidget ();
+ }
+ window2 = OS.XtWindow (topHandle2);
+ } else {
+ window2 = redrawWindow;
}
- int window2 = OS.XtWindow (topHandle2);
if (window2 == 0) return;
XWindowChanges struct = new XWindowChanges ();
struct.sibling = window2;
struct.stack_mode = above ? OS.Above : OS.Below;
+ if (window2 == redrawWindow) struct.stack_mode = OS.Below;
/*
* Feature in X. If the receiver is a top level, XConfigureWindow ()
* will fail (with a BadMatch error) for top level shells because top
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Shell.java
index 00fe972b9b..d0b157262e 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Shell.java
@@ -1192,6 +1192,12 @@ boolean setBounds (int x, int y, int width, int height, boolean move, boolean re
configured = true;
boolean isFocus = caret != null && caret.isFocusCaret ();
if (isFocus) caret.killFocus ();
+ if (resize) {
+ if (redrawWindow != 0) {
+ int xDisplay = OS.XtDisplay (handle);
+ OS.XResizeWindow (xDisplay, redrawWindow, width, height);
+ }
+ }
if (move && resize) {
OS.XtConfigureWidget (shellHandle, x, y, width, height, 0);
} else {

Back to the top