]> git.cworth.org Git - apitrace/blobdiff - glws_cocoa.mm
cli: Add a new "apitrace diff" command.
[apitrace] / glws_cocoa.mm
index c22a82352baa3d47d125ce3a01114753cf357c30..493cb4a58dc54b1c3af3e0a9da4243298d2b70a2 100644 (file)
@@ -1,6 +1,6 @@
 /**************************************************************************
  *
- * Copyright 2011 Jose Fonseca
+ * Copyright 2011 VMware, Inc.
  * All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  *
  **************************************************************************/
 
+
+/**
+ * Minimal Cocoa integration.
+ *
+ * See also:
+ * - http://developer.apple.com/library/mac/#samplecode/CocoaGL/Introduction/Intro.html
+ * - http://developer.apple.com/library/mac/#samplecode/Cocoa_With_Carbon_or_CPP/Introduction/Intro.html
+ * - http://developer.apple.com/library/mac/#samplecode/glut/Introduction/Intro.html
+ * - http://developer.apple.com/library/mac/#samplecode/GLEssentials/Introduction/Intro.html
+ * - http://www.glfw.org/
+ */
+
+
 #include <stdlib.h>
 #include <iostream>
 
@@ -91,7 +104,9 @@ public:
 
     void
     resize(int w, int h) {
-        Drawable::resize(w, h);
+        if (w == width && h == height) {
+            return;
+        }
 
         [window setContentSize:NSMakeSize(w, h)];
 
@@ -101,13 +116,18 @@ public:
             [currentContext setView:[window contentView]];
             [currentContext makeCurrentContext];
         }
+
+        Drawable::resize(w, h);
     }
 
     void show(void) {
-        if (!visible) {
-            // TODO
-            Drawable::show();
+        if (visible) {
+            return;
         }
+
+        // TODO
+
+        Drawable::show();
     }
 
     void swapBuffers(void) {