Bugzilla – Attachment 964 Details for
Bug 7579
Dual head full screen from maximized on Windows doesn't work
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
test program
fstest.cc (text/x-c++src), 3.44 KB, created by
Pierre Ossman
on 2020-11-04 16:13:43 CET
(
hide
)
Description:
test program
Filename:
MIME Type:
Creator:
Pierre Ossman
Created:
2020-11-04 16:13:43 CET
Size:
3.44 KB
patch
obsolete
>#ifndef UNICODE >#define UNICODE >#endif > >#include <windows.h> >#include <stdio.h> > >LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); > >int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int nCmdShow) >{ > > // Register the window class. > const wchar_t CLASS_NAME[] = L"Sample Window Class"; > > WNDCLASS wc = { }; > > wc.lpfnWndProc = WindowProc; > wc.hInstance = hInstance; > wc.lpszClassName = CLASS_NAME; > > RegisterClass(&wc); > > // Create the window. > > HWND hwnd = CreateWindowEx( > 0, // Optional window styles. > CLASS_NAME, // Window class > L"Learn to Program Windows", // Window text > WS_OVERLAPPEDWINDOW, // Window style > > // Size and position > CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, > > NULL, // Parent window > NULL, // Menu > hInstance, // Instance handle > NULL // Additional application data > ); > > if (hwnd == NULL) > { > return 0; > } > > ShowWindow(hwnd, nCmdShow); > > // Run the message loop. > MSG msg = { }; > while (GetMessage(&msg, NULL, 0, 0)) > { > TranslateMessage(&msg); > DispatchMessage(&msg); > } > > return 0; >} > >BOOL fs = FALSE; > >DWORD oldFlags; >RECT oldRect; > >void enableFull(HWND hwnd) >{ > int X, Y, W, H; > int sx, sy, sw, sh; > > LONG ret; > > if (fs) > return; > > X = 0; > Y = 0; > W = 3840; > H = 1200; > > oldFlags = GetWindowLong(hwnd, GWL_STYLE); > if (oldFlags == 0) { > fprintf(stderr, "FAiled GetWindowLong()\n"); > return; > } > > ret = GetWindowRect(hwnd, &oldRect); > if (ret == 0) { > fprintf(stderr, "FAiled GetWindowRect()\n"); > return; > } > > DWORD flags = oldFlags; > > flags &= ~WS_CAPTION; > flags &= ~WS_THICKFRAME; > > ret = SetWindowLong(hwnd, GWL_STYLE, flags); > if (ret == 0) { > fprintf(stderr, "FAiled SetWindowLong()\n"); > return; > } > > ret = SetWindowPos(hwnd, HWND_TOP, X, Y, W, H, SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE); > > ret = SetWindowPos(hwnd, HWND_TOP, X, Y, W, H, 0); > if (ret == 0) { > fprintf(stderr, "FAiled SetWindowPos()\n"); > return; > } > > fs = TRUE; >} > >void disableFull(HWND hwnd) >{ > LONG ret; > > if (!fs) > return; > > ret = SetWindowLong(hwnd, GWL_STYLE, oldFlags); > if (ret == 0) { > fprintf(stderr, "FAiled SetWindowLong()\n"); > return; > } > ret = SetWindowPos(hwnd, 0, oldRect.left, oldRect.top, > oldRect.right - oldRect.left, > oldRect.bottom - oldRect.top, > SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED); > if (ret == 0) { > fprintf(stderr, "FAiled SetWindowPos)\n"); > return; > } > > fs = FALSE; >} > >LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) >{ > switch (uMsg) > { > case WM_DESTROY: > PostQuitMessage(0); > return 0; > > case WM_KEYUP: > { > if (wParam == VK_HOME) > enableFull(hwnd); > if (wParam == VK_END) > disableFull(hwnd); > } > break; > > case WM_PAINT: > { > PAINTSTRUCT ps; > HDC hdc = BeginPaint(hwnd, &ps); > > // All painting occurs here, between BeginPaint and EndPaint. > FillRect(hdc, &ps.rcPaint, (HBRUSH) (COLOR_WINDOW+1)); > EndPaint(hwnd, &ps); > } > return 0; > } > > return DefWindowProc(hwnd, uMsg, wParam, lParam); >} >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 7579
: 964