src/video/cocoa/event.mm
branchnoai
changeset 10776 07203fc29812
parent 10715 6bdf79ffb022
equal deleted inserted replaced
10774:2c882f0468f2 10776:07203fc29812
   286 			break;
   286 			break;
   287 		}
   287 		}
   288 	}
   288 	}
   289 
   289 
   290 	if (_current_mods & NSShiftKeyMask)     key |= WKC_SHIFT;
   290 	if (_current_mods & NSShiftKeyMask)     key |= WKC_SHIFT;
   291 	if (_current_mods & NSControlKeyMask)   key |= (_settings.gui.right_mouse_btn_emulation != RMBE_CONTROL ? WKC_CTRL : WKC_META);
   291 	if (_current_mods & NSControlKeyMask)   key |= (_settings_client.gui.right_mouse_btn_emulation != RMBE_CONTROL ? WKC_CTRL : WKC_META);
   292 	if (_current_mods & NSAlternateKeyMask) key |= WKC_ALT;
   292 	if (_current_mods & NSAlternateKeyMask) key |= WKC_ALT;
   293 	if (_current_mods & NSCommandKeyMask)   key |= (_settings.gui.right_mouse_btn_emulation != RMBE_CONTROL ? WKC_META : WKC_CTRL);
   293 	if (_current_mods & NSCommandKeyMask)   key |= (_settings_client.gui.right_mouse_btn_emulation != RMBE_CONTROL ? WKC_META : WKC_CTRL);
   294 
   294 
   295 	return key << 16;
   295 	return key << 16;
   296 }
   296 }
   297 
   297 
   298 static void QZ_KeyEvent(unsigned short keycode, unsigned short unicode, BOOL down)
   298 static void QZ_KeyEvent(unsigned short keycode, unsigned short unicode, BOOL down)
   457 			break;
   457 			break;
   458 
   458 
   459 		case NSLeftMouseDown:
   459 		case NSLeftMouseDown:
   460 		{
   460 		{
   461 			uint32 keymask = 0;
   461 			uint32 keymask = 0;
   462 			if (_settings.gui.right_mouse_btn_emulation == RMBE_COMMAND) keymask |= NSCommandKeyMask;
   462 			if (_settings_client.gui.right_mouse_btn_emulation == RMBE_COMMAND) keymask |= NSCommandKeyMask;
   463 			if (_settings.gui.right_mouse_btn_emulation == RMBE_CONTROL) keymask |= NSControlKeyMask;
   463 			if (_settings_client.gui.right_mouse_btn_emulation == RMBE_CONTROL) keymask |= NSControlKeyMask;
   464 
   464 
   465 			pt = _cocoa_subdriver->GetMouseLocation(event);
   465 			pt = _cocoa_subdriver->GetMouseLocation(event);
   466 
   466 
   467 			if (!([ event modifierFlags ] & keymask) ||
   467 			if (!([ event modifierFlags ] & keymask) ||
   468 					!_cocoa_subdriver->MouseIsInsideView(&pt)) {
   468 					!_cocoa_subdriver->MouseIsInsideView(&pt)) {
   600 			} else if ([ event deltaY ] < 0.0) { /* Scroll down */
   600 			} else if ([ event deltaY ] < 0.0) { /* Scroll down */
   601 				_cursor.wheel++;
   601 				_cursor.wheel++;
   602 			} /* else: deltaY was 0.0 and we don't want to do anything */
   602 			} /* else: deltaY was 0.0 and we don't want to do anything */
   603 
   603 
   604 			/* Set the scroll count for scrollwheel scrolling */
   604 			/* Set the scroll count for scrollwheel scrolling */
   605 			_cursor.h_wheel -= (int)([ event deltaX ]* 5 * _settings.gui.scrollwheel_multiplier);
   605 			_cursor.h_wheel -= (int)([ event deltaX ]* 5 * _settings_client.gui.scrollwheel_multiplier);
   606 			_cursor.v_wheel -= (int)([ event deltaY ]* 5 * _settings.gui.scrollwheel_multiplier);
   606 			_cursor.v_wheel -= (int)([ event deltaY ]* 5 * _settings_client.gui.scrollwheel_multiplier);
   607 			break;
   607 			break;
   608 
   608 
   609 		default:
   609 		default:
   610 			[NSApp sendEvent:event];
   610 			[NSApp sendEvent:event];
   611 	}
   611 	}
   669 			last_cur_ticks = cur_ticks;
   669 			last_cur_ticks = cur_ticks;
   670 			next_tick = cur_ticks + 30;
   670 			next_tick = cur_ticks + 30;
   671 
   671 
   672 			bool old_ctrl_pressed = _ctrl_pressed;
   672 			bool old_ctrl_pressed = _ctrl_pressed;
   673 
   673 
   674 			_ctrl_pressed = !!(_current_mods & ( _settings.gui.right_mouse_btn_emulation != RMBE_CONTROL ? NSControlKeyMask : NSCommandKeyMask));
   674 			_ctrl_pressed = !!(_current_mods & ( _settings_client.gui.right_mouse_btn_emulation != RMBE_CONTROL ? NSControlKeyMask : NSCommandKeyMask));
   675 			_shift_pressed = !!(_current_mods & NSShiftKeyMask);
   675 			_shift_pressed = !!(_current_mods & NSShiftKeyMask);
   676 
   676 
   677 			if (old_ctrl_pressed != _ctrl_pressed) HandleCtrlChanged();
   677 			if (old_ctrl_pressed != _ctrl_pressed) HandleCtrlChanged();
   678 
   678 
   679 			GameLoop();
   679 			GameLoop();