[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath : qt peer fixes

Kaffe CVS cvs-commits at kaffe.org
Sun Aug 21 12:40:52 PDT 2005


PatchSet 6864 
Date: 2005/08/21 19:28:31
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath : qt peer fixes

Members: 
	ChangeLog:1.4386->1.4387 
	libraries/clib/awt/classpath-qt/componentevent.cpp:1.1->1.2 
	libraries/clib/awt/classpath-qt/componentevent.h:1.1->1.2 
	libraries/clib/awt/classpath-qt/eventmethods.h:1.1->1.2 
	libraries/clib/awt/classpath-qt/mainqtthread.cpp:1.1->1.2 
	libraries/clib/awt/classpath-qt/mainthreadinterface.cpp:1.1->1.2 
	libraries/clib/awt/classpath-qt/mainthreadinterface.h:1.1->1.2 
	libraries/clib/awt/classpath-qt/qtcomponentpeer.cpp:1.2->1.3 
	libraries/clib/awt/classpath-qt/qtframepeer.cpp:1.2->1.3 
	libraries/clib/awt/classpath-qt/qtgraphics.cpp:1.2->1.3 
	libraries/javalib/Makefile.am:1.385->1.386 
	libraries/javalib/Makefile.in:1.475->1.476 
	libraries/javalib/all.files:1.155->1.156 
	libraries/javalib/gnu/java/awt/peer/qt/MainQtThread.java:1.1->1.2 
	libraries/javalib/gnu/java/awt/peer/qt/QtComponentGraphics.java:1.2->1.3 
	libraries/javalib/gnu/java/awt/peer/qt/QtComponentPeer.java:1.3->1.4 
	libraries/javalib/gnu/java/awt/peer/qt/QtEmbeddedWindowPeer.java:1.1->1.2 
	libraries/javalib/gnu/java/awt/peer/qt/QtFramePeer.java:1.3->1.4 
	libraries/javalib/gnu/java/awt/peer/qt/QtImage.java:1.2->1.3 
	libraries/javalib/gnu/java/awt/peer/qt/QtListPeer.java:1.2->1.3 
	libraries/javalib/gnu/java/awt/peer/qt/QtScreenDeviceConfiguration.java:1.2->1.3 
	libraries/javalib/gnu/java/awt/peer/qt/QtToolkit.java:1.2->1.3 
	libraries/javalib/java/awt/Window.java:1.37->1.38 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4386 kaffe/ChangeLog:1.4387
--- kaffe/ChangeLog:1.4386	Sun Aug 21 19:06:15 2005
+++ kaffe/ChangeLog	Sun Aug 21 19:28:31 2005
@@ -2,6 +2,38 @@
 
 	Resynced with GNU Classpath.
 
+	2005-08-20  Thomas Fitzsimmons  <fitzsim at redhat.com>
+
+        * java/awt/Window.java (getMostRecentFocusOwner): New method.
+
+	2005-08-20  Sven de Marothy  <sven at physto.se>
+
+        * gnu/java/awt/peer/qt/MainQtThread.java
+        * gnu/java/awt/peer/qt/QtComponentGraphics.java
+        * gnu/java/awt/peer/qt/QtComponentPeer.java
+        * gnu/java/awt/peer/qt/QtEmbeddedWindowPeer.java
+        * gnu/java/awt/peer/qt/QtFramePeer.java
+        * gnu/java/awt/peer/qt/QtImage.java
+        * gnu/java/awt/peer/qt/QtListPeer.java
+        * gnu/java/awt/peer/qt/QtScreenDeviceConfiguration.java
+        * gnu/java/awt/peer/qt/QtToolkit.java
+        * native/jni/qt-peer/componentevent.cpp
+        * native/jni/qt-peer/componentevent.h
+        * native/jni/qt-peer/eventmethods.h
+        * native/jni/qt-peer/mainqtthread.cpp
+        * native/jni/qt-peer/mainthreadinterface.cpp
+        * native/jni/qt-peer/mainthreadinterface.h
+        * native/jni/qt-peer/qtcomponentpeer.cpp
+        * native/jni/qt-peer/qtframepeer.cpp
+        * native/jni/qt-peer/qtgraphics.cpp
+        Refactored.
+        * gnu/java/awt/peer/qt/QtRepaintThread.java:
+        New file.
+
+2005-08-21  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
+
 	2005-08-19  Tom Tromey  <tromey at redhat.com>
 
         * javax/swing/tree/DefaultTreeCellEditor.java: Removed erroneous
Index: kaffe/libraries/clib/awt/classpath-qt/componentevent.cpp
diff -u kaffe/libraries/clib/awt/classpath-qt/componentevent.cpp:1.1 kaffe/libraries/clib/awt/classpath-qt/componentevent.cpp:1.2
--- kaffe/libraries/clib/awt/classpath-qt/componentevent.cpp:1.1	Sat Aug 13 15:43:07 2005
+++ kaffe/libraries/clib/awt/classpath-qt/componentevent.cpp	Sun Aug 21 19:28:35 2005
@@ -101,7 +101,9 @@
 
 void AWTResizeEvent::runEvent()
 {
-  widget->setGeometry( x, y, w, h );
+  QRect g = widget->geometry();
+  if(g.x() != x || g.y() != y || g.width() != w || g.height() != h)
+    widget->setGeometry( x, y, w, h );
 }
 
 AWTBackgroundEvent::AWTBackgroundEvent(QWidget *wid, bool fg, QColor *clr)
Index: kaffe/libraries/clib/awt/classpath-qt/componentevent.h
diff -u kaffe/libraries/clib/awt/classpath-qt/componentevent.h:1.1 kaffe/libraries/clib/awt/classpath-qt/componentevent.h:1.2
--- kaffe/libraries/clib/awt/classpath-qt/componentevent.h:1.1	Sat Aug 13 15:43:07 2005
+++ kaffe/libraries/clib/awt/classpath-qt/componentevent.h	Sun Aug 21 19:28:35 2005
@@ -173,31 +173,4 @@
   }
 };
 
