]> git.cworth.org Git - apitrace/blobdiff - retrace/glws_wgl.cpp
Combine timeline and histogram tabs.
[apitrace] / retrace / glws_wgl.cpp
index efefff0e1e784faef84ba4928f7f9e0d64bcf068..c6e4a3fb39b1935e3c29a2a806fdcf007250f211 100644 (file)
@@ -54,9 +54,9 @@ namespace glws {
  * See also:
  * - http://www.opengl.org/archives/resources/faq/technical/mswindows.htm
  */
-static __PFNWGLCHOOSEPIXELFORMAT pfnChoosePixelFormat = &ChoosePixelFormat;
-static __PFNWGLSETPIXELFORMAT pfnSetPixelFormat = &SetPixelFormat;
-static __PFNWGLSWAPBUFFERS pfnSwapBuffers = &SwapBuffers;
+static PFN_WGLCHOOSEPIXELFORMAT pfnChoosePixelFormat = &ChoosePixelFormat;
+static PFN_WGLSETPIXELFORMAT pfnSetPixelFormat = &SetPixelFormat;
+static PFN_WGLSWAPBUFFERS pfnSwapBuffers = &SwapBuffers;
 
 
 static LRESULT CALLBACK
@@ -64,6 +64,13 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
     MINMAXINFO *pMMI;
     switch (uMsg) {
+    case WM_KEYDOWN:
+        switch (wParam) {
+        case VK_ESCAPE:
+            PostMessage(hWnd, WM_CLOSE, 0, 0);
+            break;
+        }
+        break;
     case WM_GETMINMAXINFO:
         // Allow to create a window bigger than the desktop
         pMMI = (MINMAXINFO *)lParam;
@@ -72,6 +79,9 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
         pMMI->ptMaxTrackSize.x = 60000;
         pMMI->ptMaxTrackSize.y = 60000;
         break;
+    case WM_CLOSE:
+        exit(0);
+        break;
     default:
         break;
     }
@@ -252,8 +262,8 @@ init(void) {
         libgl_filename = "OPENGL32";
     }
 
-    __libGlHandle = LoadLibraryA(libgl_filename);
-    if (!__libGlHandle) {
+    _libGlHandle = LoadLibraryA(libgl_filename);
+    if (!_libGlHandle) {
         std::cerr << "error: unable to open " << libgl_filename << "\n";
         exit(1);
     }
@@ -283,7 +293,7 @@ createDrawable(const Visual *visual, int width, int height)
 }
 
 Context *
-createContext(const Visual *visual, Context *shareContext, Profile profile)
+createContext(const Visual *visual, Context *shareContext, Profile profile, bool debug)
 {
     if (profile != PROFILE_COMPAT) {
         return NULL;
@@ -324,7 +334,17 @@ makeCurrent(Drawable *drawable, Context *context)
 
 bool
 processEvents(void) {
-    // TODO
+    MSG uMsg;
+    while (PeekMessage(&uMsg, NULL, 0, 0, PM_REMOVE)) {
+        if (uMsg.message == WM_QUIT) {
+            return false;
+        }
+
+        if (!TranslateAccelerator(uMsg.hwnd, NULL, &uMsg)) {
+            TranslateMessage(&uMsg);
+            DispatchMessage(&uMsg);
+        }
+    }
     return true;
 }