Browse Source

oops, implicit size determination didn't work in embedded mode

David Rose 16 years ago
parent
commit
71bc1c3965
1 changed files with 14 additions and 8 deletions
  1. 14 8
      direct/src/plugin/p3dOsxSplashWindow.cxx

+ 14 - 8
direct/src/plugin/p3dOsxSplashWindow.cxx

@@ -267,14 +267,6 @@ paint_window() {
   //  Flip the y axis so that positive Y points down
   //  Flip the y axis so that positive Y points down
   CGContextScaleCTM(context, 1.0, -1.0);
   CGContextScaleCTM(context, 1.0, -1.0);
 
 
-  int width = port_rect.right - port_rect.left;
-  int height = port_rect.bottom - port_rect.top;
-  if (width != _win_width || height != _win_height) {
-    _win_width = width;
-    _win_height = height;
-    set_button_range(_button_ready_image);
-  }
-
   // Clear the whole region to white before beginning.
   // Clear the whole region to white before beginning.
   CGRect region = { { 0, 0 }, { _win_width, _win_height } };
   CGRect region = { { 0, 0 }, { _win_width, _win_height } };
 
 
@@ -550,6 +542,20 @@ event_callback(EventHandlerCallRef my_handler, EventRef event) {
       // If the window changes size, we have to repaint it.
       // If the window changes size, we have to repaint it.
       refresh();
       refresh();
 
 
+      // Also determine the new size.
+      {
+        Rect port_rect;
+        GrafPtr out_port = GetWindowPort(_toplevel_window);
+        GetPortBounds(out_port, &port_rect);
+        int width = port_rect.right - port_rect.left;
+        int height = port_rect.bottom - port_rect.top;
+        if (width != _win_width || height != _win_height) {
+          _win_width = width;
+          _win_height = height;
+          set_button_range(_button_ready_image);
+        }
+      }
+
       // We seem to get the mouse-down, but lose the mouse-up, event
       // We seem to get the mouse-down, but lose the mouse-up, event
       // in this case, so infer it.
       // in this case, so infer it.
       set_mouse_data(_mouse_x, _mouse_y, false);
       set_mouse_data(_mouse_x, _mouse_y, false);