-class AWTGetSizeEvent : public AWTEvent {
-  
- private:
-  QWidget *widget;
-  bool preferred;
-
- public:
-
-  QSize **size;
-
-  AWTGetSizeEvent(QWidget *w, QSize **s, bool pref) : AWTEvent()
-    { 
-      widget = w; 
-      preferred = pref;
-      size = s;
-    }
-  void runEvent()
-  {
-    QSize s;
-    if( preferred )
-      s = widget->sizeHint();
-    else
-      s = widget->minimumSizeHint();
-    *size = new QSize( s.width(), s.height() );
-  }
-};
-
 #endif
Index: kaffe/libraries/clib/awt/classpath-qt/eventmethods.h
diff -u kaffe/libraries/clib/awt/classpath-qt/eventmethods.h:1.1 kaffe/libraries/clib/awt/classpath-qt/eventmethods.h:1.2
--- kaffe/libraries/clib/awt/classpath-qt/eventmethods.h:1.1	Wed Aug 17 22:38:24 2005
+++ kaffe/libraries/clib/awt/classpath-qt/eventmethods.h	Sun Aug 21 19:28:35 2005
@@ -186,7 +186,8 @@
   void moveEvent( QMoveEvent *e )
   {
     PARENT::moveEvent(e);
-    callVoidMethod("moveEvent");
+    callMouseMethod("moveEvent", e->pos().x(), e->pos().y(),
+		    e->oldPos().x(), e->oldPos().y());
   }
 
   void resizeEvent( QResizeEvent *e )
@@ -228,7 +229,7 @@
 
 	// call QtComponentPeer.paintEvent()
 	jmethodID paintEventID = env->GetMethodID( componentCls,
-					      "paint",
+						   "paint",
 						   "(Ljava/awt/Graphics;)V" );
 	env->CallVoidMethod( target, paintEventID, graphics );
 	env->DeleteLocalRef( cls );
Index: kaffe/libraries/clib/awt/classpath-qt/mainqtthread.cpp
diff -u kaffe/libraries/clib/awt/classpath-qt/mainqtthread.cpp:1.1 kaffe/libraries/clib/awt/classpath-qt/mainqtthread.cpp:1.2
--- kaffe/libraries/clib/awt/classpath-qt/mainqtthread.cpp:1.1	Sat Aug 13 15:43:07 2005
+++ kaffe/libraries/clib/awt/classpath-qt/mainqtthread.cpp	Sun Aug 21 19:28:35 2005
@@ -45,11 +45,15 @@
 MainThreadInterface *mainThread;
 QApplication *qApplication;
 
