mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-04 05:31:16 +00:00
Send the SDL mouse motion properly.
This way a dispatcher can intercept and block the signal, which allows resending the signal in a different fashion (which is wanted for some nested widgets.).
This commit is contained in:
parent
f4b58c9b0b
commit
c896be2ee8
@ -834,7 +834,7 @@ void tevent_handler::connect()
|
||||
w.event::tdispatcher::connect();
|
||||
|
||||
w.connect_signal<event::SDL_MOUSE_MOTION>(
|
||||
boost::bind(&tevent_handler::sdl_mouse_motion, this, _5));
|
||||
boost::bind(&tevent_handler::sdl_mouse_motion, this, _2, _5));
|
||||
|
||||
|
||||
w.connect_signal<event::SDL_LEFT_BUTTON_DOWN>(
|
||||
@ -857,12 +857,22 @@ void tevent_handler::connect()
|
||||
boost::bind(&tevent_handler::sdl_key_down, this, _5, _6, _7));
|
||||
}
|
||||
|
||||
void tevent_handler::sdl_mouse_motion(const tpoint& coordinate)
|
||||
void tevent_handler::sdl_mouse_motion(
|
||||
const event::tevent event
|
||||
, const tpoint& coordinate)
|
||||
{
|
||||
if(mouse_captured_) {
|
||||
mouse_motion(mouse_focus_, coordinate);
|
||||
assert(mouse_focus_);
|
||||
if(!get_window().fire(event, *mouse_focus_, coordinate)) {
|
||||
mouse_motion(mouse_focus_, coordinate);
|
||||
}
|
||||
} else {
|
||||
twidget* mouse_over = find_at(coordinate, true);
|
||||
if(mouse_over
|
||||
&& get_window().fire(event, *mouse_over, coordinate)) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(!mouse_focus_ && mouse_over) {
|
||||
mouse_enter(mouse_over);
|
||||
|
@ -493,7 +493,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
void sdl_mouse_motion(const tpoint& coordinate);
|
||||
void sdl_mouse_motion(const event::tevent event, const tpoint& coordinate);
|
||||
void sdl_left_button_down(const tpoint& coordinate);
|
||||
void sdl_left_button_up(const tpoint& coordinate);
|
||||
void sdl_middle_button_down(const tpoint& coordinate);
|
||||
|
Loading…
x
Reference in New Issue
Block a user