mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
partially-working cursor-visible handling
This commit is contained in:
parent
9b5662b635
commit
eda5a0383a
@ -311,7 +311,6 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
|
|||||||
int x, y, width, height;
|
int x, y, width, height;
|
||||||
|
|
||||||
switch(msg) {
|
switch(msg) {
|
||||||
|
|
||||||
case WM_PAINT: {
|
case WM_PAINT: {
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
BeginPaint(hwnd, &ps);
|
BeginPaint(hwnd, &ps);
|
||||||
@ -561,7 +560,14 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
|
|||||||
_WindowAdjustingType = MovingOrResizing;
|
_WindowAdjustingType = MovingOrResizing;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
/*
|
||||||
|
case WM_SETCURSOR: {
|
||||||
|
if(!_props._bCursorIsVisible)
|
||||||
|
return true; // avoid defaultwindproc showing the cursor
|
||||||
|
break;
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
*/
|
||||||
case WM_DISPLAYCHANGE: {
|
case WM_DISPLAYCHANGE: {
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
width = LOWORD(lparam); height = HIWORD(lparam);
|
width = LOWORD(lparam); height = HIWORD(lparam);
|
||||||
@ -625,13 +631,13 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_mouse_entry_enabled)
|
|
||||||
handle_mouse_entry(MOUSE_ENTERED,_pParentWindowGroup->_hMouseCursor);
|
|
||||||
|
|
||||||
POINT point;
|
POINT point;
|
||||||
GetCursorPos(&point);
|
GetCursorPos(&point);
|
||||||
ScreenToClient(hwnd, &point);
|
ScreenToClient(hwnd, &point);
|
||||||
|
|
||||||
|
if(_mouse_entry_enabled)
|
||||||
|
handle_mouse_entry(MOUSE_ENTERED,point.x,point.y);
|
||||||
|
|
||||||
// this is a hack to make sure common modifier keys have proper state
|
// this is a hack to make sure common modifier keys have proper state
|
||||||
// since at focus loss, app may never receive key-up event corresponding to
|
// since at focus loss, app may never receive key-up event corresponding to
|
||||||
// a key-down. it would be better to know the exact set of ModifierButtons the
|
// a key-down. it would be better to know the exact set of ModifierButtons the
|
||||||
@ -652,7 +658,7 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(_mouse_entry_enabled)
|
if(_mouse_entry_enabled)
|
||||||
handle_mouse_entry(MOUSE_EXITED,_pParentWindowGroup->_hMouseCursor);
|
handle_mouse_entry(MOUSE_EXITED,0,0);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for(i=0;i<NUM_MODIFIER_KEYS;i++) {
|
for(i=0;i<NUM_MODIFIER_KEYS;i++) {
|
||||||
@ -730,8 +736,11 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
//case WM_CREATE:
|
case WM_CREATE: {
|
||||||
// break;
|
if(!_props._bCursorIsVisible)
|
||||||
|
ShowCursor(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case WM_ACTIVATEAPP: {
|
case WM_ACTIVATEAPP: {
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
@ -1033,6 +1042,7 @@ void wdxGraphicsWindowGroup::CreateWindows(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_bLoadedCustomCursor=false;
|
_bLoadedCustomCursor=false;
|
||||||
|
_hMouseCursor=NULL;
|
||||||
|
|
||||||
if(!windows_color_cursor_filename.empty()) {
|
if(!windows_color_cursor_filename.empty()) {
|
||||||
// card support for full color non-black/white GDI cursors varies greatly. if the cursor is not supported,
|
// card support for full color non-black/white GDI cursors varies greatly. if the cursor is not supported,
|
||||||
@ -2448,8 +2458,6 @@ void wdxGraphicsWindow::end_frame(void) {
|
|||||||
GraphicsWindow::end_frame();
|
GraphicsWindow::end_frame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: handle_window_move
|
// Function: handle_window_move
|
||||||
// Access:
|
// Access:
|
||||||
@ -2475,10 +2483,15 @@ void wdxGraphicsWindow::handle_mouse_motion(int x, int y) {
|
|||||||
// Access:
|
// Access:
|
||||||
// Description:
|
// Description:
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void wdxGraphicsWindow::handle_mouse_entry(int state,HCURSOR hCursor) {
|
|
||||||
|
// BUGBUG: this needs to be called when mouse enters. right now it's just called when keybd focus changes
|
||||||
|
void wdxGraphicsWindow::handle_mouse_entry(int state, int x, int y) {
|
||||||
|
// ShowCursor(_props._bCursorIsVisible);
|
||||||
|
|
||||||
if(state == MOUSE_EXITED) {
|
if(state == MOUSE_EXITED) {
|
||||||
_input_devices[0].set_pointer_out_of_window();
|
_input_devices[0].set_pointer_out_of_window();
|
||||||
} else {
|
} else {
|
||||||
|
_input_devices[0].set_pointer_in_window(x, y);
|
||||||
// SetCursor(hCursor); believe this is not necessary, handled by windows
|
// SetCursor(hCursor); believe this is not necessary, handled by windows
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ public:
|
|||||||
INLINE bool mouse_passive_motion_enabled(void) { return _mouse_passive_motion_enabled; }
|
INLINE bool mouse_passive_motion_enabled(void) { return _mouse_passive_motion_enabled; }
|
||||||
void handle_window_move( int x, int y );
|
void handle_window_move( int x, int y );
|
||||||
void handle_mouse_motion( int x, int y );
|
void handle_mouse_motion( int x, int y );
|
||||||
void handle_mouse_entry( int state, HCURSOR hMouseCursor );
|
void handle_mouse_entry( int state, int x, int y);
|
||||||
void handle_keypress( ButtonHandle key, int x, int y );
|
void handle_keypress( ButtonHandle key, int x, int y );
|
||||||
void handle_keyrelease( ButtonHandle key);
|
void handle_keyrelease( ButtonHandle key);
|
||||||
void dx_setup();
|
void dx_setup();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user