+#if defined(Q_WS_X11)
+extern void qt_x11_set_global_double_buffer( bool );
+#endif
+
 /**
  * Starts up a QApplication
  */
 JNIEXPORT jlong JNICALL Java_gnu_java_awt_peer_qt_MainQtThread_init
-(JNIEnv *env, jobject obj, jstring theme)
+(JNIEnv *env, jobject obj, jstring theme, jboolean doublebuffer)
 {
   int *argc;
   char **argv;
@@ -87,6 +91,11 @@
   jclass cls = env->GetObjectClass(obj);
   jfieldID nofid = env->GetFieldID( cls, "mainThreadInterface", "J" );
   env->SetLongField( obj, nofid, (jlong)mainThread );
+
+#if defined(Q_WS_X11)
+  // turn off double-buffering.
+  qt_x11_set_global_double_buffer( (doublebuffer == JNI_TRUE) );
+#endif
 
   return (jlong)qtApp;
 }
Index: kaffe/libraries/clib/awt/classpath-qt/mainthreadinterface.cpp
diff -u kaffe/libraries/clib/awt/classpath-qt/mainthreadinterface.cpp:1.1 kaffe/libraries/clib/awt/classpath-qt/mainthreadinterface.cpp:1.2
--- kaffe/libraries/clib/awt/classpath-qt/mainthreadinterface.cpp:1.1	Sat Aug 13 15:43:07 2005
+++ kaffe/libraries/clib/awt/classpath-qt/mainthreadinterface.cpp	Sun Aug 21 19:28:35 2005
@@ -50,6 +50,7 @@
  */
 bool MainThreadInterface::event ( QEvent * e )
 {
+  QObject::event( e );
   if( e->type() == QEvent::User)
     {
       AWTEvent *fe = (AWTEvent *)e;
Index: kaffe/libraries/clib/awt/classpath-qt/mainthreadinterface.h
diff -u kaffe/libraries/clib/awt/classpath-qt/mainthreadinterface.h:1.1 kaffe/libraries/clib/awt/classpath-qt/mainthreadinterface.h:1.2
--- kaffe/libraries/clib/awt/classpath-qt/mainthreadinterface.h:1.1	Sat Aug 13 15:43:07 2005
+++ kaffe/libraries/clib/awt/classpath-qt/mainthreadinterface.h	Sun Aug 21 19:28:35 2005
@@ -20,9 +20,6 @@
 
 };
 
-#define AWT_INIT 0
-#define AWT_SETVISIBLE 1
-
 class MainThreadInterface : public QObject {
   
  private:
Index: kaffe/libraries/clib/awt/classpath-qt/qtcomponentpeer.cpp
diff -u kaffe/libraries/clib/awt/classpath-qt/qtcomponentpeer.cpp:1.2 kaffe/libraries/clib/awt/classpath-qt/qtcomponentpeer.cpp:1.3
--- kaffe/libraries/clib/awt/classpath-qt/qtcomponentpeer.cpp:1.2	Wed Aug 17 22:38:24 2005
+++ kaffe/libraries/clib/awt/classpath-qt/qtcomponentpeer.cpp	Sun Aug 21 19:28:35 2005
@@ -122,14 +122,10 @@
 {
   QWidget *widget = (QWidget *) getNativeObject( env, obj );
   assert( widget );
-  QSize *size = NULL;
 
-  AWTGetSizeEvent *e = new AWTGetSizeEvent( widget, &size, false );
-  mainThread->postEventToMain( e );
-  while(size == NULL);
-  return makeDimension(env, size);
-
-  delete size;
+  QSize s = widget->minimumSizeHint();
+  jobject q =  makeDimension(env, &s);
+  return q;
 }
 
 /*
@@ -141,15 +137,10 @@
 {
   QWidget *widget = (QWidget *) getNativeObject( env, obj );
   assert( widget );
-  QSize *size = NULL;
-
-  AWTGetSizeEvent *e = new AWTGetSizeEvent( widget, &size, true );
-  mainThread->postEventToMain( e );
-  while(size == NULL);
-
-  return makeDimension(env, size);
-
-  delete size;
+  
+  QSize s = widget->sizeHint();
+  jobject q = makeDimension(env, &s);
+  return q;
 }
 
 /*
@@ -202,14 +193,8 @@
 {
   QWidget *widget = (QWidget *) getNativeObject( env, obj );
   assert( widget );
-
-  QRect g = widget->geometry();
-  if(g.x() != x || g.y() != y || 
-     g.width() != width || g.height() != height)
-    {
-      mainThread->postEventToMain
-	(new AWTResizeEvent( widget, x, y, width, height ) );
-    }
+  mainThread->postEventToMain
+    (new AWTResizeEvent( widget, x, y, width, height ) );
 }
 
 /*
Index: kaffe/libraries/clib/awt/classpath-qt/qtframepeer.cpp
diff -u kaffe/libraries/clib/awt/classpath-qt/qtframepeer.cpp:1.2 kaffe/libraries/clib/awt/classpath-qt/qtframepeer.cpp:1.3
--- kaffe/libraries/clib/awt/classpath-qt/qtframepeer.cpp:1.2	Wed Aug 17 22:38:24 2005
+++ kaffe/libraries/clib/awt/classpath-qt/qtframepeer.cpp	Sun Aug 21 19:28:35 2005
@@ -37,13 +37,16 @@
 
 #include <assert.h>
 #include <QApplication>
+#include <QIcon>
 #include <QMainWindow>
 #include <QMenuBar>
+#include <QPixmap>
 #include <QToolBar>
 #include <QThread>
 #include <gnu_java_awt_peer_qt_QtFramePeer.h>
 #include "qtcomponent.h"
 #include "qtstrings.h"
+#include "qtimage.h"
 #include "containers.h"
 #include "keybindings.h"
 #include "mainthreadinterface.h"
@@ -160,6 +163,32 @@
 }
 
 /**
+ * Sets the icon image.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtFramePeer_setIcon
+(JNIEnv *env, jobject obj, jobject image)
+{
+  QMainWindow *frame = (QMainWindow *) getNativeObject( env, obj );
+  assert( frame );
+
+  QIcon *i;
+  if( image == NULL )
+    {
+      // remove icon
+      i = new QIcon();
+    }
+  else
+    {
+      // set icon
+      QImage *img = getQtImage( env, image );
+      assert( img );
+      i = new QIcon( QPixmap::fromImage( *img ) );
+    }
+  frame->setWindowIcon( *i );
+  delete i;
+}
+
+/**
  * Returns the menu bar height for insets.
  */
 JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtFramePeer_menuBarHeight
@@ -197,4 +226,13 @@
   mainThread->postEventToMain( new FrameMenuEvent( frame, menubar ) );
 }
 
+/**
+ * Set the bounds of the maximized frame
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtFramePeer_setMaximizedBounds (JNIEnv *env, jobject obj, jint w, jint h)
+{
+  QMainWindow *frame = (QMainWindow *) getNativeObject( env, obj );
+  assert( frame );
+  // FIXME
+}
 
Index: kaffe/libraries/clib/awt/classpath-qt/qtgraphics.cpp
diff -u kaffe/libraries/clib/awt/classpath-qt/qtgraphics.cpp:1.2 kaffe/libraries/clib/awt/classpath-qt/qtgraphics.cpp:1.3
--- kaffe/libraries/clib/awt/classpath-qt/qtgraphics.cpp:1.2	Wed Aug 17 22:38:24 2005
+++ kaffe/libraries/clib/awt/classpath-qt/qtgraphics.cpp	Sun Aug 21 19:28:35 2005
@@ -211,7 +211,6 @@
 {
   QPainter *painter = getPainter( env, obj );
   assert( painter );
-
   qreal x, y, w, h;
   painter->clipPath().boundingRect().getRect(&x, &y, &w, &h);    
 
Index: kaffe/libraries/javalib/Makefile.am
diff -u kaffe/libraries/javalib/Makefile.am:1.385 kaffe/libraries/javalib/Makefile.am:1.386
--- kaffe/libraries/javalib/Makefile.am:1.385	Sun Aug 21 19:06:18 2005
+++ kaffe/libraries/javalib/Makefile.am	Sun Aug 21 19:28:36 2005
@@ -1281,6 +1281,7 @@
 	gnu/java/awt/peer/qt/QtMenuPeer.java \
 	gnu/java/awt/peer/qt/QtPanelPeer.java \
 	gnu/java/awt/peer/qt/QtPopupMenuPeer.java \
+	gnu/java/awt/peer/qt/QtRepaintThread.java \
 	gnu/java/awt/peer/qt/QtScreenDevice.java \
 	gnu/java/awt/peer/qt/QtScreenDeviceConfiguration.java \
 	gnu/java/awt/peer/qt/QtScrollPanePeer.java \
Index: kaffe/libraries/javalib/Makefile.in
diff -u kaffe/libraries/javalib/Makefile.in:1.475 kaffe/libraries/javalib/Makefile.in:1.476
--- kaffe/libraries/javalib/Makefile.in:1.475	Sun Aug 21 19:06:19 2005
+++ kaffe/libraries/javalib/Makefile.in	Sun Aug 21 19:28:36 2005
@@ -1718,6 +1718,7 @@
 	gnu/java/awt/peer/qt/QtMenuPeer.java \
 	gnu/java/awt/peer/qt/QtPanelPeer.java \
 	gnu/java/awt/peer/qt/QtPopupMenuPeer.java \
+	gnu/java/awt/peer/qt/QtRepaintThread.java \
 	gnu/java/awt/peer/qt/QtScreenDevice.java \
 	gnu/java/awt/peer/qt/QtScreenDeviceConfiguration.java \
 	gnu/java/awt/peer/qt/QtScrollPanePeer.java \
Index: kaffe/libraries/javalib/all.files
diff -u kaffe/libraries/javalib/all.files:1.155 kaffe/libraries/javalib/all.files:1.156
--- kaffe/libraries/javalib/all.files:1.155	Sun Aug 21 19:06:20 2005
+++ kaffe/libraries/javalib/all.files	Sun Aug 21 19:28:37 2005
@@ -829,6 +829,7 @@
 gnu/java/awt/peer/qt/QtMenuPeer.java
 gnu/java/awt/peer/qt/QtPanelPeer.java
 gnu/java/awt/peer/qt/QtPopupMenuPeer.java
+gnu/java/awt/peer/qt/QtRepaintThread.java
 gnu/java/awt/peer/qt/QtScreenDevice.java
 gnu/java/awt/peer/qt/QtScreenDeviceConfiguration.java
 gnu/java/awt/peer/qt/QtScrollPanePeer.java
Index: kaffe/libraries/javalib/gnu/java/awt/peer/qt/MainQtThread.java
diff -u kaffe/libraries/javalib/gnu/java/awt/peer/qt/MainQtThread.java:1.1 kaffe/libraries/javalib/gnu/java/awt/peer/qt/MainQtThread.java:1.2
--- kaffe/libraries/javalib/gnu/java/awt/peer/qt/MainQtThread.java:1.1	Sat Aug 13 15:43:07 2005
+++ kaffe/libraries/javalib/gnu/java/awt/peer/qt/MainQtThread.java	Sun Aug 21 19:28:38 2005
@@ -50,10 +50,12 @@
   long mainThreadInterface;
   String theme;
   private boolean running;
+  private boolean doublebuffer;
 
-  public MainQtThread( String theme )
+  public MainQtThread( String theme, boolean doublebuffer )
   {
     this.theme = theme;
+    this.doublebuffer = doublebuffer;
     running = false;
   }
 
@@ -65,7 +67,7 @@
   /**
    * Creates the QApplication
    */
-  public native long init(String theme);
+  public native long init(String theme, boolean doublebuffer);
 
   /**
    * Runs the QApplication (doesn't return.)
@@ -74,7 +76,7 @@
 
   public void run()
   {
-    QApplicationPointer = init(theme);
+    QApplicationPointer = init(theme, doublebuffer);
     running = true;
     exec(QApplicationPointer);
   }
Index: kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtComponentGraphics.java
diff -u kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtComponentGraphics.java:1.2 kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtComponentGraphics.java:1.3
--- kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtComponentGraphics.java:1.2	Wed Aug 17 22:38:29 2005
+++ kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtComponentGraphics.java	Sun Aug 21 19:28:38 2005
@@ -87,7 +87,7 @@
     else
       setColor( c );
     setup();
-    //    setClip( initialClip );
+    setClip( initialClip );
   }
 
   /**
Index: kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtComponentPeer.java
diff -u kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtComponentPeer.java:1.3 kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtComponentPeer.java:1.4
--- kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtComponentPeer.java:1.3	Sun Aug 21 18:31:03 2005
+++ kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtComponentPeer.java	Sun Aug 21 19:28:38 2005
@@ -73,6 +73,8 @@
 import java.util.Timer;
 import java.util.TimerTask;
 
+import javax.swing.DebugGraphics;
+
 public class QtComponentPeer extends NativeWrapper implements ComponentPeer
 {
 
@@ -111,15 +113,12 @@
    */
   private QtImage backBuffer;
 
-  /**
-   * Stores if the backBuffer is dirty or not
-   */
-  private boolean dirtyBackBuffer;
-
   protected long qtApp;
 
   private boolean settingUp;
 
+  private boolean ignoreResize = false;
+
   QtComponentPeer( QtToolkit kit, Component owner )
   {
     this.owner = owner;
@@ -166,10 +165,10 @@
 	setEnabled( owner.isEnabled() );
 
 	backBuffer = null;
-	dirtyBackBuffer = true;
 	updateBounds();
 
 	setVisible( owner.isVisible() );
+	QtToolkit.repaintThread.queueComponent(this);
       }
     settingUp = false;
   }
