File tree Expand file tree Collapse file tree 3 files changed +13
-18
lines changed
Expand file tree Collapse file tree 3 files changed +13
-18
lines changed Original file line number Diff line number Diff line change @@ -2888,17 +2888,10 @@ int check_control_used(int id, int key)
28882888
28892889 // special case to allow actual mouse wheel to work with trigger controls --wookieejedi
28902890 if (item.type == CC_TYPE_TRIGGER) {
2891-
2892- int first_btn = 1 << item.first .get_btn ();
2893- int second_btn = 1 << item.second .get_btn ();
2894-
2895- if ( (first_btn >= LOWEST_MOUSE_WHEEL && first_btn <= HIGHEST_MOUSE_WHEEL) ||
2896- (second_btn >= LOWEST_MOUSE_WHEEL && second_btn <= HIGHEST_MOUSE_WHEEL) ) {
2897- if ( mouse_down (item.first ) || mouse_down (item.second ) ) {
2898- // Mouse wheel bound to this trigger control was pressed, control activated
2899- control_used (id);
2900- return 1 ;
2901- }
2891+ if ( mouse_down (item.first , true ) || mouse_down (item.second , true ) ) {
2892+ // Mouse wheel bound to this trigger control was pressed, control activated
2893+ control_used (id);
2894+ return 1 ;
29022895 }
29032896 }
29042897
Original file line number Diff line number Diff line change @@ -459,7 +459,7 @@ int mouse_up_count(int n) {
459459
460460// returns 1 if mouse button btn is down, 0 otherwise
461461
462- int mouse_down (const CC_bind &bind)
462+ int mouse_down (const CC_bind &bind, bool must_be_wheel )
463463{
464464 // Bail if the incoming bind is not the right CID according to mouse-fly mode
465465 auto CID = bind.get_cid ();
@@ -483,20 +483,22 @@ int mouse_down(const CC_bind &bind)
483483
484484 btn = 1 << btn;
485485
486- return mouse_down (btn);
486+ return mouse_down (btn, must_be_wheel );
487487}
488488
489- int mouse_down (int btn) {
490- int tmp;
489+ int mouse_down (int btn, bool must_be_wheel) {
491490 if ( !mouse_inited ) return 0 ;
492491
493492 // Bail if not a button or wheel direction
494493 if ((btn < LOWEST_MOUSE_BUTTON) || (btn > HIGHEST_MOUSE_WHEEL)) return 0 ;
495494
495+ // Bail if needs to be a mouse wheel and is not --wookieejedi
496+ if (must_be_wheel && (btn < LOWEST_MOUSE_WHEEL || btn > HIGHEST_MOUSE_WHEEL)) return 0 ;
496497
497- SDL_LockMutex ( mouse_lock );
498498
499+ SDL_LockMutex ( mouse_lock );
499500
501+ int tmp;
500502 if (mouse_flags & btn) {
501503 tmp = 1 ;
502504 if ((btn >= LOWEST_MOUSE_WHEEL) && (btn <= HIGHEST_MOUSE_WHEEL)) {
Original file line number Diff line number Diff line change @@ -98,12 +98,12 @@ void mouse_flush();
9898 * @note Calls mousewheel_decay() if the mousewheel direction is "down".
9999 * Please ensure mouse_down() is called only once per frame.
100100 */
101- int mouse_down (const CC_bind & bind);
101+ int mouse_down (const CC_bind& bind, bool must_be_wheel = false );
102102
103103/* *
104104 * Returns 1 if any of the given mouse buttons are down. 0 otherwise
105105 */
106- int mouse_down (int btn);
106+ int mouse_down (int btn, bool must_be_wheel = false );
107107
108108void mouse_reset_deltas ();
109109void mouse_get_delta (int *dx = NULL , int *dy = NULL , int *dz = NULL );
You can’t perform that action at this time.
0 commit comments