在 KDE 中将“保留窗口缩略图”设置为始终会“破坏最小化”?怎么办?

在 KDE 中将“保留窗口缩略图”设置为始终会“破坏最小化”?怎么办?

KDE 的桌面效果(合成)有一个设置,用于设置何时保留窗口缩略图。它说将其设置为始终“破坏最小化”。有人知道吗如何它会破坏最小化吗?

答案1

为了能够绘制窗口(屏幕外)以便创建缩略图,KWin 只是将它们显示为最小化,但实际上并非如此。

因此,就用户所能看到的而言,窗口被最小化了,但实际上并非如此。

这可能会给那些想要知道它们是否被最小化的应用程序带来问题,但实际上,选择此选项不会给您带来任何问题。

答案2

从 KDE 5.20 起,SDL 应用程序可以通过启用“保留窗口缩略图”来最小化/恢复事件:

// g++ main.cpp `pkg-config --cflags --libs sdl2`
#include <SDL.h>
#include <iostream>

#define CASE_STR( value ) case value: return #value; 
const char* sdlGetWindowEventString( Uint8 event )
{
    switch( event )
    {
    CASE_STR( SDL_WINDOWEVENT_NONE            )
    CASE_STR( SDL_WINDOWEVENT_SHOWN           )
    CASE_STR( SDL_WINDOWEVENT_HIDDEN          )
    CASE_STR( SDL_WINDOWEVENT_EXPOSED         )
    CASE_STR( SDL_WINDOWEVENT_MOVED           )
    CASE_STR( SDL_WINDOWEVENT_RESIZED         )
    CASE_STR( SDL_WINDOWEVENT_SIZE_CHANGED    )
    CASE_STR( SDL_WINDOWEVENT_MINIMIZED       )
    CASE_STR( SDL_WINDOWEVENT_MAXIMIZED       )
    CASE_STR( SDL_WINDOWEVENT_RESTORED        )
    CASE_STR( SDL_WINDOWEVENT_ENTER           )
    CASE_STR( SDL_WINDOWEVENT_LEAVE           )
    CASE_STR( SDL_WINDOWEVENT_FOCUS_GAINED    )
    CASE_STR( SDL_WINDOWEVENT_FOCUS_LOST      )
    CASE_STR( SDL_WINDOWEVENT_CLOSE           )
    CASE_STR( SDL_WINDOWEVENT_TAKE_FOCUS      )
    CASE_STR( SDL_WINDOWEVENT_HIT_TEST        )
    //CASE_STR( SDL_WINDOWEVENT_ICCPROF_CHANGED )
    //CASE_STR( SDL_WINDOWEVENT_DISPLAY_CHANGED )
    default: return "Unknown";
    }
}
#undef CASE_STR

int main( int argc, char** argv )
{
    SDL_Init( SDL_INIT_EVERYTHING );
    SDL_Window* window = SDL_CreateWindow
        (
        "SDL2",
         SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
         640, 480,
         SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE
        );
    

    bool running = true;
    while( running )
    {
        SDL_Surface* surface = SDL_GetWindowSurface( window );
        SDL_FillRect( surface, nullptr, SDL_MapRGB( surface->format, 127, 127, 127 ) );
        SDL_UpdateWindowSurface( window );

        SDL_Event ev;
        if( SDL_WaitEvent( &ev ) )
        {
            if( ( SDL_QUIT == ev.type ) ||
                ( SDL_KEYDOWN == ev.type && SDL_SCANCODE_ESCAPE == ev.key.keysym.scancode ) )
            {
                running = false;
                break;
            }
            
            if( SDL_WINDOWEVENT == ev.type )
            {
                std::cout << sdlGetWindowEventString( ev.window.event );
                std::cout << '\n';
            }
        }
        
    }

    SDL_DestroyWindow( window );
    SDL_Quit();
    return 0;
}

在最小化/恢复周期中注意:

  • SDL_WINDOWEVENT_HIDDEN
  • SDL_WINDOWEVENT_MINIMIZED
  • SDL_WINDOWEVENT_RESTORED
  • SDL_WINDOWEVENT_SHOWN

相关内容