Restore from minimized broken in Vista (2 Viewers)

tourettes

Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    OnSizeChanged() is always triggered by the Windows framework.
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    OK, then I guess you could put an IF _fromTray, or something in it?

    I'm not a coder, so...

    In theory that could solve the issue, but I don't have enough knowlegde on the DirectX itself so I could judge if that will create some odd side effects. I.e. need to reinitialize D3D device might be still there.

    All changes related to that restore from tray should be done earliest at after 1.0.1 is out as we could break something really easialy when fixing the non-targeted use case for HTPC application.

    But please feel free to experiment and post a patch when all issues are solved :p Currently I have no free time available for this issue, sorry.
     

    Swede

    Portal Pro
    September 6, 2006
    493
    47
    West Coast Archipelago
    Home Country
    Sweden Sweden
    Well, if you have Vista, try minimize/restore in:

    - TVguide: your TV logos that are not png's dissappear. The png's have been packed so they are visable.

    - Settings/General: picture of skin dissappears and skin, language, fullscreen and screensaver setting resets to null?. (This also happens in both Vista and XP, when window->fullscreen!!!)

    - Videos/Filmstrip: First minimize = OK, a few more minimize/restore gives blank page. Only 2 textures from top bar shows.

    - TV Series: Overlay texture dissappears.

    This error in log:
    [Info.][MPMain]: render exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
    at MediaPortal.GUI.Library.GUIImage.FontEngineDrawTexture(Int32 textureNo, Single x, Single y, Single nw, Single nh, Single uoff, Single voff, Single umax, Single vmax, Int32 color, Single[,] matrix)
    at MediaPortal.GUI.Library.GUIImage.Render(Single timePassed)
    at MediaPortal.GUI.Library.GUIControl.DoRender(Single timePassed, UInt32 currentTime)
    at MediaPortal.GUI.Library.GUIWindow.Render(Single timePassed)


    The restore takes about 3 sec.

    Probably a lot more... and none of this is happening in minimize/restore with my previously posted MediaPortal.exe.
     

    Swede

    Portal Pro
    September 6, 2006
    493
    47
    West Coast Archipelago
    Home Country
    Sweden Sweden
    OK, now I have done a working solution. How to do a patch?

    Code:
        /// Handles the OnSizeChanged event, which isn't the same as the resize event.
        /// </summary>
        /// <param name="e">Event arguments</param>
        protected override void OnSizeChanged(EventArgs e)
        {
            if (_fromTray == false) 
        {
                if (GUIGraphicsContext.IsDirectX9ExUsed() && this.Visible && !_resizeOngoing && !_toggleFullWindowed &&
              !_ignoreNextResizeEvent && this.WindowState == _windowState)
                {
                   Log.Info("Main: OnSizeChanged - Resetting device");
                 [COLOR="DarkRed"]GUITextureManager.CleanupThumbs(); //swede
                 GUITextureManager.Dispose();//swede
                 GUIFontManager.Dispose();//swede
                 Log.Info("swede: Onsizechanged");[/COLOR]
                 SwitchFullScreenOrWindowed(false);
                 OnDeviceReset(null, null);
                }
        } 
          base.OnSizeChanged(e);
        }
          
        /// <summary>
        /// Handle OnResizeBegin
        /// </summary>
        protected override void OnResizeBegin(EventArgs e)
        {
          if (GUIGraphicsContext.IsDirectX9ExUsed())
          {
            _resizeOngoing = true;
            _clientSize = ClientSize;
    [COLOR="darkred"]        GUITextureManager.CleanupThumbs(); //swede
            GUITextureManager.Dispose();//swede
            GUIFontManager.Dispose();//swede
            Log.Info("swede: OnResizebegin");[/COLOR]
     

    Attachments

    • MediaPortal.zip
      30.6 KB

    misterd

    Retired Team Member
  • Premium Supporter
  • April 4, 2006
    1,597
    314
    Home Country
    Germany Germany
    There are two events OnSizeChanged and OnResizeChanged. The problem is that OnResizeChanged isn't called on all circumstances. IIRC one these situations is when change the skin in the MP gui.
    So probably this patch would break another situation.

    MisterD
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    Please test following change. Add two lines in MediaPortal.cs:

    Code:
    protected override void OnDeviceReset(Object sender, EventArgs e)
    {
          Log.Info("Main: Resetting DX9 device");
    
          GUITextureManager.Dispose();       // <--- added
          GUIFontManager.Dispose();           // <--- added
     

    Swede

    Portal Pro
    September 6, 2006
    493
    47
    West Coast Archipelago
    Home Country
    Sweden Sweden
    Please test following change. Add two lines in MediaPortal.cs:

    Code:
    protected override void OnDeviceReset(Object sender, EventArgs e)
    {
          Log.Info("Main: Resetting DX9 device");
    
          GUITextureManager.Dispose();       // <--- added
          GUIFontManager.Dispose();           // <--- added

    Yes, that works nicely, especially together with this in d3dapp.cs, since resetting is not needed when restoring from tray. Restore is much quicker this way:
    Code:
       protected override void OnSizeChanged(EventArgs e)
        {
            if (_fromTray == false)        // <--- added

    Still issues in general settings when Fullscreen/Windowed toggles, but who cares :p
     

    Users who are viewing this thread

    Top Bottom