Merge pull request #38952 from bruvzg/win_ink_block_mm_3
[3.2] Block WM_MOUSEMOVE during Windows Ink pen handling.
This commit is contained in:
commit
d5e380117f
4 changed files with 48 additions and 9 deletions
|
@ -194,7 +194,7 @@ public:
|
|||
virtual const char *get_audio_driver_name(int p_driver) const;
|
||||
|
||||
virtual int get_tablet_driver_count() const { return 0; };
|
||||
virtual const char *get_tablet_driver_name(int p_driver) const { return ""; };
|
||||
virtual String get_tablet_driver_name(int p_driver) const { return ""; };
|
||||
virtual String get_current_tablet_driver() const { return ""; };
|
||||
virtual void set_current_tablet_driver(const String &p_driver){};
|
||||
|
||||
|
|
|
@ -266,7 +266,7 @@ void Main::print_help(const char *p_binary) {
|
|||
for (int i = 0; i < OS::get_singleton()->get_tablet_driver_count(); i++) {
|
||||
if (i != 0)
|
||||
OS::get_singleton()->print(", ");
|
||||
OS::get_singleton()->print("'%s'", OS::get_singleton()->get_tablet_driver_name(i));
|
||||
OS::get_singleton()->print("'%s'", OS::get_singleton()->get_tablet_driver_name(i).utf8().get_data());
|
||||
}
|
||||
OS::get_singleton()->print(") (Windows only).\n");
|
||||
OS::get_singleton()->print("\n");
|
||||
|
|
|
@ -593,11 +593,37 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
old_x = mm->get_position().x;
|
||||
old_y = mm->get_position().y;
|
||||
if (window_has_focus && main_loop)
|
||||
input->parse_input_event(mm);
|
||||
input->accumulate_input_event(mm);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} break;
|
||||
case WM_POINTERENTER: {
|
||||
if (mouse_mode == MOUSE_MODE_CAPTURED && use_raw_input) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ((get_current_tablet_driver() != "winink") || !winink_available) {
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t pointer_id = LOWORD(wParam);
|
||||
POINTER_INPUT_TYPE pointer_type = PT_POINTER;
|
||||
if (!win8p_GetPointerType(pointer_id, &pointer_type)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (pointer_type != PT_PEN) {
|
||||
break;
|
||||
}
|
||||
|
||||
block_mm = true;
|
||||
return 0;
|
||||
} break;
|
||||
case WM_POINTERLEAVE: {
|
||||
block_mm = false;
|
||||
return 0;
|
||||
} break;
|
||||
case WM_POINTERUPDATE: {
|
||||
if (mouse_mode == MOUSE_MODE_CAPTURED && use_raw_input) {
|
||||
break;
|
||||
|
@ -713,11 +739,14 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
old_x = mm->get_position().x;
|
||||
old_y = mm->get_position().y;
|
||||
if (window_has_focus && main_loop)
|
||||
input->parse_input_event(mm);
|
||||
|
||||
return 0; //Pointer event handled return 0 to avoid duplicate WM_MOUSEMOVE event
|
||||
input->accumulate_input_event(mm);
|
||||
return 0;
|
||||
} break;
|
||||
case WM_MOUSEMOVE: {
|
||||
if (block_mm) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (mouse_mode == MOUSE_MODE_CAPTURED && use_raw_input) {
|
||||
break;
|
||||
}
|
||||
|
@ -3466,11 +3495,11 @@ int OS_Windows::get_tablet_driver_count() const {
|
|||
return tablet_drivers.size();
|
||||
}
|
||||
|
||||
const char *OS_Windows::get_tablet_driver_name(int p_driver) const {
|
||||
String OS_Windows::get_tablet_driver_name(int p_driver) const {
|
||||
if (p_driver < 0 || p_driver >= tablet_drivers.size()) {
|
||||
return "";
|
||||
} else {
|
||||
return tablet_drivers[p_driver].utf8().get_data();
|
||||
return tablet_drivers[p_driver];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3487,6 +3516,7 @@ void OS_Windows::set_current_tablet_driver(const String &p_driver) {
|
|||
}
|
||||
if (found) {
|
||||
if (hWnd) {
|
||||
block_mm = false;
|
||||
if ((tablet_driver == "wintab") && wintab_available && wtctx) {
|
||||
wintab_WTEnable(wtctx, false);
|
||||
wintab_WTClose(wtctx);
|
||||
|
|
|
@ -218,6 +218,14 @@ typedef struct tagPOINTER_PEN_INFO {
|
|||
#define WM_POINTERUPDATE 0x0245
|
||||
#endif
|
||||
|
||||
#ifndef WM_POINTERENTER
|
||||
#define WM_POINTERENTER 0x0249
|
||||
#endif
|
||||
|
||||
#ifndef WM_POINTERLEAVE
|
||||
#define WM_POINTERLEAVE 0x024A
|
||||
#endif
|
||||
|
||||
typedef BOOL(WINAPI *GetPointerTypePtr)(uint32_t p_id, POINTER_INPUT_TYPE *p_type);
|
||||
typedef BOOL(WINAPI *GetPointerPenInfoPtr)(uint32_t p_id, POINTER_PEN_INFO *p_pen_info);
|
||||
|
||||
|
@ -262,6 +270,7 @@ class OS_Windows : public OS {
|
|||
int min_pressure;
|
||||
int max_pressure;
|
||||
bool tilt_supported;
|
||||
bool block_mm = false;
|
||||
|
||||
int last_pressure_update;
|
||||
float last_pressure;
|
||||
|
@ -419,7 +428,7 @@ public:
|
|||
virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const;
|
||||
|
||||
virtual int get_tablet_driver_count() const;
|
||||
virtual const char *get_tablet_driver_name(int p_driver) const;
|
||||
virtual String get_tablet_driver_name(int p_driver) const;
|
||||
virtual String get_current_tablet_driver() const;
|
||||
virtual void set_current_tablet_driver(const String &p_driver);
|
||||
|
||||
|
|
Loading…
Reference in a new issue