aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorWolfgang Draxinger <Wolfgang.Draxinger@draxit.de>2014-06-01 23:49:53 +0200
committerWolfgang Draxinger <Wolfgang.Draxinger@draxit.de>2014-06-01 23:49:53 +0200
commit499414520fb55d1ef5ec16eba9eb1b3f7ee2e19a (patch)
treed6c535cc7fc56894142253398756c3016c1b04e4 /test
parent8cbe61ccd8e02d5fbdb7ccbe1ebaa1d01af63dc3 (diff)
downloadwglarb-499414520fb55d1ef5ec16eba9eb1b3f7ee2e19a.tar.gz
wglarb-499414520fb55d1ef5ec16eba9eb1b3f7ee2e19a.tar.bz2
static scope for compilation unit private functions
Diffstat (limited to 'test')
-rw-r--r--test/Makefile28
-rw-r--r--test/layered.c61
-rw-r--r--test/layered.rc2
-rw-r--r--test/manifest21
4 files changed, 49 insertions, 63 deletions
diff --git a/test/Makefile b/test/Makefile
index cd497b0..059b790 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1,13 +1,27 @@
-TARGET=x86_64-w64-mingw32
-CC=-$(TARGET)-gcc
+TARGET64=x86_64-w64-mingw32
+TARGET32=mingw32
+CC64=-$(TARGET64)-gcc
+CC32=-$(TARGET32)-gcc
CFLAGS=-static-libgcc -static-libstdc++ -I..
LIBS=-lopengl32 -lgdi32 -lkernel32
-WINDRES=$(TARGET)-windres
+WINDRES64=$(TARGET64)-windres
+WINDRES32=$(TARGET32)-windres
-layered.exe: layered.c layered_rc.o
- $(CC) $(CFLAGS) -o layered.exe layered.c layered_rc.o ../wglarb.c $(LIBS) -Wl,--subsystem,windows
+.PHONY: all
+all: layered64.exe layered32.exe
+
+layered64.exe: layered.c layered64_rc.o
+ $(CC64) $(CFLAGS) -o layered64.exe layered.c layered64_rc.o ../wglarb.c $(LIBS) -Wl,--subsystem,windows
+
+layered32.exe: layered.c layered32_rc.o
+ $(CC32) $(CFLAGS) -o layered32.exe layered.c layered32_rc.o ../wglarb.c $(LIBS) -Wl,--subsystem,windows
+
+
+layered64_rc.o: layered.rc manifest.xml
+ $(WINDRES64) --input layered.rc --output layered64_rc.o
+
+layered32_rc.o: layered.rc manifest.xml
+ $(WINDRES32) --input layered.rc --output layered32_rc.o
-layered_rc.o: layered.rc manifest
- $(WINDRES) --input layered.rc --output layered_rc.o
diff --git a/test/layered.c b/test/layered.c
index 7a83da0..80f25cf 100644
--- a/test/layered.c
+++ b/test/layered.c
@@ -72,7 +72,6 @@ HWND OpenGLWindowCreate(
rect.bottom = CW_USEDEFAULT;
}
- fprintf(stderr, "creating proper window...\n");
HWND hWnd =
CreateWindowEx(
dwExStyle,
@@ -87,14 +86,12 @@ HWND OpenGLWindowCreate(
NULL,
hInstance,
NULL);
-
if(!hWnd) {
return NULL;
}
SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)ViewProc);
- fprintf(stderr, "retrieving proper DC...\n");
HDC hDC = GetDC(hWnd);
if(!hDC) {
fprintf(stderr, "error retrieving proper DC\n");
@@ -119,7 +116,6 @@ HWND OpenGLWindowCreate(
};
INT iPF;
- fprintf(stderr, "choosing proper pixelformat...\n");
UINT num_formats_choosen;
if( !wglarb_ChoosePixelFormatARB(
hDC,
@@ -142,7 +138,6 @@ HWND OpenGLWindowCreate(
* sane, we're nice people after all - it doesn't hurt if this fails. */
DescribePixelFormat(hDC, iPF, sizeof(pfd), &pfd);
- fprintf(stderr, "setting proper pixelformat...\n");
if( !SetPixelFormat(hDC, iPF, &pfd) ) {
fprintf(stderr, "error setting proper pixel format\n");
ReleaseDC(hWnd, hDC);
@@ -151,7 +146,6 @@ HWND OpenGLWindowCreate(
return NULL;
}
- fprintf(stderr, "creating proper OpenGL context...\n");
int context_attribs[] = {
WGL_CONTEXT_MAJOR_VERSION_ARB, 2,
WGL_CONTEXT_MINOR_VERSION_ARB, 1,
@@ -166,27 +160,20 @@ HWND OpenGLWindowCreate(
}
ReleaseDC(hWnd, hDC);
-#if 1
- if( !(dwStyle & WS_CHILD) ) {
- if( hDwmAPI_DLL ) {
- if( impl_DwmEnableBlurBehindWindow ) {
- DWM_BLURBEHIND bb = {0};
- bb.dwFlags = DWM_BB_ENABLE;
- bb.fEnable = TRUE;
- bb.hRgnBlur = NULL;
- impl_DwmEnableBlurBehindWindow(hWnd, &bb);
- }
-
- if( impl_DwmExtendFrameIntoClientArea ) {
- MARGINS margins = {-1};
- impl_DwmExtendFrameIntoClientArea(hWnd, &margins);
- }
+ if( hDwmAPI_DLL ) {
+ if( impl_DwmEnableBlurBehindWindow ) {
+ DWM_BLURBEHIND bb = {0};
+ bb.dwFlags = DWM_BB_ENABLE;
+ bb.fEnable = TRUE;
+ bb.hRgnBlur = NULL;
+ impl_DwmEnableBlurBehindWindow(hWnd, &bb);
}
- else {
- SetLayeredWindowAttributes(hWnd, 0, 0xff, LWA_ALPHA);
+
+ if( impl_DwmExtendFrameIntoClientArea ) {
+ MARGINS margins = {-1};
+ impl_DwmExtendFrameIntoClientArea(hWnd, &margins);
}
}
-#endif
return hWnd;
@@ -309,17 +296,23 @@ int main(int argc, char *argv[])
MSG msg;
BOOL bRet;
- hDwmAPI_DLL = LoadLibrary("dwmapi.dll");
- if( hDwmAPI_DLL ) {
- impl_DwmEnableBlurBehindWindow =
- (procp_DwmEnableBlurBehindWindow)
- GetProcAddress(hDwmAPI_DLL, "DwmEnableBlurBehindWindow");
-
- impl_DwmExtendFrameIntoClientArea =
- (procp_DwmExtendFrameIntoClientArea)
- GetProcAddress(hDwmAPI_DLL, "DwmExtendFrameIntoClientArea");
- }
+ OSVERSIONINFO os_vinfo;
+ memset(&os_vinfo, 0, sizeof(os_vinfo));
+ os_vinfo.dwOSVersionInfoSize = sizeof(os_vinfo);
+ GetVersionEx(&os_vinfo);
+ if( 6 <= os_vinfo.dwMajorVersion ) {
+ hDwmAPI_DLL = LoadLibrary("dwmapi.dll");
+ if( hDwmAPI_DLL ) {
+ impl_DwmEnableBlurBehindWindow =
+ (procp_DwmEnableBlurBehindWindow)
+ GetProcAddress(hDwmAPI_DLL, "DwmEnableBlurBehindWindow");
+
+ impl_DwmExtendFrameIntoClientArea =
+ (procp_DwmExtendFrameIntoClientArea)
+ GetProcAddress(hDwmAPI_DLL, "DwmExtendFrameIntoClientArea");
+ }
+ }
HWND hWndGL = OpenGLWindowCreate(
"Test", "TestWnd",
diff --git a/test/layered.rc b/test/layered.rc
index 187387c..7c46d6e 100644
--- a/test/layered.rc
+++ b/test/layered.rc
@@ -1,3 +1,3 @@
#include "winuser.h"
-CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST manifest
+CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST manifest.xml
diff --git a/test/manifest b/test/manifest
deleted file mode 100644
index f8b9bdc..0000000
--- a/test/manifest
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
-
- <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
- <application>
- <!--This Id value indicates the application supports Windows Vista functionality -->
- <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
- <!--This Id value indicates the application supports Windows 7 functionality-->
- <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
- <!--This Id value indicates the application supports Windows 8 functionality-->
- <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
- <!--This Id value indicates the application supports Windows 8.1 functionality-->
- <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
- </application>
- </compatibility>
-
- <assemblyIdentity type="win32"
- name="datenwolf.codesamples.wglarb_test_layered"
- version="0.0.0.1"
- />
-</assembly>