summaryrefslogtreecommitdiffstats
path: root/libjava/gnu/awt/xlib/XEventQueue.java
diff options
context:
space:
mode:
authorsgilbertson <sgilbertson@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-15 16:07:18 +0000
committersgilbertson <sgilbertson@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-15 16:07:18 +0000
commit581d57e6c0faef95b511984510372d09ca55210c (patch)
tree36d9688009aa0d1293f407c7660e7901e7986ce0 /libjava/gnu/awt/xlib/XEventQueue.java
parent53c0d211319a9f957d984f6e40b2828e1c586d47 (diff)
downloadppe42-gcc-581d57e6c0faef95b511984510372d09ca55210c.tar.gz
ppe42-gcc-581d57e6c0faef95b511984510372d09ca55210c.zip
2005-07-15 Scott Gilbertson <scottg@mantatest.com>
* gnu/awt/xlib/XCanvasPeer.java (attributes): New field. (eventMask): New field. (XCanvasPeer(Component)): Use attributes field. (setBackground): Implemented. (setEventMask): Process mask only if changed. * gnu/awt/xlib/XEventLoop.java (class): Iplement Runnable. (eventLoopThread): New field. (XEventLoop(Display,EventQueue)): Start eventLoopThread. (interrupt): Removed. (run): New method. * gnu/awt/xlib/XEventQueue.java (getNextEvent): Process Container and Component events. * gnu/awt/xlib/XFramePeer.java (processingConfigureNotify): New field. (configureNotify): Set and clear processingConfigureNotify. (setBounds): Process only if processingConfigureNotify is false. (toBack): Implemented. (toFront): Implemented. * gnu/awt/xlib/XGraphics.java (setColor): Ignore null color. * gnu/awt/xlib/XGraphicsConfiguration.java (getPixel): Ignore null color. * gnu/awt/xlib/XToolkit.java (nativeQueueEmpty): Always return true. (wakeNativeQueue): Do nothing. (iterateNativeQueue): Do queue.wait if blocking. * gnu/gcj/xlib/Font.java (loadFont): New method. (loadFontImpl): Renamed native method, was loadFont. * gnu/gcj/xlib/Window.java (toFront): New method. (toBack): New method. * gnu/gcj/xlib/natFont.cc (loadFontImpl): Renamed method, was loadFont. * gnu/gcj/xlib/natWindow.cc (toBack): New method. (toFront): New method. * gnu/gcj/xlib/natXAnyEvent.cc (loadNext): Removed timeout. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102057 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu/awt/xlib/XEventQueue.java')
-rw-r--r--libjava/gnu/awt/xlib/XEventQueue.java73
1 files changed, 69 insertions, 4 deletions
diff --git a/libjava/gnu/awt/xlib/XEventQueue.java b/libjava/gnu/awt/xlib/XEventQueue.java
index ea2ad186060..b068daf1b52 100644
--- a/libjava/gnu/awt/xlib/XEventQueue.java
+++ b/libjava/gnu/awt/xlib/XEventQueue.java
@@ -8,12 +8,16 @@ details. */
package gnu.awt.xlib;
-import java.awt.*;
-
import gnu.gcj.xlib.Display;
+import java.awt.AWTEvent;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.EventQueue;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ContainerEvent;
/**
- * The only difference here from a standard EventQueue is that the X
+ * The main difference here from a standard EventQueue is that the X
* display connection is flushed before waiting for more events.
*/
public class XEventQueue extends EventQueue
@@ -29,6 +33,67 @@ public class XEventQueue extends EventQueue
{
if ((peekEvent() == null) && (display != null))
display.flush();
- return super.getNextEvent();
+ AWTEvent event = super.getNextEvent();
+ if (event != null)
+ {
+ switch (event.getID ())
+ {
+ case ContainerEvent.COMPONENT_ADDED:
+ {
+ /* If a component has been added to a container, it needs to be
+ * invalidated, to ensure that it ultimately gets an addNotify.
+ * If it's not invalidated, the component will never display in
+ * an already-showing container (probably applies only to CardLayout).
+ * Perhaps this code should be in java.awt, but the problem only seems
+ * to happen with xlib peers (not with gtk peers) so it's here instead.
+ */
+ ContainerEvent ce = (ContainerEvent)event;
+ ce.getChild ().invalidate ();
+ ce.getContainer ().validate ();
+ }
+ break;
+
+ case ComponentEvent.COMPONENT_RESIZED:
+ {
+ ComponentEvent ce = (ComponentEvent)event;
+ // FIXME: there may be opportunities to coalesce resize events
+ ce.getComponent ().validate ();
+ }
+ break;
+
+ case ComponentEvent.COMPONENT_SHOWN:
+ {
+ ComponentEvent ce = (ComponentEvent)event;
+ Component comp = ce.getComponent ();
+ if (!comp.isValid ())
+ {
+ /* Try to validate, going up the tree to the highest-level invalid
+ * Container. The idea is to ensure that addNotify gets called for
+ * any non-top-level component being shown, to make it create a peer.
+ */
+ Container parent = comp.getParent ();
+ while (parent != null)
+ {
+ Container next = parent.getParent ();
+ if (next == null || next.isValid ())
+ {
+ parent.validate ();
+ break;
+ }
+ else
+ parent = next;
+ }
+ if (comp instanceof Container)
+ comp.validate ();
+ }
+ comp.repaint ();
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ return event;
}
}
OpenPOWER on IntegriCloud