aboutsummaryrefslogtreecommitdiff
path: root/libjava/gnu/awt/xlib/XCanvasPeer.java
diff options
context:
space:
mode:
authorScott Gilbertson <scottg@mantatest.com>2005-07-15 16:07:18 +0000
committerScott Gilbertson <sgilbertson@gcc.gnu.org>2005-07-15 16:07:18 +0000
commite27d6202c07dbc70172733fcf6e79cb2ffe9a56c (patch)
tree36d9688009aa0d1293f407c7660e7901e7986ce0 /libjava/gnu/awt/xlib/XCanvasPeer.java
parent27811bfe0a0bd1ff8ad3b361318df9f80fdae79c (diff)
downloadgcc-e27d6202c07dbc70172733fcf6e79cb2ffe9a56c.zip
gcc-e27d6202c07dbc70172733fcf6e79cb2ffe9a56c.tar.gz
gcc-e27d6202c07dbc70172733fcf6e79cb2ffe9a56c.tar.bz2
XCanvasPeer.java (attributes): New field.
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. From-SVN: r102057
Diffstat (limited to 'libjava/gnu/awt/xlib/XCanvasPeer.java')
-rw-r--r--libjava/gnu/awt/xlib/XCanvasPeer.java46
1 files changed, 31 insertions, 15 deletions
diff --git a/libjava/gnu/awt/xlib/XCanvasPeer.java b/libjava/gnu/awt/xlib/XCanvasPeer.java
index 83646b1..39a3f93 100644
--- a/libjava/gnu/awt/xlib/XCanvasPeer.java
+++ b/libjava/gnu/awt/xlib/XCanvasPeer.java
@@ -55,6 +55,8 @@ public class XCanvasPeer implements CanvasPeer
Component component;
XGraphicsConfiguration config;
+ private WindowAttributes attributes = new WindowAttributes();
+ private long eventMask;
public XCanvasPeer(Component component)
{
@@ -92,7 +94,6 @@ public class XCanvasPeer implements CanvasPeer
object. */
component.setBounds(bounds);
- WindowAttributes attributes = new WindowAttributes();
/* Set background color */
Color bg = component.getBackground();
@@ -349,8 +350,21 @@ public class XCanvasPeer implements CanvasPeer
public void setBackground(Color color)
{
- /* default canvas peer does not keep track of background, since it won't
- * paint anything. */
+ if (color != null)
+ {
+ int[] components =
+ {
+ color.getRed (),
+ color.getGreen (),
+ color.getBlue (),
+ 0xff
+ };
+
+ ColorModel cm = config.getColorModel ();
+ long pixel = cm.getDataElement (components, 0);
+ attributes.setBackground (pixel);
+ window.setAttributes (attributes);
+ }
}
public void setBounds(int x, int y, int width, int height)
@@ -388,20 +402,22 @@ public class XCanvasPeer implements CanvasPeer
public void setEventMask(long eventMask)
{
- WindowAttributes attributes = new WindowAttributes();
-
- long xEventMask = getBasicEventMask();
-
- if ((eventMask & AWTEvent.MOUSE_EVENT_MASK) != 0)
+ if (this.eventMask != eventMask)
+ {
+ this.eventMask = eventMask;
+ long xEventMask = getBasicEventMask ();
+
+ if ((eventMask & AWTEvent.MOUSE_EVENT_MASK) != 0)
{
- xEventMask |=
- WindowAttributes.MASK_BUTTON_PRESS |
- WindowAttributes.MASK_BUTTON_RELEASE;
+ xEventMask |=
+ WindowAttributes.MASK_BUTTON_PRESS |
+ WindowAttributes.MASK_BUTTON_RELEASE;
}
-
- attributes.setEventMask(xEventMask);
- window.setAttributes(attributes);
- ensureFlush();
+
+ attributes.setEventMask (xEventMask);
+ window.setAttributes (attributes);
+ ensureFlush ();
+ }
}
public void setFont(Font font)