title: How do I set the window size to fit the contents in Jetpack Compose?
body: <p>I have some content which is exactly 500x500 pixels which I'd like to show in a window.</p>
  <p>If I set the window size via <code>state = WindowState(...)</code>, it seems to create a window where the size is actually slightly smaller, so the content gets cut off.</p>
  <p>Quick test app:</p>
  <pre class="lang-kotlin prettyprint-override"><code>fun main() = application {
      Window(onCloseRequest = ::exitApplication, state = WindowState(width = 500.dp, height = 500.dp), resizable = false) {
          Surface(color = Color.Black, modifier = Modifier.fillMaxSize()) {
              Canvas(modifier = Modifier.fillMaxSize()) {
                  withTransform(transformBlock = {
                      scale(500.0f, 500.0f, pivot = Offset.Zero)
                  }) {
                      drawLine(color = Color.Blue, start = Offset(0.0f, 0.0f), end = Offset(1.0f, 1.0f))
                      drawLine(color = Color.Blue, start = Offset(1.0f, 0.0f), end = Offset(0.0f, 1.0f))
                  }
              }
          }
      }
  }
  </code></pre>
  <p>The result is this window of outer size 486 x 493:</p>
  <p><a href="https://i.stack.imgur.com/oUNOy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oUNOy.png" alt="screenshot" /></a></p>
  <p>How do I do the equivalent of Swing's <code>pack()</code> to fit the window to the content?</p>