Browse Source

allow implementation to veto selected fullscreen size

David Rose 23 năm trước cách đây
mục cha
commit
f7934d63c9

+ 23 - 4
panda/src/windisplay/winGraphicsWindow.cxx

@@ -313,6 +313,9 @@ fullscreen_restored(WindowProperties &) {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 bool WinGraphicsWindow::
 bool WinGraphicsWindow::
 do_reshape_request(int x_origin, int y_origin, int x_size, int y_size) {
 do_reshape_request(int x_origin, int y_origin, int x_size, int y_size) {
+  windisplay_cat.info()
+    << "Got reshape request (" << x_origin << ", " << y_origin
+    << ", " << x_size << ", " << y_size << ")\n";
   if (!is_fullscreen()) {
   if (!is_fullscreen()) {
     // Compute the appropriate size and placement for the window,
     // Compute the appropriate size and placement for the window,
     // including decorations.
     // including decorations.
@@ -415,9 +418,25 @@ do_fullscreen_resize(int x_size, int y_size) {
 
 
   _fullscreen_display_mode = dm;
   _fullscreen_display_mode = dm;
 
 
+  windisplay_cat.info()
+    << "Resized fullscreen window to " << x_size << ", " << y_size 
+    << " bitdepth " << dwFullScreenBitDepth << ", "
+    << dm.dmDisplayFrequency << "Hz\n";
+
   return true;
   return true;
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: WinGraphicsWindow::reconsider_fullscreen_size
+//       Access: Protected, Virtual
+//  Description: Called before creating a fullscreen window to give
+//               the driver a chance to adjust the particular
+//               resolution request, if necessary.
+////////////////////////////////////////////////////////////////////
+void WinGraphicsWindow::
+reconsider_fullscreen_size(DWORD &, DWORD &, DWORD &) {
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: WinGraphicsWindow::get_client_rect_screen
 //     Function: WinGraphicsWindow::get_client_rect_screen
 //       Access: Protected
 //       Access: Protected
@@ -466,9 +485,6 @@ open_fullscreen_window() {
     _properties.set_size(640, 480);
     _properties.set_size(640, 480);
   }
   }
 
 
-  DWORD dwWidth = _properties.get_x_size();
-  DWORD dwHeight = _properties.get_y_size();
-
   HWND hDesktopWindow = GetDesktopWindow();
   HWND hDesktopWindow = GetDesktopWindow();
   HDC scrnDC = GetDC(hDesktopWindow);
   HDC scrnDC = GetDC(hDesktopWindow);
   DWORD cur_bitdepth = GetDeviceCaps(scrnDC, BITSPIXEL);
   DWORD cur_bitdepth = GetDeviceCaps(scrnDC, BITSPIXEL);
@@ -476,9 +492,12 @@ open_fullscreen_window() {
   //  DWORD cur_scrnwidth = GetDeviceCaps(scrnDC, HORZRES);
   //  DWORD cur_scrnwidth = GetDeviceCaps(scrnDC, HORZRES);
   //  DWORD cur_scrnheight = GetDeviceCaps(scrnDC, VERTRES);
   //  DWORD cur_scrnheight = GetDeviceCaps(scrnDC, VERTRES);
   ReleaseDC(hDesktopWindow, scrnDC);
   ReleaseDC(hDesktopWindow, scrnDC);
-  
+
+  DWORD dwWidth = _properties.get_x_size();
+  DWORD dwHeight = _properties.get_y_size();
   DWORD dwFullScreenBitDepth = cur_bitdepth;
   DWORD dwFullScreenBitDepth = cur_bitdepth;
   
   
+  reconsider_fullscreen_size(dwWidth, dwHeight, dwFullScreenBitDepth);
   if (!find_acceptable_display_mode(dwWidth, dwHeight, dwFullScreenBitDepth,
   if (!find_acceptable_display_mode(dwWidth, dwHeight, dwFullScreenBitDepth,
                                     _fullscreen_display_mode)) {
                                     _fullscreen_display_mode)) {
     windisplay_cat.error() 
     windisplay_cat.error() 

+ 3 - 0
panda/src/windisplay/winGraphicsWindow.h

@@ -68,6 +68,9 @@ protected:
   virtual void handle_reshape();
   virtual void handle_reshape();
   virtual bool do_fullscreen_resize(int x_size, int y_size);
   virtual bool do_fullscreen_resize(int x_size, int y_size);
 
 
+  virtual void reconsider_fullscreen_size(DWORD &x_size, DWORD &y_size, 
+                                          DWORD &bitdepth);
+
   void get_client_rect_screen(HWND hwnd, RECT *view_rect);
   void get_client_rect_screen(HWND hwnd, RECT *view_rect);
 
 
 private:
 private: