diff --git a/panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx b/panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx index f88314ffdd..5c123f064b 100644 --- a/panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx +++ b/panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx @@ -5134,19 +5134,19 @@ void DXGraphicsStateGuardian7::show_frame(void) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian7:: support_overlay_window(bool flag) { - if (_overlay_windows_supported && !flag) { + if (!flag) { // Disable support for overlay windows. _overlay_windows_supported = false; - if (_pScrn->bIsFullScreen) { + if (_pScrn != (DXScreenData *)NULL && _pScrn->bIsFullScreen) { _pScrn->pddsPrimary->SetClipper(NULL); } - } else if (!_overlay_windows_supported && flag) { + } else { // Enable support for overlay windows. _overlay_windows_supported = true; - if (_pScrn->bIsFullScreen) { + if (_pScrn != (DXScreenData *)NULL && _pScrn->bIsFullScreen) { // Create a Clipper object to blt the whole screen. LPDIRECTDRAWCLIPPER Clipper; diff --git a/panda/src/dxgsg7/wdxGraphicsWindow7.cxx b/panda/src/dxgsg7/wdxGraphicsWindow7.cxx index 9f6eaaeb03..92224706f7 100644 --- a/panda/src/dxgsg7/wdxGraphicsWindow7.cxx +++ b/panda/src/dxgsg7/wdxGraphicsWindow7.cxx @@ -404,6 +404,23 @@ do_fullscreen_resize(int x_size, int y_size) { return true; } +//////////////////////////////////////////////////////////////////// +// Function: wdxGraphicsWindow7::support_overlay_window +// Access: Protected, Virtual +// Description: Some windows graphics contexts (e.g. DirectX) +// require special support to enable the displaying of +// an overlay window (particularly the IME window) over +// the fullscreen graphics window. This is a hook for +// the window to enable or disable that mode when +// necessary. +//////////////////////////////////////////////////////////////////// +void wdxGraphicsWindow7:: +support_overlay_window(bool flag) { + if (_dxgsg != (DXGraphicsStateGuardian7 *)NULL) { + _dxgsg->support_overlay_window(flag); + } +} + //////////////////////////////////////////////////////////////////// // Function: wdxGraphicsWindow7::set_to_temp_rendertarget // Access: Private diff --git a/panda/src/dxgsg7/wdxGraphicsWindow7.h b/panda/src/dxgsg7/wdxGraphicsWindow7.h index 02d79f7249..412c0a76d6 100644 --- a/panda/src/dxgsg7/wdxGraphicsWindow7.h +++ b/panda/src/dxgsg7/wdxGraphicsWindow7.h @@ -53,6 +53,7 @@ protected: virtual void fullscreen_restored(WindowProperties &properties); virtual void handle_reshape(); virtual bool do_fullscreen_resize(int x_size, int y_size); + virtual void support_overlay_window(bool flag); private: bool set_to_temp_rendertarget(); diff --git a/panda/src/dxgsg8/wdxGraphicsPipe8.cxx b/panda/src/dxgsg8/wdxGraphicsPipe8.cxx index 1d9b7518f0..061b16a639 100644 --- a/panda/src/dxgsg8/wdxGraphicsPipe8.cxx +++ b/panda/src/dxgsg8/wdxGraphicsPipe8.cxx @@ -754,14 +754,11 @@ search_for_valid_displaymode(DXScreenData &scrn, //////////////////////////////////////////////////////////////////// // Function: wdxGraphicsPipew8::make_device // Access: Public, Virtual -// Description: Creates a new device. ?????? +// Description: Creates a new reference to a particular hardware +// device and associates it with the pipe. //////////////////////////////////////////////////////////////////// - PT(GraphicsDevice) wdxGraphicsPipe8:: make_device(void *scrn) { - - // FrameBufferProperties really belongs as part of the window/renderbuffer specification - // put here because of GLX multithreading requirement PT(DXGraphicsDevice8) device = new DXGraphicsDevice8(this); device->_pScrn = (DXScreenData*) scrn; device->_pD3DDevice = device->_pScrn->pD3DDevice; diff --git a/panda/src/dxgsg8/wdxGraphicsWindow8.cxx b/panda/src/dxgsg8/wdxGraphicsWindow8.cxx index 9a6f0de6dd..6dee35b31e 100644 --- a/panda/src/dxgsg8/wdxGraphicsWindow8.cxx +++ b/panda/src/dxgsg8/wdxGraphicsWindow8.cxx @@ -397,6 +397,23 @@ do_fullscreen_resize(int x_size, int y_size) { return bResizeSucceeded; } +//////////////////////////////////////////////////////////////////// +// Function: wdxGraphicsWindow8::support_overlay_window +// Access: Protected, Virtual +// Description: Some windows graphics contexts (e.g. DirectX) +// require special support to enable the displaying of +// an overlay window (particularly the IME window) over +// the fullscreen graphics window. This is a hook for +// the window to enable or disable that mode when +// necessary. +//////////////////////////////////////////////////////////////////// +void wdxGraphicsWindow8:: +support_overlay_window(bool flag) { + if (_dxgsg != (DXGraphicsStateGuardian8 *)NULL) { + _dxgsg->support_overlay_window(flag); + } +} + #if 1 ////////////////////////////////////////////////////////////////// // Function: WinGraphicsWindow::window_proc @@ -455,19 +472,6 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { return 0; } - case WM_IME_STARTCOMPOSITION: - // In case we're running fullscreen mode, we have to turn on - // explicit DX support for overlay windows now, so we'll be able - // to see the IME window. - _dxgsg->support_overlay_window(true); - break; - - case WM_IME_ENDCOMPOSITION: - // Turn off the support for overlay windows, since we're done - // with the IME window for now and it just slows things down. - _dxgsg->support_overlay_window(false); - break; - case WM_ENTERSIZEMOVE: if(_dxgsg!=NULL) _dxgsg->SetDXReady(false); // dont see pic during resize @@ -1718,16 +1722,20 @@ reset_window(bool swapchain) { //////////////////////////////////////////////////////////////////// bool wdxGraphicsWindow8:: open_window(void) { + cerr << "open_window()\n"; PT(DXGraphicsDevice8) dxdev; DXGraphicsStateGuardian8 *dxgsg; DCAST_INTO_R(dxgsg,_gsg,false); WindowProperties props; if(!choose_device()) { - return false; - } - if (dxgsg->get_pipe()->get_device() && !multiple_windows) return false; + } + if (dxgsg->get_pipe()->get_device() && !multiple_windows) { + wdxdisplay8_cat.error() + << "Could not create window; multiple window support not enabled.\n"; + return false; + } wdxdisplay8_cat.debug() << "_wcontext.hWnd is " << _wcontext.hWnd << "\n"; if (!WinGraphicsWindow::open_window()) { @@ -1745,12 +1753,14 @@ open_window(void) { create_screen_buffers_and_device(_wcontext, dx_force_16bpp_zbuffer); dxgsg->get_pipe()->make_device((void*)(&_wcontext)); dxgsg->copy_pres_reset(&_wcontext); - if (multiple_windows) // then we have no choice but to waist a framebuffer + if (multiple_windows) { + // then we have no choice but to waste a framebuffer dxgsg->create_swap_chain(&_wcontext); - } - else { + } - // fill in the DXScreenData from dxdevice here and change the reference to hWnd. + } else { + // fill in the DXScreenData from dxdevice here and change the + // reference to hWnd. dxdev = (DXGraphicsDevice8*)dxgsg->get_pipe()->get_device(); props = get_properties(); @@ -1764,12 +1774,10 @@ open_window(void) { init_resized_window(); - if (wdxdisplay8_cat.is_debug()) { wdxdisplay8_cat.debug() << "Current device is " << dxdev << "\n"; - - dxgsg->create_swap_chain(&_wcontext); } + dxgsg->create_swap_chain(&_wcontext); } wdxdisplay8_cat.debug() << "swapchain is " << _wcontext.pSwapChain << "\n"; return true; diff --git a/panda/src/dxgsg8/wdxGraphicsWindow8.h b/panda/src/dxgsg8/wdxGraphicsWindow8.h index 2200446e79..81c305bcc4 100644 --- a/panda/src/dxgsg8/wdxGraphicsWindow8.h +++ b/panda/src/dxgsg8/wdxGraphicsWindow8.h @@ -55,6 +55,7 @@ protected: virtual void fullscreen_restored(WindowProperties &properties); virtual void handle_reshape(); virtual bool do_fullscreen_resize(int x_size, int y_size); + virtual void support_overlay_window(bool flag); private: // bool set_to_temp_rendertarget(); diff --git a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx index 333685e1a5..cf2b305e9c 100755 --- a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx +++ b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx @@ -927,7 +927,7 @@ support_overlay_window(bool flag) { _overlay_windows_supported = false; if (dx_full_screen) { - _pScrn->pddsPrimary->SetClipper(NULL); + _pD3DDevicesPrimary->SetClipper(NULL); } } else if (!_overlay_windows_supported && flag) { diff --git a/panda/src/dxgsg9/wdxGraphicsWindow9.cxx b/panda/src/dxgsg9/wdxGraphicsWindow9.cxx index a288318191..c2cff0e502 100755 --- a/panda/src/dxgsg9/wdxGraphicsWindow9.cxx +++ b/panda/src/dxgsg9/wdxGraphicsWindow9.cxx @@ -397,6 +397,23 @@ do_fullscreen_resize(int x_size, int y_size) { return bResizeSucceeded; } +//////////////////////////////////////////////////////////////////// +// Function: wdxGraphicsWindow9::support_overlay_window +// Access: Protected, Virtual +// Description: Some windows graphics contexts (e.g. DirectX) +// require special support to enable the displaying of +// an overlay window (particularly the IME window) over +// the fullscreen graphics window. This is a hook for +// the window to enable or disable that mode when +// necessary. +//////////////////////////////////////////////////////////////////// +void wdxGraphicsWindow9:: +support_overlay_window(bool flag) { + if (_dxgsg != (DXGraphicsStateGuardian9 *)NULL) { + _dxgsg->support_overlay_window(flag); + } +} + #if 1 ////////////////////////////////////////////////////////////////// // Function: WinGraphicsWindow::window_proc @@ -455,19 +472,6 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { return 0; } - case WM_IME_STARTCOMPOSITION: - // In case we're running fullscreen mode, we have to turn on - // explicit DX support for overlay windows now, so we'll be able - // to see the IME window. - _dxgsg->support_overlay_window(true); - break; - - case WM_IME_ENDCOMPOSITION: - // Turn off the support for overlay windows, since we're done - // with the IME window for now and it just slows things down. - _dxgsg->support_overlay_window(false); - break; - case WM_ENTERSIZEMOVE: if(_dxgsg!=NULL) _dxgsg->SetDXReady(false); // dont see pic during resize @@ -1728,8 +1732,11 @@ open_window(void) { if(!choose_device()) { return false; } - if (dxgsg->get_pipe()->get_device() && !multiple_windows) + if (dxgsg->get_pipe()->get_device() && !multiple_windows) { + wdxdisplay9_cat.error() + << "Could not create window; multiple window support not enabled.\n"; return false; + } wdxdisplay9_cat.debug() << "_wcontext.hWnd is " << _wcontext.hWnd << "\n"; if (!WinGraphicsWindow::open_window()) { @@ -1747,12 +1754,14 @@ open_window(void) { create_screen_buffers_and_device(_wcontext, dx_force_16bpp_zbuffer); dxgsg->get_pipe()->make_device((void*)(&_wcontext)); dxgsg->copy_pres_reset(&_wcontext); - if (multiple_windows) // then we have no choice but to waist a framebuffer + if (multiple_windows) { + // then we have no choice but to waste a framebuffer dxgsg->create_swap_chain(&_wcontext); - } - else { + } - // fill in the DXScreenData from dxdevice here and change the reference to hWnd. + } else { + // fill in the DXScreenData from dxdevice here and change the + // reference to hWnd. dxdev = (DXGraphicsDevice9*)dxgsg->get_pipe()->get_device(); props = get_properties(); @@ -1766,12 +1775,10 @@ open_window(void) { init_resized_window(); - if (wdxdisplay9_cat.is_debug()) { wdxdisplay9_cat.debug() << "Current device is " << dxdev << "\n"; - - dxgsg->create_swap_chain(&_wcontext); } + dxgsg->create_swap_chain(&_wcontext); } wdxdisplay9_cat.debug() << "swapchain is " << _wcontext.pSwapChain << "\n"; return true; diff --git a/panda/src/dxgsg9/wdxGraphicsWindow9.h b/panda/src/dxgsg9/wdxGraphicsWindow9.h index e13a1a175c..ef12180935 100755 --- a/panda/src/dxgsg9/wdxGraphicsWindow9.h +++ b/panda/src/dxgsg9/wdxGraphicsWindow9.h @@ -55,6 +55,7 @@ protected: virtual void fullscreen_restored(WindowProperties &properties); virtual void handle_reshape(); virtual bool do_fullscreen_resize(int x_size, int y_size); + virtual void support_overlay_window(bool flag); private: // bool set_to_temp_rendertarget(); diff --git a/panda/src/windisplay/winGraphicsWindow.cxx b/panda/src/windisplay/winGraphicsWindow.cxx index 8f86f29eb3..f6329f378c 100644 --- a/panda/src/windisplay/winGraphicsWindow.cxx +++ b/panda/src/windisplay/winGraphicsWindow.cxx @@ -440,6 +440,20 @@ void WinGraphicsWindow:: reconsider_fullscreen_size(DWORD &, DWORD &, DWORD &) { } +//////////////////////////////////////////////////////////////////// +// Function: WinGraphicsWindow::support_overlay_window +// Access: Protected, Virtual +// Description: Some windows graphics contexts (e.g. DirectX) +// require special support to enable the displaying of +// an overlay window (particularly the IME window) over +// the fullscreen graphics window. This is a hook for +// the window to enable or disable that mode when +// necessary. +//////////////////////////////////////////////////////////////////// +void WinGraphicsWindow:: +support_overlay_window(bool) { +} + //////////////////////////////////////////////////////////////////// // Function: WinGraphicsWindow::open_fullscreen_window // Access: Private @@ -818,10 +832,12 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { break; case WM_IME_STARTCOMPOSITION: + support_overlay_window(true); _ime_active = true; break; case WM_IME_ENDCOMPOSITION: + support_overlay_window(false); _ime_active = false; break; diff --git a/panda/src/windisplay/winGraphicsWindow.h b/panda/src/windisplay/winGraphicsWindow.h index c22465ea64..bf05144b81 100644 --- a/panda/src/windisplay/winGraphicsWindow.h +++ b/panda/src/windisplay/winGraphicsWindow.h @@ -73,6 +73,8 @@ protected: virtual void reconsider_fullscreen_size(DWORD &x_size, DWORD &y_size, DWORD &bitdepth); + virtual void support_overlay_window(bool flag); + private: bool open_fullscreen_window(); bool open_regular_window();