@@ -352,25 +351,28 @@
     toolkit.eventQueue.postEvent(e);
   }
 
-  protected void moveEvent()
+  protected void moveEvent(int x, int y, int oldx, int oldy)
   {
-    ComponentEvent e = new ComponentEvent(owner, 
-					  ComponentEvent.COMPONENT_MOVED);
-    toolkit.eventQueue.postEvent(e);
+    if( !ignoreResize )
+      {
+	// Since Component.setLocation calls back to setBounds, 
+	// we need to ignore that.
+	ignoreResize = true; 
+	owner.setLocation( x, y );
+	ignoreResize = false;
+      }
   }
 
   protected void resizeEvent(int oldWidth, int oldHeight, 
 			     int width, int height)
   {
-    dirtyBackBuffer = true;
-    if( drawableComponent() )
-      {
-	//	backBuffer.dispose();
-	backBuffer = new QtImage(width, height);
-      }
+    if(!(owner instanceof Window))
+      return;
+    ignoreResize = true;
     owner.setSize(width, height);
+    ignoreResize = false;
     ComponentEvent e = new ComponentEvent(owner, 
-					  ComponentEvent.COMPONENT_RESIZED);
+  					  ComponentEvent.COMPONENT_RESIZED);
     toolkit.eventQueue.postEvent(e);
   }
 
