SpartanJ / ecode

Lightweight multi-platform code editor designed for modern hardware with a focus on responsiveness and performance.
MIT License
940 stars 13 forks source link

Menu is not in visible window if window is not maximized #242

Closed ghost closed 6 months ago

ghost commented 7 months ago

If you open ecode with a clean user profile (it's the first time you open it, or you deleted the config directory), it will open a fixed-size window that doesn't fill up the whole screen. If you click on the menu icon, the menu is not displayed in the visible window (part of it is outside of the visible window). You have to maximize the window to see the menu. Note: If you close ecode and open it again, it will remember the previous window size, so if you have maximized the window then you can't observe this.

SpartanJ commented 7 months ago

What's your screen resolution? Also can you share a screenshot? ecode does some logic to get the initial resolution on its first boot, but it's not that crazy:


    const Sizei desiredRes( 1280, 720 );
    Sizei defWinSize( desiredRes.getWidth(), desiredRes.getHeight() );
    if ( displaySize.getWidth() > desiredRes.getWidth() &&
         displaySize.getWidth() - desiredRes.getWidth() > 60 ) {
        defWinSize.setWidth( desiredRes.getWidth() );
    } else {
        defWinSize.setWidth( displaySize.getWidth() - 60 );
    }
    if ( displaySize.getHeight() > desiredRes.getHeight() &&
         displaySize.getHeight() - desiredRes.getHeight() > 60 ) {
        defWinSize.setHeight( desiredRes.getHeight() );
    } else {
        defWinSize.setHeight( displaySize.getHeight() - 60 );
    }
    windowState.size.setWidth( iniState.getValueI( "window", "width", defWinSize.getWidth() ) );
    windowState.size.setHeight( iniState.getValueI( "window", "height", defWinSize.getHeight() ) );
ghost commented 7 months ago

What's your screen resolution? Also can you share a screenshot? ecode does some logic to get the initial resolution on its first boot, but it's not that crazy:

  const Sizei desiredRes( 1280, 720 );
  Sizei defWinSize( desiredRes.getWidth(), desiredRes.getHeight() );
  if ( displaySize.getWidth() > desiredRes.getWidth() &&
       displaySize.getWidth() - desiredRes.getWidth() > 60 ) {
      defWinSize.setWidth( desiredRes.getWidth() );
  } else {
      defWinSize.setWidth( displaySize.getWidth() - 60 );
  }
  if ( displaySize.getHeight() > desiredRes.getHeight() &&
       displaySize.getHeight() - desiredRes.getHeight() > 60 ) {
      defWinSize.setHeight( desiredRes.getHeight() );
  } else {
      defWinSize.setHeight( displaySize.getHeight() - 60 );
  }
  windowState.size.setWidth( iniState.getValueI( "window", "width", defWinSize.getWidth() ) );
  windowState.size.setHeight( iniState.getValueI( "window", "height", defWinSize.getHeight() ) );

It seems you assumed 16:9. My screen is 16:10.

SpartanJ commented 7 months ago

It seems you assumed 16:9. My screen is 16:10.

That shouldn't matter, if the base desired size doesn't fit the coordinate it will take the display size width or height and subtract 60 pixels. I'm trying to think how this can fail and I don't see it.

Please can you answer the previous questions? That will help. Thanks

What's your screen resolution? Also can you share a screenshot?

ghost commented 7 months ago

What's your screen resolution?

1680x1050

ghost commented 7 months ago

Also can you share a screenshot?

Here you are:

Capture

Capture2

After reboot:

Capture3

SpartanJ commented 7 months ago

Oh, I didn't get what you were saying. Menu doesn't fit a small screen resolution. As a first step I'll fix the incorrect positioning of the menu, it should be completely visible. Thanks

SpartanJ commented 7 months ago

Latests changes should give you a menu that fits on the screen. "Window" submenu won't fix though, I'll clean up that later.