diff options
-rw-r--r-- | test/Makefile | 2 | ||||
-rw-r--r-- | test/layered.c | 34 | ||||
-rw-r--r-- | wglarb.c | 22 |
3 files changed, 42 insertions, 16 deletions
diff --git a/test/Makefile b/test/Makefile index 2b5a0b7..94f3058 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,5 +1,5 @@ TARGET64=x86_64-w64-mingw32 -TARGET32=i686-w64-mingw32 +TARGET32=mingw32 CC64=-$(TARGET64)-gcc CC32=-$(TARGET32)-gcc CFLAGS=-static-libgcc -static-libstdc++ -I.. diff --git a/test/layered.c b/test/layered.c index f28c677..3c359e1 100644 --- a/test/layered.c +++ b/test/layered.c @@ -24,6 +24,11 @@ procp_DwmEnableBlurBehindWindow impl_DwmEnableBlurBehindWindow = NULL; typedef HRESULT (WINAPI *procp_DwmExtendFrameIntoClientArea)(HWND, MARGINS const*);
procp_DwmExtendFrameIntoClientArea impl_DwmExtendFrameIntoClientArea = NULL;
+typedef HRESULT (WINAPI *procp_DwmGetColorizationColor)(DWORD*,BOOL*);
+procp_DwmGetColorizationColor impl_DwmGetColorizationColor = NULL;
+
+float bg_color[3];
+
int win_width;
int win_height;
@@ -199,8 +204,27 @@ BOOL cursor_needs_setting = TRUE; LRESULT CALLBACK ViewProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
+ DWORD bgcol;
+ BOOL opaque;
switch(uMsg)
{
+ case WM_CREATE:
+ case WM_DWMNCRENDERINGCHANGED:
+ if( impl_DwmGetColorizationColor ) {
+ impl_DwmGetColorizationColor(&bgcol, &opaque);
+ if( opaque ) {
+ bg_color[0] = (float)GetRValue(bgcol)/255.f;
+ bg_color[1] = (float)GetGValue(bgcol)/255.f;
+ bg_color[2] = (float)GetBValue(bgcol)/255.f;
+ }
+ else {
+ bg_color[0] = 0.f;
+ bg_color[1] = 0.f;
+ bg_color[2] = 0.f;
+ }
+ }
+ break;
+
case WM_MOUSELEAVE:
cursor_needs_setting = TRUE;
break;
@@ -227,7 +251,6 @@ LRESULT CALLBACK ViewProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) return DefWindowProc(hWnd,uMsg,wParam,lParam);
}
-
void display(HWND hWnd)
{
HDC hDC = GetDC(hWnd);
@@ -243,7 +266,11 @@ void display(HWND hWnd) rect.right,
rect.bottom);
- glClearColor(0., 0., 0., 0.);
+ glClearColor(
+ bg_color[0],
+ bg_color[1],
+ bg_color[2],
+ 0.);
glClearDepth(1.);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -309,6 +336,9 @@ int main(int argc, char *argv[]) *(PROC*)(&impl_DwmExtendFrameIntoClientArea) =
GetProcAddress(hDwmAPI_DLL, "DwmExtendFrameIntoClientArea");
+
+ *(PROC*)(&impl_DwmGetColorizationColor) =
+ GetProcAddress(hDwmAPI_DLL, "DwmGetColorizationColor");
}
}
@@ -48,21 +48,17 @@ static DWORD wglarb_intermediary_lock(void) /* //// FINISH \\\\ */ - if( dst_mutex ) { - /* In this case we lost the race and another thread - * beat this thread in creating a mutex object. - * Clean up and wait for the proper mutex. */ - ReleaseMutex(new_mutex); - CloseHandle(new_mutex); - goto wait_for_mutex; + if( !dst_mutex ) { + /* mutex created in one time initialization and held + * by calling thread. Return signaled status. */ + return WAIT_OBJECT_0; } - - /* mutex created in one time initialization and hold - * by calling thread. Return signaled status. */ - return WAIT_OBJECT_0; + /* In this case we lost the race and another thread + * beat this thread in creating a mutex object. + * Clean up and wait for the proper mutex. */ + ReleaseMutex(new_mutex); + CloseHandle(new_mutex); } - -wait_for_mutex: return WaitForSingleObject(wglarb_intermediary_mutex, INFINITE); } |