@@ -495,7 +497,7 @@
 
   public Graphics getGraphics()
   {
-    if( backBuffer == null)
+    if( backBuffer == null )
       { 
 	Rectangle r = owner.getBounds();
 	backBuffer = new QtImage( r.width, r.height );
@@ -512,7 +514,7 @@
 
   public native Point getLocationOnScreen();
 
-  public Dimension getMinimumSize()
+  public synchronized Dimension getMinimumSize()
   {
     Dimension d = getMinimumSizeNative();
     if(d == null)
@@ -520,12 +522,15 @@
     return d;
   }
  
-  public Dimension getPreferredSize()
+  public synchronized Dimension getPreferredSize()
   {
-    Dimension d = getPreferredSizeNative();
-    if(d == null)
-      return owner.getSize();
-    return d;
+    synchronized(toolkit)
+      {
+	Dimension d = getPreferredSizeNative();
+	if(d == null)
+	  return owner.getSize();
+	return d;
+      }
   }
 
   public Toolkit getToolkit()
@@ -574,7 +579,6 @@
 		      int width,
 		      int height)
   {
-    dirtyBackBuffer = true;
     setBounds( x, y, width, height );
   }
 
@@ -587,9 +591,12 @@
 
   public void setBounds(int x, int y, int width, int height)
   {
+    if( ignoreResize )
+      return;
     if(width > 0 && height > 0 && (drawableComponent() || backBuffer != null))
       backBuffer = new QtImage(width, height);   
     setBoundsNative(x, y, width, height);
+    QtToolkit.repaintThread.queueComponent(this);
   }
 
   public void setCursor(Cursor cursor)
@@ -629,8 +636,7 @@
       case ComponentEvent.COMPONENT_SHOWN:
       case PaintEvent.PAINT:
       case PaintEvent.UPDATE:	
-	dirtyBackBuffer = true;
-	QtUpdate();
+	QtToolkit.repaintThread.queueComponent(this);
         break;
       case KeyEvent.KEY_PRESSED:
 	break;
@@ -640,22 +646,23 @@
   }
 
   /**
-   * Paint() is called back from the native side in response to a native
+   * paint() is called back from the native side in response to a native
    * repaint event.
    */  
   public void paint(Graphics g)
   {
     if (backBuffer != null)
+      backBuffer.drawPixels((QtGraphics)g, 0, 0, 0, 0, 0, false );
+  }
+
+  public void paintBackBuffer()
+  {
+    if( backBuffer != null)
       {
-	if (dirtyBackBuffer)
-	  {
-	    backBuffer.clear();
-	    Graphics2D bbg = (Graphics2D)backBuffer.getGraphics();
-	    owner.paint(bbg); 
-	    bbg.dispose();
-	    dirtyBackBuffer = false;
-	  }
-	backBuffer.drawPixels((QtGraphics)g, 0, 0, 0, 0, 0, false );
+	backBuffer.clear();
+	Graphics2D bbg = (Graphics2D)backBuffer.getGraphics();
+	owner.paint(bbg); 
+	bbg.dispose();
       }
   }
 
