mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
fix ime for dx7, put in hooks for dx8, dx9
This commit is contained in:
parent
a16557c9bb
commit
e46e47b442
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user