/[classpath]/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java
ViewVC logotype

Diff of /classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.72 by mkoch, Fri Oct 8 21:41:41 2004 UTC revision 1.73 by mkoch, Fri Oct 8 22:16:09 2004 UTC
# Line 99  public class GtkComponentPeer extends Gt Line 99  public class GtkComponentPeer extends Gt
99    native void gtkWidgetRequestFocus ();    native void gtkWidgetRequestFocus ();
100    native void gtkWidgetDispatchKeyEvent (int id, long when, int mods,    native void gtkWidgetDispatchKeyEvent (int id, long when, int mods,
101                                           int keyCode, int keyLocation);                                           int keyCode, int keyLocation);
102    native void gtkWidgetRepaintArea(int x, int y, int width, int height);  
103      native boolean isRealized ();
104    
105    void create ()    void create ()
106    {    {
# Line 117  public class GtkComponentPeer extends Gt Line 118  public class GtkComponentPeer extends Gt
118    
119      create ();      create ();
120    
     setParent ();  
   
     connectJObject ();  
121      connectSignals ();      connectSignals ();
122    
123      if (awtComponent.getForeground () != null)      if (awtComponent.getForeground () != null)
# Line 129  public class GtkComponentPeer extends Gt Line 127  public class GtkComponentPeer extends Gt
127      if (awtComponent.getFont() != null)      if (awtComponent.getFont() != null)
128        setFont(awtComponent.getFont());        setFont(awtComponent.getFont());
129    
130      setCursor (awtComponent.getCursor ());      Component parent = awtComponent.getParent ();
131    
132        // Only set our parent on the GTK side if our parent on the AWT
133        // side is not showing.  Otherwise the gtk peer will be shown
134        // before we've had a chance to position and size it properly.
135        if (awtComponent instanceof Window
136            || (parent != null && ! parent.isShowing ()))
137          setParentAndBounds ();
138      }
139    
140      void setParentAndBounds ()
141      {
142        setParent ();
143    
144      setComponentBounds ();      setComponentBounds ();
145    
# Line 171  public class GtkComponentPeer extends Gt Line 181  public class GtkComponentPeer extends Gt
181    void setComponentBounds ()    void setComponentBounds ()
182    {    {
183      Rectangle bounds = awtComponent.getBounds ();      Rectangle bounds = awtComponent.getBounds ();
184    
185        if (bounds.x == 0 && bounds.y == 0
186            && bounds.width == 0 && bounds.height == 0)
187          return;
188    
189      setBounds (bounds.x, bounds.y, bounds.width, bounds.height);      setBounds (bounds.x, bounds.y, bounds.width, bounds.height);
190    }    }
191    
# Line 365  public class GtkComponentPeer extends Gt Line 380  public class GtkComponentPeer extends Gt
380    
381    public void repaint (long tm, int x, int y, int width, int height)    public void repaint (long tm, int x, int y, int width, int height)
382    {    {
383      beginNativeRepaint ();      if (x == 0 && y == 0 && width == 0 && height == 0)
384      gtkWidgetRepaintArea (x, y, width, height);        return;
385      endNativeRepaint ();  
386      q.postEvent (new PaintEvent (awtComponent, PaintEvent.UPDATE,      q.postEvent (new PaintEvent (awtComponent, PaintEvent.UPDATE,
387                                   new Rectangle (x, y, width, height)));                                   new Rectangle (x, y, width, height)));
388    }    }
# Line 436  public class GtkComponentPeer extends Gt Line 451  public class GtkComponentPeer extends Gt
451        setNativeBounds (x, y, width, height);        setNativeBounds (x, y, width, height);
452    }    }
453    
454      void setCursor ()
455      {
456        setCursor (awtComponent.getCursor ());
457      }
458    
459    public void setCursor (Cursor cursor)    public void setCursor (Cursor cursor)
460    {    {
461      gtkWidgetSetCursor (cursor.getType ());      gtkWidgetSetCursor (cursor.getType ());

Legend:
Removed from v.1.72  
changed lines
  Added in v.1.73

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26