Index: kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtEmbeddedWindowPeer.java
diff -u kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtEmbeddedWindowPeer.java:1.1 kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtEmbeddedWindowPeer.java:1.2
--- kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtEmbeddedWindowPeer.java:1.1	Wed Aug 17 22:38:29 2005
+++ kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtEmbeddedWindowPeer.java	Sun Aug 21 19:28:38 2005
@@ -41,7 +41,11 @@
 import java.awt.peer.WindowPeer;
 import gnu.java.awt.peer.EmbeddedWindowPeer;
 
-public class QtEmbeddedWindowPeer extends QtWindowPeer implements WindowPeer
+/** 
+ * Embedded window peer for applets.
+ * FIXME: EmbeddedWindowPeer and this class should extend Window, NOT Frame.
+ */
+public class QtEmbeddedWindowPeer extends QtFramePeer implements EmbeddedWindowPeer
 {
   public QtEmbeddedWindowPeer( QtToolkit kit, Component owner )
   {
Index: kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtFramePeer.java
diff -u kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtFramePeer.java:1.3 kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtFramePeer.java:1.4
--- kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtFramePeer.java:1.3	Sun Aug 21 18:31:03 2005
+++ kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtFramePeer.java	Sun Aug 21 19:28:38 2005
@@ -37,6 +37,7 @@
 
 package gnu.java.awt.peer.qt;
 
+import java.awt.Component;
 import java.awt.Frame;
 import java.awt.Image;
 import java.awt.Insets;
@@ -50,7 +51,7 @@
 
   long frameObject;
 
-  public QtFramePeer( QtToolkit kit, Frame owner )
+  public QtFramePeer( QtToolkit kit, Component owner )
   {
     super( kit, owner );
   }
@@ -65,15 +66,9 @@
       setMenuBar( ((Frame)owner).getMenuBar() );
   }
 
-  private void setIcon(QtImage image)
-  {
-    // FIXME - Implement!
-  }
+  private native void setIcon(QtImage image);
 
-  private void setMaximizedBounds(int w, int h)
-  {
-    // FIXME - Implement.
-  }
+  private native void setMaximizedBounds(int w, int h);
 
   private native void setMenu(QtMenuBarPeer mb);
 
@@ -103,8 +98,9 @@
   public void setIconImage(Image im)
   {
     if (im instanceof QtImage)
-      setIcon ((QtImage)im);
-    // FIXME
+      setIcon( (QtImage)im );
+    else 
+      setIcon( new QtImage( im.getSource() ) );
   }
 
   public void setMaximizedBounds(Rectangle rect)
Index: kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtImage.java
diff -u kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtImage.java:1.2 kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtImage.java:1.3
--- kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtImage.java:1.2	Wed Aug 17 22:38:29 2005
+++ kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtImage.java	Sun Aug 21 19:28:38 2005
@@ -408,9 +408,9 @@
   {
     if (isLoaded)
       {
-	if( painters != null )
-	  for(int i = 0; i < painters.size(); i++)
-	    ((QtImageGraphics)painters.elementAt(i)).dispose();
+// 	if( painters != null )
+// 	  for(int i = 0; i < painters.size(); i++)
+// 	    ((QtImageGraphics)painters.elementAt(i)).dispose();
 	freeImage();
       }
   }
Index: kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtListPeer.java
diff -u kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtListPeer.java:1.2 kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtListPeer.java:1.3
--- kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtListPeer.java:1.2	Wed Aug 17 22:38:29 2005
+++ kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtListPeer.java	Sun Aug 21 19:28:38 2005
@@ -165,8 +165,7 @@
 
   /**
    * Sets multiple-selection mode.
-   * WONTFIX: QAbstractItemView::MultiSelection does not work as it should
-   * in Qt 4.0.0, Trolltech bug reporter says this will be fixed in 4.1.0.
+   * Note there's a bug in multiple selection in Qt 4.0.0, use 4.0.1.
    */
   public native void setMultipleMode(boolean multi);
 
Index: kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtScreenDeviceConfiguration.java
diff -u kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtScreenDeviceConfiguration.java:1.2 kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtScreenDeviceConfiguration.java:1.3
--- kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtScreenDeviceConfiguration.java:1.2	Sun Aug 21 18:31:03 2005
+++ kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtScreenDeviceConfiguration.java	Sun Aug 21 19:28:38 2005
@@ -139,9 +139,9 @@
     return nTrans;
   }
 
