Beispiel #1
0
void controller_base::handle_event(const SDL_Event& event)
{
	if (gui2::is_in_dialog()) {
		return;
	}

	int x, y;

	switch(event.type) {
	case SDL_FINGERDOWN:
	case SDL_FINGERMOTION:
	case SDL_FINGERUP:
	case SDL_MULTIGESTURE:
	case SDL_MOUSEBUTTONDOWN:
	case SDL_MOUSEBUTTONUP:
	case SDL_MOUSEMOTION:
	case SDL_MOUSEWHEEL:
		base_finger::process_event(event);
		break;

	case SDL_KEYDOWN:
		// Detect key press events, unless there something that has keyboard focus
		// in which case the key press events should go only to it.
		if(have_keyboard_focus()) {
			process_keydown_event(event);
			// hotkey::key_event(get_display(),event.key,this);
		} else {
			process_focus_keydown_event(event);
			break;
		}
		// intentionally fall-through
	case SDL_KEYUP:
		process_keyup_event(event);
		break;

	case SDL_WINDOWEVENT:
		if (event.window.event == SDL_WINDOWEVENT_LEAVE) {
			if (get_mouse_handler_base().is_dragging()) {
				//simulate mouse button up when the app has lost mouse focus
				//this should be a general fix for the issue when the mouse
				//is dragged out of the game window and then the button is released
				Uint8 mouse_flags = SDL_GetMouseState(&x, &y);
				if ((mouse_flags & SDL_BUTTON_LEFT) == 0) {
					SDL_Event e;
					e.type = SDL_MOUSEBUTTONUP;
					e.button.state = SDL_RELEASED;
					e.button.button = SDL_BUTTON_LEFT;
					e.button.x = x;
					e.button.y = y;
					get_mouse_handler_base().mouse_press(e.button, multi_gestures() || mouse_motions_ > 0, browse_);
					post_mouse_press(e.button);
				}
			}
		}
		break;

	default:
		break;
	}
}
Beispiel #2
0
void controller_base::handle_mouse_up(const SDL_MouseButtonEvent& button)
{
	display& disp = get_display();
	// user maybe want to click at mini-map. so allow click out of main-map.

	get_mouse_handler_base().mouse_press(button, multi_gestures() || mouse_motions_, browse_);
	post_mouse_press(button);
	if (get_mouse_handler_base().get_show_menu()){
		get_display().goto_main_context_menu();
	}
}
Beispiel #3
0
void controller_base::play_slice(bool is_delay_enabled)
{
	display& gui = get_display();

	CKey key;
	events::pump();
	events::raise_process_event();
	events::raise_draw_event();

	slice_before_scroll();

	int mousex, mousey;
	Uint8 mouse_flags = SDL_GetMouseState(&mousex, &mousey);
	bool was_scrolling = scrolling_;
	scrolling_ = handle_scroll(key, mousex, mousey, mouse_flags);

	get_display().draw();

	// be nice when window is not visible
	// NOTE should be handled by display instead, to only disable drawing
	if (is_delay_enabled && (SDL_GetAppState(gui.video().getWindow()) & SDL_APPACTIVE) == 0) {
		get_display().delay(200);
	}

	if (!scrolling_ && was_scrolling) {
#if (defined(__APPLE__) && TARGET_OS_IPHONE) || defined(ANDROID)
	
#else
		// scrolling ended, update the cursor and the brightened hex
		get_mouse_handler_base().mouse_update(browse_);
#endif
	}
	slice_end();
}
Beispiel #4
0
void controller_base::handle_mouse_motion(const SDL_MouseMotionEvent& motion)
{
	display& disp = get_display();

	if (multi_gestures()) {
		return;
	}
	// (x, y) on volatile control myabe in map, don't check in volatiles.
/*
	if (disp.point_in_volatiles(motion.x, motion.y)) {
		return;
	}
*/
	// user maybe want to motion at mini-map. so allow click out of main-map.
	SDL_Event new_event;

	// Ignore old mouse motion events in the event queue
	if (SDL_PeepEvents(&new_event, 1, SDL_GETEVENT, SDL_MOUSEMOTIONMASK) > 0) {
		while(SDL_PeepEvents(&new_event, 1, SDL_GETEVENT, SDL_MOUSEMOTIONMASK) > 0) {};
		get_mouse_handler_base().mouse_motion_event(new_event.motion, browse_);
	} else {
		get_mouse_handler_base().mouse_motion_event(motion, browse_);
	}
}
Beispiel #5
0
void controller_base::handle_event(const SDL_Event& event)
{
	if(gui::in_dialog()) {
		return;
	}
	static const hotkey::hotkey_command& quit_hotkey = hotkey::hotkey_command::get_command_by_command(hotkey::HOTKEY_QUIT_GAME);

	switch(event.type) {
	case SDL_KEYDOWN:
		// Detect key press events, unless there something that has keyboard focus
		// in which case the key press events should go only to it.
		if(have_keyboard_focus()) {
			if(event.key.keysym.sym == SDLK_ESCAPE) {
				hotkey::execute_command(get_display(), quit_hotkey, get_hotkey_command_executor());
				break;
			}

			process_keydown_event(event);
			hotkey::key_event(get_display(), event, get_hotkey_command_executor());
		} else {
			process_focus_keydown_event(event);
			break;
		}
		// intentionally fall-through
	case SDL_KEYUP:
		process_keyup_event(event);
		break;
	case SDL_JOYBUTTONDOWN:
		process_keydown_event(event);
		hotkey::jbutton_event(get_display(), event, get_hotkey_command_executor());
		break;
	case SDL_JOYHATMOTION:
		process_keydown_event(event);
		hotkey::jhat_event(get_display(), event, get_hotkey_command_executor());
		break;
	case SDL_MOUSEMOTION:
		// Ignore old mouse motion events in the event queue
		SDL_Event new_event;
		if(SDL_PeepEvents(&new_event,1,SDL_GETEVENT,
					SDL_EVENTMASK(SDL_MOUSEMOTION)) > 0) {
			while(SDL_PeepEvents(&new_event,1,SDL_GETEVENT,
						SDL_EVENTMASK(SDL_MOUSEMOTION)) > 0) {};
			get_mouse_handler_base().mouse_motion_event(new_event.motion, is_browsing());
		} else {
			get_mouse_handler_base().mouse_motion_event(event.motion, is_browsing());
		}
		break;
	case SDL_MOUSEBUTTONDOWN:
		process_keydown_event(event);
		get_mouse_handler_base().mouse_press(event.button, is_browsing());
		if (get_mouse_handler_base().get_show_menu()){
			show_menu(get_display().get_theme().context_menu()->items(),event.button.x,event.button.y,true, get_display());
		}
		hotkey::mbutton_event(get_display(), event, get_hotkey_command_executor());
		break;
	case SDL_MOUSEBUTTONUP:
		get_mouse_handler_base().mouse_press(event.button, is_browsing());
		if (get_mouse_handler_base().get_show_menu()){
			show_menu(get_display().get_theme().context_menu()->items(),event.button.x,event.button.y,true, get_display());
		}
		break;
#if !SDL_VERSION_ATLEAST(2, 0, 0)
	case SDL_ACTIVEEVENT:
		if (event.active.state == SDL_APPMOUSEFOCUS && event.active.gain == 0) {
			if (get_mouse_handler_base().is_dragging()) {
				//simulate mouse button up when the app has lost mouse focus
				//this should be a general fix for the issue when the mouse
				//is dragged out of the game window and then the button is released
				int x, y;
				Uint8 mouse_flags = SDL_GetMouseState(&x, &y);
				if ((mouse_flags & SDL_BUTTON_LEFT) == 0) {
					get_mouse_handler_base().mouse_press(event.button, is_browsing());
				}
			}
		}
		break;
#endif
#if SDL_VERSION_ATLEAST(2,0,0)
	case SDL_MOUSEWHEEL:
		get_mouse_handler_base().mouse_wheel(event.wheel.x, event.wheel.y, is_browsing());
		break;
#endif
	default:
		break;
	}
}
Beispiel #6
0
void controller_base::play_slice(bool is_delay_enabled)
{
	CKey key;

	if (plugins_context *l = get_plugins_context()) {
		l->play_slice();
	}

	events::pump();
	events::raise_process_event();
	events::raise_draw_event();

	// Update sound sources before scrolling
	if (soundsource::manager *l = get_soundsource_man()) {
		l->update();
	}

	const theme::menu* const m = get_display().menu_pressed();
	if(m != NULL) {
		const SDL_Rect& menu_loc = m->location(get_display().screen_area());
		show_menu(m->items(),menu_loc.x+1,menu_loc.y + menu_loc.h + 1,false, get_display());

		return;
	}
	const theme::action* const a = get_display().action_pressed();
	if(a != NULL) {
		const SDL_Rect& action_loc = a->location(get_display().screen_area());
		execute_action(a->items(), action_loc.x+1, action_loc.y + action_loc.h + 1,false);

		return;
	}

	bool was_scrolling = scrolling_;

	std::pair<double, double> values = joystick_manager_.get_scroll_axis_pair();
	const double joystickx = values.first;
	const double joysticky = values.second;

	int mousex, mousey;
	Uint8 mouse_flags = SDL_GetMouseState(&mousex, &mousey);

	/* TODO fendrin enable after an axis choosing mechanism is implemented
	std::pair<double, double> values = joystick_manager_.get_mouse_axis_pair();
	mousex += values.first * 10;
	mousey += values.second * 10;
	SDL_WarpMouse(mousex, mousey);
	*/
	scrolling_ = handle_scroll(key, mousex, mousey, mouse_flags, joystickx, joysticky);

	map_location highlighted_hex = get_display().mouseover_hex();

	/* TODO fendrin enable when the relative cursor movement is implemented well enough
	const map_location& selected_hex = get_display().selected_hex();

	if (selected_hex != map_location::null_location()) {
		if (joystick_manager_.next_highlighted_hex(highlighted_hex, selected_hex)) {
			get_mouse_handler_base().mouse_motion(0,0, true, true, highlighted_hex);
			get_display().scroll_to_tile(highlighted_hex, display::ONSCREEN_WARP, false, true);
			scrolling_ = true;
		}
	} else */

	if (joystick_manager_.update_highlighted_hex(highlighted_hex)
			&& get_display().get_map().on_board(highlighted_hex)) {
		get_mouse_handler_base().mouse_motion(0,0, true, true, highlighted_hex);
		get_display().scroll_to_tile(highlighted_hex, display::ONSCREEN_WARP, false, true);
		scrolling_ = true;
		}

	get_display().draw();

	// be nice when window is not visible
	// NOTE should be handled by display instead, to only disable drawing
	if (is_delay_enabled && (SDL_GetAppState() & SDL_APPACTIVE) == 0) {
		get_display().delay(200);
	}

	if (!scrolling_ && was_scrolling) {
		// scrolling ended, update the cursor and the brightened hex
		get_mouse_handler_base().mouse_update(is_browsing(), highlighted_hex);
	}
}
Beispiel #7
0
bool controller_base::handle_scroll(CKey& key, int mousex, int mousey, int mouse_flags, double x_axis, double y_axis)
{
	bool mouse_in_window = (SDL_GetAppState() & SDL_APPMOUSEFOCUS) != 0
		|| preferences::get("scroll_when_mouse_outside", true);
	bool keyboard_focus = have_keyboard_focus();
	int scroll_speed = preferences::scroll_speed();
	int dx = 0, dy = 0;
	int scroll_threshold = (preferences::mouse_scroll_enabled())
		? preferences::mouse_scroll_threshold() : 0;
	BOOST_FOREACH(const theme::menu& m, get_display().get_theme().menus()) {
		if (sdl::point_in_rect(mousex, mousey, m.get_location())) {
			scroll_threshold = 0;
		}
	}
	if ((key[SDLK_UP] && keyboard_focus) ||
	    (mousey < scroll_threshold && mouse_in_window))
	{
		dy -= scroll_speed;
	}
	if ((key[SDLK_DOWN] && keyboard_focus) ||
	    (mousey > get_display().h() - scroll_threshold && mouse_in_window))
	{
		dy += scroll_speed;
	}
	if ((key[SDLK_LEFT] && keyboard_focus) ||
	    (mousex < scroll_threshold && mouse_in_window))
	{
		dx -= scroll_speed;
	}
	if ((key[SDLK_RIGHT] && keyboard_focus) ||
	    (mousex > get_display().w() - scroll_threshold && mouse_in_window))
	{
		dx += scroll_speed;
	}
	if ((mouse_flags & SDL_BUTTON_MMASK) != 0 && preferences::middle_click_scrolls()) {
		const map_location original_loc = get_mouse_handler_base().get_scroll_start();

		if (get_mouse_handler_base().scroll_started()) {
			const SDL_Rect& rect = get_display().map_outside_area();
			if (sdl::point_in_rect(mousex, mousey,rect) &&
				get_mouse_handler_base().scroll_started()) {
				// Scroll speed is proportional from the distance from the first
				// middle click and scrolling speed preference.
				const double speed = 0.04 * sqrt(static_cast<double>(scroll_speed));
				const double snap_dist = 16; // Snap to horizontal/vertical scrolling
				const double x_diff = (mousex - original_loc.x);
				const double y_diff = (mousey - original_loc.y);

				if (fabs(x_diff) > snap_dist || fabs(y_diff) <= snap_dist) dx += speed * x_diff;
				if (fabs(y_diff) > snap_dist || fabs(x_diff) <= snap_dist) dy += speed * y_diff;
			}
		}
		else { // Event may fire mouse down out of order with respect to initial click
			get_mouse_handler_base().set_scroll_start(mousex, mousey);
		}
	}

	dx += round_double( x_axis * scroll_speed);
	dy += round_double( y_axis * scroll_speed);

	return get_display().scroll(dx, dy);
}
Beispiel #8
0
void controller_base::handle_event(const SDL_Event& event)
{
	if(gui::in_dialog()) {
		return;
	}

	switch(event.type) {
	case SDL_KEYDOWN:
		// Detect key press events, unless there something that has keyboard focus
		// in which case the key press events should go only to it.
		if(have_keyboard_focus()) {
			process_keydown_event(event);
			hotkey::key_event(get_display(), event.key,this);
		} else {
			process_focus_keydown_event(event);
			break;
		}
		// intentionally fall-through
	case SDL_KEYUP:
		process_keyup_event(event);
		break;
	case SDL_JOYBUTTONDOWN:
		process_keydown_event(event);
		hotkey::jbutton_event(get_display(), event.jbutton, this);
		break;
	case SDL_JOYHATMOTION:
		process_keydown_event(event);
		hotkey::jhat_event(get_display(), event.jhat, this);
		break;
	case SDL_MOUSEMOTION:
		// Ignore old mouse motion events in the event queue
		SDL_Event new_event;
		if(SDL_PeepEvents(&new_event,1,SDL_GETEVENT,
					SDL_EVENTMASK(SDL_MOUSEMOTION)) > 0) {
			while(SDL_PeepEvents(&new_event,1,SDL_GETEVENT,
						SDL_EVENTMASK(SDL_MOUSEMOTION)) > 0) {};
			get_mouse_handler_base().mouse_motion_event(new_event.motion, browse_);
		} else {
			get_mouse_handler_base().mouse_motion_event(event.motion, browse_);
		}
		break;
	case SDL_MOUSEBUTTONDOWN:
		process_keydown_event(event);
		hotkey::mbutton_event(get_display(), event.button, this);
		// intentionally fall-through
	case SDL_MOUSEBUTTONUP:
		get_mouse_handler_base().mouse_press(event.button, browse_);
		if (get_mouse_handler_base().get_show_menu()){
			show_menu(get_display().get_theme().context_menu()->items(),event.button.x,event.button.y,true);
		}
		break;
	case SDL_ACTIVEEVENT:
		if (event.active.state == SDL_APPMOUSEFOCUS && event.active.gain == 0) {
			if (get_mouse_handler_base().is_dragging()) {
				//simulate mouse button up when the app has lost mouse focus
				//this should be a general fix for the issue when the mouse
				//is dragged out of the game window and then the button is released
				int x, y;
				Uint8 mouse_flags = SDL_GetMouseState(&x, &y);
				if ((mouse_flags & SDL_BUTTON_LEFT) == 0) {
					get_mouse_handler_base().mouse_press(event.button, browse_);
				}
			}
		}
		break;
	default:
		break;
	}
}
Beispiel #9
0
void controller_base::handle_event(const SDL_Event& event)
{
	if (gui::in_dialog()) {
		return;
	}

#if (defined(__APPLE__) && TARGET_OS_IPHONE) || defined(ANDROID)
	if ((event.type == SDL_MOUSEBUTTONDOWN) || (event.type == SDL_FINGERDOWN)) {
		wait_bh_event_ = true;
		return;
	}
	if (event.type == SDL_MOUSEMOTION) {
		return;
	}
	if (event.type == SDL_MOUSEBUTTONUP) {
		return;
	}
#endif
	SDL_Event new_event;
	int abs_dx, abs_dy;
	// events::mouse_handler& mouse_handler = get_mouse_handler_base();

	switch(event.type) {
	case SDL_KEYDOWN:
		// Detect key press events, unless there something that has keyboard focus
		// in which case the key press events should go only to it.
		if(have_keyboard_focus()) {
			process_keydown_event(event);
			hotkey::key_event(get_display(),event.key,this);
		} else {
			process_focus_keydown_event(event);
			break;
		}
		// intentionally fall-through
	case SDL_KEYUP:
		process_keyup_event(event);
		break;

	case SDL_FINGERMOTION:
		abs_dx = posix_abs(event.tfinger.dx);
		abs_dy = posix_abs(event.tfinger.dy);
		if (abs_dx <= FINGER_HIT_THRESHOLD && abs_dy <= FINGER_HIT_THRESHOLD) {
			break;
		}
		if (abs_dx >= FINGER_MOTION_THRESHOLD && abs_dy >= FINGER_MOTION_THRESHOLD) {
			if (event.tfinger.dx > 0) {
				if (event.tfinger.dy > 0) {
					finger_motion_direction_ = SOUTH_EAST;
				} else {
					finger_motion_direction_ = NORTH_EAST;
				}
			} else if (event.tfinger.dy >= 0) {
				finger_motion_direction_ = SOUTH_WEST;
			} else {
				finger_motion_direction_ = NORTH_WEST;
			}
			finger_motion_scroll_ = true;
		} else if (abs_dx >= abs_dy && abs_dx >= FINGER_MOTION_THRESHOLD) {
			// x axis
			if (event.tfinger.dx > 0) {
				finger_motion_direction_ = RIGHT;
			} else {
				finger_motion_direction_ = LEFT;
			}
			finger_motion_scroll_ = true;
		} else if (abs_dx < abs_dy && abs_dy >= FINGER_MOTION_THRESHOLD) {
			// y axis
			if (event.tfinger.dy > 0) {
				finger_motion_direction_ = DOWN;
			} else {
				finger_motion_direction_ = UP;
			}
			finger_motion_scroll_ = true;
		}
		wait_bh_event_ = false;
		break;

	case SDL_MOUSEMOTION:
		// Ignore old mouse motion events in the event queue
		if (SDL_PeepEvents(&new_event,1,SDL_GETEVENT, SDL_MOUSEMOTIONMASK) > 0) {
			while(SDL_PeepEvents(&new_event,1,SDL_GETEVENT, SDL_MOUSEMOTIONMASK) > 0) {};
			get_mouse_handler_base().mouse_motion_event(new_event.motion, browse_);
		} else {
			get_mouse_handler_base().mouse_motion_event(event.motion, browse_);
		}
		break;
	case SDL_FINGERUP:
		if (!wait_bh_event_) {
			break;
		}
		// simulate SDL_MOUSEBUTTONDOWN
		new_event = event;
		new_event.button.button = SDL_BUTTON_LEFT;
		new_event.button.state = SDL_PRESSED;
		new_event.button.x = event.tfinger.x;
		new_event.button.y = event.tfinger.y;
		// SDL_SendMouseMotion(NULL, 0, event.tfinger.x, event.tfinger.y);
		do {
			get_mouse_handler_base().mouse_press(new_event.button, browse_);
			post_mouse_press(new_event);
			if (get_mouse_handler_base().get_show_menu()){
				get_display().goto_main_context_menu();
			}
			if (new_event.button.state == SDL_RELEASED) {
				break;
			}
			new_event.button.state = SDL_RELEASED;
		} while (true);
		wait_bh_event_ = false;
		break;

	case SDL_MOUSEBUTTONDOWN:
	case SDL_MOUSEBUTTONUP:
		get_mouse_handler_base().mouse_press(event.button, browse_);
		post_mouse_press(event);
		if (get_mouse_handler_base().get_show_menu()){
			get_display().goto_main_context_menu();
		}
		break;
	case SDL_ACTIVEEVENT:
		if (event.active.type == SDL_APPMOUSEFOCUS && event.active.gain == 0) {
			if (get_mouse_handler_base().is_dragging()) {
				//simulate mouse button up when the app has lost mouse focus
				//this should be a general fix for the issue when the mouse
				//is dragged out of the game window and then the button is released
				int x, y;
				Uint8 mouse_flags = SDL_GetMouseState(&x, &y);
				if ((mouse_flags & SDL_BUTTON_LEFT) == 0) {
					SDL_Event e;
					e.type = SDL_MOUSEBUTTONUP;
					e.button.state = SDL_RELEASED;
					e.button.button = SDL_BUTTON_LEFT;
					e.button.x = x;
					e.button.y = y;
					get_mouse_handler_base().mouse_press(event.button, browse_);
					post_mouse_press(event);
				}
			}
		}
		break;
	default:
		break;
	}
}
Beispiel #10
0
void controller_base::play_slice(bool is_delay_enabled)
{
	display& gui = get_display();

	CKey key;
	events::pump();
	events::raise_process_event();
	events::raise_draw_event();

	slice_before_scroll();
// const theme::menu* const m = get_display().menu_pressed();
	const button_loc& loc = get_display().menu_pressed();
	const theme::menu* m = loc.first;
	if (m && (m == gui.access_troop_menu())) {
		map_location pressed_loc = gui.access_unit_press(loc.second);
		if (pressed_loc.valid() && !get_mouse_handler_base().is_moving() && !get_mouse_handler_base().is_recalling() && !get_mouse_handler_base().is_building() && !get_mouse_handler_base().is_card_playing()) {
			gui.scroll_to_tile(pressed_loc, display::WARP);
			events::mouse_handler::get_singleton()->select_hex(map_location(), false);
			// gui.select_hex(pressed_loc);
			// sound::play_UI_sound("select-unit.wav");
			resources::units->find(pressed_loc)->set_selecting();
			resources::screen->invalidate_unit();
			// now, selectedHex_ is invalid, hide context menu.
			gui.goto_main_context_menu();			
		}
	} else if (m != NULL){
		const SDL_Rect& menu_loc = m->location(get_display().screen_area());
		if (m->is_context()) {
			// Is pressed menu a father menu of context-menu?
			const std::string& item = m->items()[loc.second];
			std::vector<std::string> item2 = utils::split(item, ':');
			if (item2.size() == 1) {
				// item2.push_back(item2[0]) is wrong way, resulting item2[1] is null string.
				item2.push_back("");
			}
			size_t pos = item2[0].rfind("_m");
			if (pos == item2[0].size() - 2) {
				// cancel current menu, and display sub-menu
				gui.hide_context_menu(NULL, true);
				const std::string item1 = item2[0].substr(0, pos);
				gui.get_theme().set_current_context_menu(get_display().get_theme().context_menu(item1));
				show_context_menu(NULL, get_display());
			} else {
				// execute one menu command
				pos = item2[0].rfind("_c");
				if (pos == item2[0].size() - 2) {
					const std::string item1 = item2[0].substr(0, pos);
					// hotkey::execute_command(gui, hotkey::get_hotkey(item1).get_id(), this, -1, item2[1]);
					execute_command(hotkey::get_hotkey(item1).get_id(), -1, item2[1]);
					gui.hide_context_menu(NULL, true);
				} else {
					// hotkey::execute_command(gui, hotkey::get_hotkey(item2[0]).get_id(), this, -1, item2[1]);
					execute_command(hotkey::get_hotkey(item2[0]).get_id(), -1, item2[1]);
				}
			}
		} else {
			show_menu(m->items(), menu_loc.x+1, menu_loc.y + menu_loc.h + 1, false);
		}
		return;
	}

	int mousex, mousey;
	Uint8 mouse_flags = SDL_GetMouseState(&mousex, &mousey);
	bool was_scrolling = scrolling_;
	scrolling_ = handle_scroll(key, mousex, mousey, mouse_flags);

	get_display().draw();

	// be nice when window is not visible
	// NOTE should be handled by display instead, to only disable drawing
	if (is_delay_enabled && (SDL_GetAppState() & SDL_APPACTIVE) == 0) {
		get_display().delay(200);
	}

	if (!scrolling_ && was_scrolling) {
#if (defined(__APPLE__) && TARGET_OS_IPHONE) || defined(ANDROID)
		// swip result to scroll, don't update mouse hex.
		SDL_Event new_event;
		while(SDL_PeepEvents(&new_event, 1, SDL_GETEVENT, SDL_FINGERMOTION, SDL_FINGERMOTION) > 0) {
			posix_print("SDL_FINGERMOTION(discard), (x, y): (%u, %u), (dx, dy): (%i, %i)\n", 
				new_event.tfinger.x, new_event.tfinger.y, new_event.tfinger.dx, new_event.tfinger.dy);
		};
#else
		// scrolling ended, update the cursor and the brightened hex
		get_mouse_handler_base().mouse_update(browse_);
#endif
	}
	slice_end();
}