Author: alink
Date: Sun Apr 8 03:00:01 2007
New Revision: 16683
URL: http://svn.gna.org/viewcvs/wesnoth?rev=16683&view=rev
Log:
* Add a function to send a fake mouse motion to update the mouse (cursor
and effect on hex)
* Use it to update the highlighted hex after (middle and wheel) mouse
scrolling, without need to move the mouse anymore.
Modified:
trunk/src/mouse_events.cpp
trunk/src/mouse_events.hpp
Modified: trunk/src/mouse_events.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/mouse_events.cpp?rev=16683&r1=16682&r2=16683&view=diff
==============================================================================
--- trunk/src/mouse_events.cpp (original)
+++ trunk/src/mouse_events.cpp Sun Apr 8 03:00:01 2007
@@ -694,6 +694,13 @@
void mouse_handler::mouse_motion(const SDL_MouseMotionEvent& event, const bool
browse)
{
mouse_motion(event.x,event.y, browse);
+}
+
+void mouse_handler::mouse_update(const bool browse)
+{
+ int x, y;
+ SDL_GetMouseState(&x,&y);
+ mouse_motion(x, y, browse);
}
void mouse_handler::mouse_motion(int x, int y, const bool browse)
@@ -919,7 +926,7 @@
void mouse_handler::mouse_press(const SDL_MouseButtonEvent& event, const bool
browse)
{
show_menu_ = false;
- mouse_motion(event.x, event.y, browse);
+ mouse_update(browse);
if(is_left_click(event) && event.state == SDL_RELEASED) {
minimap_scrolling_ = false;
@@ -979,6 +986,7 @@
const int ydisp = event.y - centery;
gui_->scroll(xdisp,ydisp);
+ mouse_update(browse);
}
} else if((event.button == SDL_BUTTON_WHEELUP ||
event.button == SDL_BUTTON_WHEELDOWN) && !commands_disabled) {
@@ -995,6 +1003,7 @@
gui_->scroll(speed,0);
else
gui_->scroll(0,speed);
+ mouse_update(browse);
}
if (!dragging_ && dragging_started_) {
dragging_started_ = false;
@@ -1458,9 +1467,7 @@
current_route_.steps.clear();
gui_->set_route(NULL);
last_hex_=gamemap::location(-1,-1);
- int mousex, mousey;
- SDL_GetMouseState(&mousex, &mousey);
- mouse_motion(mousex, mousey, true);
+ mouse_update(true);
show_attack_options(it);
game_events::fire("select",selected_hex_);
}
Modified: trunk/src/mouse_events.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/mouse_events.hpp?rev=16683&r1=16682&r2=16683&view=diff
==============================================================================
--- trunk/src/mouse_events.hpp (original)
+++ trunk/src/mouse_events.hpp Sun Apr 8 03:00:01 2007
@@ -39,6 +39,8 @@
gamestatus& status, const game_data& gameinfo, undo_list&
undo_stack, undo_list& redo_stack);
void set_team(const int team_number);
void mouse_motion(const SDL_MouseMotionEvent& event, const bool browse);
+ // update the mouse with a fake mouse motion
+ void mouse_update(const bool browse);
void mouse_press(const SDL_MouseButtonEvent& event, const bool browse);
void cycle_units();
void cycle_back_units();
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits