fix ime for dx7, put in hooks for dx8, dx9

This commit is contained in:
David Rose 2004-02-06 06:31:59 +00:00
parent a16557c9bb
commit e46e47b442
11 changed files with 104 additions and 54 deletions

View File

@ -5134,19 +5134,19 @@ void DXGraphicsStateGuardian7::show_frame(void) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void DXGraphicsStateGuardian7:: void DXGraphicsStateGuardian7::
support_overlay_window(bool flag) { support_overlay_window(bool flag) {
if (_overlay_windows_supported && !flag) { if (!flag) {
// Disable support for overlay windows. // Disable support for overlay windows.
_overlay_windows_supported = false; _overlay_windows_supported = false;
if (_pScrn->bIsFullScreen) { if (_pScrn != (DXScreenData *)NULL && _pScrn->bIsFullScreen) {
_pScrn->pddsPrimary->SetClipper(NULL); _pScrn->pddsPrimary->SetClipper(NULL);
} }
} else if (!_overlay_windows_supported && flag) { } else {
// Enable support for overlay windows. // Enable support for overlay windows.
_overlay_windows_supported = true; _overlay_windows_supported = true;
if (_pScrn->bIsFullScreen) { if (_pScrn != (DXScreenData *)NULL && _pScrn->bIsFullScreen) {
// Create a Clipper object to blt the whole screen. // Create a Clipper object to blt the whole screen.
LPDIRECTDRAWCLIPPER Clipper; LPDIRECTDRAWCLIPPER Clipper;

View File

@ -404,6 +404,23 @@ do_fullscreen_resize(int x_size, int y_size) {
return true; 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 // Function: wdxGraphicsWindow7::set_to_temp_rendertarget
// Access: Private // Access: Private

View File

@ -53,6 +53,7 @@ protected:
virtual void fullscreen_restored(WindowProperties &properties); virtual void fullscreen_restored(WindowProperties &properties);
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 support_overlay_window(bool flag);
private: private:
bool set_to_temp_rendertarget(); bool set_to_temp_rendertarget();

View File

@ -754,14 +754,11 @@ search_for_valid_displaymode(DXScreenData &scrn,
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: wdxGraphicsPipew8::make_device // Function: wdxGraphicsPipew8::make_device
// Access: Public, Virtual // 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:: PT(GraphicsDevice) wdxGraphicsPipe8::
make_device(void *scrn) { 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); PT(DXGraphicsDevice8) device = new DXGraphicsDevice8(this);
device->_pScrn = (DXScreenData*) scrn; device->_pScrn = (DXScreenData*) scrn;
device->_pD3DDevice = device->_pScrn->pD3DDevice; device->_pD3DDevice = device->_pScrn->pD3DDevice;

View File

@ -397,6 +397,23 @@ do_fullscreen_resize(int x_size, int y_size) {
return bResizeSucceeded; 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 #if 1
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
// Function: WinGraphicsWindow::window_proc // Function: WinGraphicsWindow::window_proc
@ -455,19 +472,6 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
return 0; 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: case WM_ENTERSIZEMOVE:
if(_dxgsg!=NULL) if(_dxgsg!=NULL)
_dxgsg->SetDXReady(false); // dont see pic during resize _dxgsg->SetDXReady(false); // dont see pic during resize
@ -1718,16 +1722,20 @@ reset_window(bool swapchain) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
bool wdxGraphicsWindow8:: bool wdxGraphicsWindow8::
open_window(void) { open_window(void) {
cerr << "open_window()\n";
PT(DXGraphicsDevice8) dxdev; PT(DXGraphicsDevice8) dxdev;
DXGraphicsStateGuardian8 *dxgsg; DXGraphicsStateGuardian8 *dxgsg;
DCAST_INTO_R(dxgsg,_gsg,false); DCAST_INTO_R(dxgsg,_gsg,false);
WindowProperties props; WindowProperties props;
if(!choose_device()) { if(!choose_device()) {
return false;
}
if (dxgsg->get_pipe()->get_device() && !multiple_windows)
return false; 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"; wdxdisplay8_cat.debug() << "_wcontext.hWnd is " << _wcontext.hWnd << "\n";
if (!WinGraphicsWindow::open_window()) { if (!WinGraphicsWindow::open_window()) {
@ -1745,12 +1753,14 @@ open_window(void) {
create_screen_buffers_and_device(_wcontext, dx_force_16bpp_zbuffer); create_screen_buffers_and_device(_wcontext, dx_force_16bpp_zbuffer);
dxgsg->get_pipe()->make_device((void*)(&_wcontext)); dxgsg->get_pipe()->make_device((void*)(&_wcontext));
dxgsg->copy_pres_reset(&_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); 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(); dxdev = (DXGraphicsDevice8*)dxgsg->get_pipe()->get_device();
props = get_properties(); props = get_properties();
@ -1764,12 +1774,10 @@ open_window(void) {
init_resized_window(); init_resized_window();
if (wdxdisplay8_cat.is_debug()) { if (wdxdisplay8_cat.is_debug()) {
wdxdisplay8_cat.debug() << "Current device is " << dxdev << "\n"; 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"; wdxdisplay8_cat.debug() << "swapchain is " << _wcontext.pSwapChain << "\n";
return true; return true;

View File

@ -55,6 +55,7 @@ protected:
virtual void fullscreen_restored(WindowProperties &properties); virtual void fullscreen_restored(WindowProperties &properties);
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 support_overlay_window(bool flag);
private: private:
// bool set_to_temp_rendertarget(); // bool set_to_temp_rendertarget();

View File

@ -927,7 +927,7 @@ support_overlay_window(bool flag) {
_overlay_windows_supported = false; _overlay_windows_supported = false;
if (dx_full_screen) { if (dx_full_screen) {
_pScrn->pddsPrimary->SetClipper(NULL); _pD3DDevicesPrimary->SetClipper(NULL);
} }
} else if (!_overlay_windows_supported && flag) { } else if (!_overlay_windows_supported && flag) {

View File

@ -397,6 +397,23 @@ do_fullscreen_resize(int x_size, int y_size) {
return bResizeSucceeded; 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 #if 1
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
// Function: WinGraphicsWindow::window_proc // Function: WinGraphicsWindow::window_proc
@ -455,19 +472,6 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
return 0; 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: case WM_ENTERSIZEMOVE:
if(_dxgsg!=NULL) if(_dxgsg!=NULL)
_dxgsg->SetDXReady(false); // dont see pic during resize _dxgsg->SetDXReady(false); // dont see pic during resize
@ -1728,8 +1732,11 @@ open_window(void) {
if(!choose_device()) { if(!choose_device()) {
return false; 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; return false;
}
wdxdisplay9_cat.debug() << "_wcontext.hWnd is " << _wcontext.hWnd << "\n"; wdxdisplay9_cat.debug() << "_wcontext.hWnd is " << _wcontext.hWnd << "\n";
if (!WinGraphicsWindow::open_window()) { if (!WinGraphicsWindow::open_window()) {
@ -1747,12 +1754,14 @@ open_window(void) {
create_screen_buffers_and_device(_wcontext, dx_force_16bpp_zbuffer); create_screen_buffers_and_device(_wcontext, dx_force_16bpp_zbuffer);
dxgsg->get_pipe()->make_device((void*)(&_wcontext)); dxgsg->get_pipe()->make_device((void*)(&_wcontext));
dxgsg->copy_pres_reset(&_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); 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(); dxdev = (DXGraphicsDevice9*)dxgsg->get_pipe()->get_device();
props = get_properties(); props = get_properties();
@ -1766,12 +1775,10 @@ open_window(void) {
init_resized_window(); init_resized_window();
if (wdxdisplay9_cat.is_debug()) { if (wdxdisplay9_cat.is_debug()) {
wdxdisplay9_cat.debug() << "Current device is " << dxdev << "\n"; 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"; wdxdisplay9_cat.debug() << "swapchain is " << _wcontext.pSwapChain << "\n";
return true; return true;

View File

@ -55,6 +55,7 @@ protected:
virtual void fullscreen_restored(WindowProperties &properties); virtual void fullscreen_restored(WindowProperties &properties);
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 support_overlay_window(bool flag);
private: private:
// bool set_to_temp_rendertarget(); // bool set_to_temp_rendertarget();

View File

@ -440,6 +440,20 @@ void WinGraphicsWindow::
reconsider_fullscreen_size(DWORD &, DWORD &, DWORD &) { 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 // Function: WinGraphicsWindow::open_fullscreen_window
// Access: Private // Access: Private
@ -818,10 +832,12 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
break; break;
case WM_IME_STARTCOMPOSITION: case WM_IME_STARTCOMPOSITION:
support_overlay_window(true);
_ime_active = true; _ime_active = true;
break; break;
case WM_IME_ENDCOMPOSITION: case WM_IME_ENDCOMPOSITION:
support_overlay_window(false);
_ime_active = false; _ime_active = false;
break; break;

View File

@ -73,6 +73,8 @@ protected:
virtual void reconsider_fullscreen_size(DWORD &x_size, DWORD &y_size, virtual void reconsider_fullscreen_size(DWORD &x_size, DWORD &y_size,
DWORD &bitdepth); DWORD &bitdepth);
virtual void support_overlay_window(bool flag);
private: private:
bool open_fullscreen_window(); bool open_fullscreen_window();
bool open_regular_window(); bool open_regular_window();