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

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

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

revision 1.25.2.7 by gnu_andrew, Tue Aug 2 20:12:09 2005 UTC revision 1.25.2.8 by gnu_andrew, Sat Sep 10 15:31:37 2005 UTC
# Line 44  import java.awt.Image; Line 44  import java.awt.Image;
44  import java.awt.MenuBar;  import java.awt.MenuBar;
45  import java.awt.Rectangle;  import java.awt.Rectangle;
46  import java.awt.Window;  import java.awt.Window;
47    import java.awt.event.ComponentEvent;
48  import java.awt.event.PaintEvent;  import java.awt.event.PaintEvent;
49  import java.awt.image.ColorModel;  import java.awt.image.ColorModel;
50  import java.awt.peer.FramePeer;  import java.awt.peer.FramePeer;
# Line 55  public class GtkFramePeer extends GtkWin Line 56  public class GtkFramePeer extends GtkWin
56    private int menuBarHeight;    private int menuBarHeight;
57    private MenuBarPeer menuBar;    private MenuBarPeer menuBar;
58    native int getMenuBarHeight (MenuBarPeer bar);    native int getMenuBarHeight (MenuBarPeer bar);
59      native void setMenuBarWidthUnlocked (MenuBarPeer bar, int width);
60    native void setMenuBarWidth (MenuBarPeer bar, int width);    native void setMenuBarWidth (MenuBarPeer bar, int width);
61    native void setMenuBarPeer (MenuBarPeer bar);    native void setMenuBarPeer (MenuBarPeer bar);
62    native void removeMenuBarPeer ();    native void removeMenuBarPeer ();
# Line 117  public class GtkFramePeer extends GtkWin Line 119  public class GtkFramePeer extends GtkWin
119    
120    public void setBounds (int x, int y, int width, int height)    public void setBounds (int x, int y, int width, int height)
121    {    {
122        // prevent window_configure_cb -> awtComponent.setSize ->
123        // peer.setBounds -> nativeSetBounds self-deadlock on GDK lock.
124        if (Thread.currentThread() == GtkToolkit.mainThread)
125          {
126            int menuBarWidth = width - insets.left - insets.right;
127            if (menuBar != null && menuBarWidth > 0)
128              setMenuBarWidthUnlocked (menuBar, menuBarWidth);
129    
130            return;
131          }
132    
133      int menuBarWidth = width - insets.left - insets.right;      int menuBarWidth = width - insets.left - insets.right;
134      if (menuBar != null && menuBarWidth > 0)      if (menuBar != null && menuBarWidth > 0)
135        setMenuBarWidth (menuBar, menuBarWidth);        setMenuBarWidth (menuBar, menuBarWidth);
# Line 192  public class GtkFramePeer extends GtkWin Line 205  public class GtkFramePeer extends GtkWin
205        
206    protected void postConfigureEvent (int x, int y, int width, int height)    protected void postConfigureEvent (int x, int y, int width, int height)
207    {    {
     int frame_x = x - insets.left;  
     // Since insets.top includes the MenuBar height, we need to add back  
     // the MenuBar height to the frame's y position.  
     // If no MenuBar exists in this frame, the MenuBar height will be 0.  
     int frame_y = y - insets.top + menuBarHeight;  
208      int frame_width = width + insets.left + insets.right;      int frame_width = width + insets.left + insets.right;
209      // Ditto as above. Since insets.top already includes the MenuBar's height,      // Since insets.top already includes the MenuBar's height, we need
210      // we need to subtract the MenuBar's height from the top inset.      // to subtract the MenuBar's height from the top inset.
211      int frame_height = height + insets.top + insets.bottom - menuBarHeight;      int frame_height = height + insets.top + insets.bottom - menuBarHeight;
212      if (frame_x != awtComponent.getX()  
213          || frame_y != awtComponent.getY()      if (frame_width != awtComponent.getWidth()
         || frame_width != awtComponent.getWidth()  
214          || frame_height != awtComponent.getHeight())          || frame_height != awtComponent.getHeight())
215        {        awtComponent.setSize(frame_width, frame_height);
216          if (frame_width != awtComponent.getWidth() && menuBar != null  
217              && width > 0)      int frame_x = x - insets.left;
218            setMenuBarWidth (menuBar, width);      // Likewise, since insets.top includes the MenuBar height, we need
219        // to add back the MenuBar height to the frame's y position.  If
220          setBoundsCallback ((Window) awtComponent,      // no MenuBar exists in this frame, the MenuBar height will be 0.
221                             frame_x,      int frame_y = y - insets.top + menuBarHeight;
                            frame_y,  
                            frame_width,  
                            frame_height);  
222    
223          awtComponent.validate();      if (frame_x != awtComponent.getX()
224            || frame_y != awtComponent.getY())
225          {
226            // awtComponent.setLocation(frame_x, frame_y);
227        }        }
228    }    }
229    
# Line 251  public class GtkFramePeer extends GtkWin Line 258  public class GtkFramePeer extends GtkWin
258    {    {
259    
260    }    }
261      public void setBoundsPrivate(int x, int y, int width, int height)
262      {
263        // TODO Auto-generated method stub
264        
265      }
266      public void updateAlwaysOnTop()
267      {
268        // TODO Auto-generated method stub
269        
270      }
271      public boolean requestWindowFocus()
272      {
273        // TODO Auto-generated method stub
274        return false;
275      }
276  }  }
277    
278    

Legend:
Removed from v.1.25.2.7  
changed lines
  Added in v.1.25.2.8

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