Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.advocacy > #262341
| From | Jeff-Relf.Me <@.> |
|---|---|
| Date | 2014-10-04 04:56 -0700 |
| Message-ID | <Jeff-Relf.Me@Oct.4{4.56A.Seattle.2014}> (permalink) |
| References | <IyDWv.296992$_u1.9408@fx30.am4> <542b0d09$0$1599$c3e8da3$e408f015@news.astraweb.com> <Jeff-Relf.Me@Oct.1{5.22A.Seattle.2014}> |
| Newsgroups | comp.os.linux.advocacy, uk.comp.os.linux, comp.os.linux.embedded |
| Subject | How does my code handle resolution changes, you ask ? |
| Organization | BWH Usenet NNTPSwitch-Cluster |
Cross-posted to 3 groups.
<PRE Style='White-Space: PRE !important; Font-Size: 18px !important;Font-Family: monospace !important;'>
Now that I have decent monitor arm ( Workrite Poise™ ),
I'm switching out of portrait mode more often.
[ Portrait is best for coding, text. Landscape is better for videos. ]
My monitor sensor tells my <CPU/GPU/"Dell Display Manager">
if it should switch to portrait or landscape.
My software ( Jeff-Relf.Me/X.CPP, Jeff-Relf.Me/Games.CPP ) adjusts,
but my video player ( ZoomPlayer ) doesn't ( it blocks the switch ).
So I use the following ( right·click·filename ) registry settings.
From "Jeff-Relf.Me/Win_8_.REG.TXT":
[HKEY_CLASSES_ROOT\MP4_File]
@=".MP4 file"
"FriendlyTypeName"=-
[HKEY_CLASSES_ROOT\MP4_File\shell]
@="Tall"
[-HKEY_CLASSES_ROOT\MP4_File\shell\Play]
[HKEY_CLASSES_ROOT\MP4_File\shell\Tall]
@="> Tall"
[HKEY_CLASSES_ROOT\MP4_File\shell\Tall\command]
@="C:\\__\\EXEs\\Zoom_Player\\zPlayer.EXE /X:0 /Y:2140 /W:2160 /H:1700 \"%1\""
[HKEY_CLASSES_ROOT\MP4_File\shell\Wide]
@="> Wide"
[HKEY_CLASSES_ROOT\MP4_File\shell\Wide\command]
@="C:\\__\\EXEs\\Zoom_Player\\zPlayer.EXE /X:1680 /Y:460 /W:2160 /H:1700 \"%1\""
; 1920*2 - 2160 1080*2 - 1700
Now that I'm watching more HD ( 1080p ) videos in fullscreen mode,
landscape ( 2*1920 x 2*1080 pixels ), I noticed some tearing.
The solution was:
Turn off the monitor's "DisplayPort 1.2" setting --
so my CPU/GPU only has to display 29 frames per second ( 29 Hz ).
Videos look wonderful, no jitter at all... smooth as silk.
How does my code[*] handle resolution changes, you ask ?
[ *: Jeff-Relf.Me/Games.EXE, < Jeff-Relf.Me/X.HTM, Jeff-Relf.Me/X.EXE > ]
From "Jeff-Relf.Me/X.CPP":
// WM_NCACTIVATE happens with an app loses/gains focus.
// WM_DISPLAYCHANGE happens when the resolution of the monitor changes.
// WM_DEVICECHANGE happens when the monitor is turned off or on...
// and, oddly, that means the screen resolution is changing.
if ( WM == WM_DISPLAYCHANGE || WM == WM_DEVICECHANGE ) { NewWin = 1, ScanEnv(), PrintReq = 1; }
if ( WM == WM_NCACTIVATE ) {
if ( Running = C&3 ) { ScanEnv(), ShowWindow( Win, SW_SHOWNORMAL ), SetForegroundWindow(Win), PrintReq = 1; }
else { ShowWindow( Win, SW_SHOWMINIMIZED ), EnterDwn = Ctrl·Dwn = LD = MD = RD = PrintReq = 0 ; goto Done; } } }
............. ScanEnv() ..........
if ( !Win ) { Win = CreateWindow( L"WinProc", L"", WS_POPUP, 0,0,0,0, 0, 0, PID, 0 );
D2D1CreateFactory( D2D1_FACTORY_TYPE_SINGLE_THREADED, __uuidof(ID2D1Factory1), &DebugLevel, (Void·P *)&Direct2D );
DWriteCreateFactory( DWRITE_FACTORY_TYPE_SHARED, __uuidof(Direct2D_Text), (IUnknown **)&Direct2D_Text );
Direct2D_Text->GetSystemFontCollection( &SysFonts ), Direct2D_Text->CreateTextAnalyzer( &SysGlyphWH );
CoCreateInstance( CLSID_WICImagingFactory, 0, CLSCTX_INPROC_SERVER, IID_PPV_ARGS( &Direct2D_JPG ) );
D3D11CreateDevice( 0, D3D_DRIVER_TYPE_HARDWARE, 0, D3D11_CREATE_DEVICE_BGRA_SUPPORT, 0, 0, D3D11_SDK_VERSION, &_GPU_3D, 0, &_Draw3D );
_GPU_3D->QueryInterface( __uuidof(GPU_3D), (Void·P *)&GPU_3D );
GPU_3D->QueryInterface( __uuidof(IDXGIDevice), (Void·P *)&_GPU_2D ), Direct2D->CreateDevice( _GPU_2D, &GPU_2D );
_GPU_2D->GetAdapter( &GPU ), GPU->GetParent( IID_PPV_ARGS( &_GPU ) ); }
ScrW = ScrRight = GetSystemMetrics( SM_CXSCREEN ), ScrH = ScrBot = GetSystemMetrics( SM_CYSCREEN );
ScrLeft = ScrTop = 0, WinLeft = ScrLeft, WinRight = ScrRight, WinBot = ScrBot, WinTop = ScrTop ;
int Left, Top, TBW = TB.right - TB.left, TBH = TB.bottom - TB.top, Tall = TBH > TBW ;
if ( Tall ) { if ( Left = TB.right < ScrW / 2 ) WinLeft = TB.right + 1 ; else WinRight = TB.left - 1 ; }
else if ( Top = TB.bottom < ScrH / 2 ) WinTop = TB.bottom + 1 ; else WinBot = TB.top - 1 ;
WinW = WinRight - WinLeft, WinH = WinBot - WinTop ;
SetWindowPos( Win, HWND_TOP, WinLeft, WinTop, WinW, WinH, 0 );
ShowWindow( Win, SW_SHOWNORMAL ), SetForegroundWindow( Win ); // Without this, Win8 chrashes.
// Master (below) is the "Device Context" ( an old, Win32, GDI+ term ).
Trash( DrawSur ), Trash( Flip ), Trash( Master );
GPU_2D->CreateDeviceContext( D2D1_DEVICE_CONTEXT_OPTIONS_NONE, &Master );
Master->SetUnitMode( D2D1_UNIT_MODE_PIXELS );
Master->CreateSolidColorBrush( ColorF( 0, 0, 0, 0 ), &bg·Clear );
_GPU->CreateSwapChainForHwnd( GPU_3D, Win, &Flipper, 0, 0, &Flip );
Flip->GetBuffer( 0, IID_PPV_ARGS( &__DrawSur ) );
Master->CreateBitmapFromDxgiSurface( __DrawSur, 0, &DrawSur );
Trash( __DrawSur ); // Without this, Win8 chrashes.
Set( bg·Black, 0, 0, 0 ), _bg·Black = *(ColorF*)&bg·Black->GetColor();
Set( bg·Sel, 26, 0, 44 ), Set( bg·A0, 22, 22, 22 ); Set( fg[ text·fgi ], 88, 44, 66 );
Set( fg[ digit·fgi ], 88, 33, 88 ), Set( fg[ verb·fgi ], 66, 66, 66 ), Set( fg[ UTF·fgi ], 11, 77, 99 );
Set( fg[ OldText·fgi ], 88, 11, 0 ), Set( fg[ NewText·fgi ], 11, 88, 0 ), Set( fg[ TBtext·fgi ], 88, 33, 0 );
Master->BeginDraw(), Master->SetTarget( DrawSur ), Master->Clear( _bg·Black ), SetCursor( LoadCursor( 0, IDC_ARROW ) );
Back to comp.os.linux.advocacy | Previous | Next — Previous in thread | Find similar
Now I stay reclined, relaxed. Jeff-Relf.Me <@.> - 2014-10-01 05:22 -0700 How does my code handle resolution changes, you ask ? Jeff-Relf.Me <@.> - 2014-10-04 04:56 -0700
csiph-web