-  public VolatileImage createCompatibleVolatileImage(int width, int height, int transparency)
+  public VolatileImage createCompatibleVolatileImage(int width, int height, 
+						     int transparency)
   {
-    // TODO Auto-generated method stub
-    return null;
+    return createCompatibleVolatileImage(width, height);
   }
 }
Index: kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtToolkit.java
diff -u kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtToolkit.java:1.2 kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtToolkit.java:1.3
--- kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtToolkit.java:1.2	Wed Aug 17 22:38:29 2005
+++ kaffe/libraries/javalib/gnu/java/awt/peer/qt/QtToolkit.java	Sun Aug 21 19:28:38 2005
@@ -127,12 +127,14 @@
 public class QtToolkit extends ClasspathToolkit
 {
   public static EventQueue eventQueue = null; // the native event queue
+  public static QtRepaintThread repaintThread = null; 
   public static MainQtThread guiThread = null;
   public static QtGraphicsEnvironment graphicsEnv = null;
 
   private static void initToolkit()
   {
     eventQueue = new EventQueue();
+    repaintThread = new QtRepaintThread();
     System.loadLibrary("qtpeer");
 
     String theme = null;
@@ -149,8 +151,23 @@
       {
       }
 
-    guiThread = new MainQtThread( theme );
+    boolean doublebuffer = true;
+    try 
+      {
+	String style = System.getProperty("qtoptions.nodoublebuffer");
+	if(style != null)
+	  doublebuffer = false;
+      } 
+    catch(SecurityException e)
+      {
+      }
+    catch(IllegalArgumentException e)
+      {
+      }
+
+    guiThread = new MainQtThread( theme, doublebuffer );
     guiThread.start();
+    repaintThread.start();
   }
 
   /**
@@ -450,28 +467,9 @@
     throw new UnsupportedOperationException();
   }
 
-  // REMOVE.
-  public void registerImageIOSpis(IIORegistry reg)
-  {
-  }
-
   public EmbeddedWindowPeer createEmbeddedWindow(EmbeddedWindow w)
   {
-    return null; // FIXME
-  }
-
-  // Yucky.
-
-  public boolean nativeQueueEmpty()
-  {
-    return false;
-  }
-
-  public void wakeNativeQueue()
-  {
-  }
-
-  public void iterateNativeQueue(EventQueue locked, boolean block)
-  {
+    //    return new QtEmbeddedWindowPeer( this, w );
+    return null;
   }
 }
Index: kaffe/libraries/javalib/java/awt/Window.java
diff -u kaffe/libraries/javalib/java/awt/Window.java:1.37 kaffe/libraries/javalib/java/awt/Window.java:1.38
--- kaffe/libraries/javalib/java/awt/Window.java:1.37	Sun Aug 21 18:31:05 2005
+++ kaffe/libraries/javalib/java/awt/Window.java	Sun Aug 21 19:28:38 2005
@@ -746,7 +746,25 @@
     if (activeWindow == this)
       return manager.getFocusOwner ();
     else
-      return windowFocusOwner;
+      return null;
+  }
+
+  /**
+   * Returns the child component of this window that would receive
+   * focus if this window were to become focused.  If the window
+   * already has the top-level focus, then this method returns the
+   * same component as getFocusOwner.  If no child component has
+   * requested focus within the window, then the initial focus owner
+   * is returned.  If this is a non-focusable window, this method
+   * returns null.
+   *
+   * @return the child component of this window that most recently had
+   * the focus, or <code>null</code>
+   * @since 1.4
+   */
+  public Component getMostRecentFocusOwner ()
+  {
+    return windowFocusOwner;
   }
 
   /**




More information about the kaffe mailing list