mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-11 03:06:59 +00:00
Add some debug info.
Fix a bug where every click was a left click. Middle click in a text box now pastes on UNIX systems. Pasting only works withing Wesnoth.
This commit is contained in:
parent
5de36bcee4
commit
dae63c82da
@ -144,12 +144,15 @@ void tevent_handler::handle_event(const SDL_Event& event)
|
|||||||
|
|
||||||
switch(event.button.button) {
|
switch(event.button.button) {
|
||||||
case SDL_BUTTON_LEFT :
|
case SDL_BUTTON_LEFT :
|
||||||
|
DBG_G_E << "Event: Left button down.\n";
|
||||||
mouse_button_down(event, mouse_over, left_);
|
mouse_button_down(event, mouse_over, left_);
|
||||||
break;
|
break;
|
||||||
case SDL_BUTTON_MIDDLE :
|
case SDL_BUTTON_MIDDLE :
|
||||||
|
DBG_G_E << "Event: Middle button down.\n";
|
||||||
mouse_button_down(event, mouse_over, middle_);
|
mouse_button_down(event, mouse_over, middle_);
|
||||||
break;
|
break;
|
||||||
case SDL_BUTTON_RIGHT :
|
case SDL_BUTTON_RIGHT :
|
||||||
|
DBG_G_E << "Event: Right button down.\n";
|
||||||
mouse_button_down(event, mouse_over, right_);
|
mouse_button_down(event, mouse_over, right_);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -171,12 +174,15 @@ void tevent_handler::handle_event(const SDL_Event& event)
|
|||||||
switch(event.button.button) {
|
switch(event.button.button) {
|
||||||
|
|
||||||
case SDL_BUTTON_LEFT :
|
case SDL_BUTTON_LEFT :
|
||||||
|
DBG_G_E << "Event: Left button up.\n";
|
||||||
mouse_button_up(event, mouse_over, left_);
|
mouse_button_up(event, mouse_over, left_);
|
||||||
break;
|
break;
|
||||||
case SDL_BUTTON_MIDDLE :
|
case SDL_BUTTON_MIDDLE :
|
||||||
|
DBG_G_E << "Event: Middle button up.\n";
|
||||||
mouse_button_up(event, mouse_over, middle_);
|
mouse_button_up(event, mouse_over, middle_);
|
||||||
break;
|
break;
|
||||||
case SDL_BUTTON_RIGHT :
|
case SDL_BUTTON_RIGHT :
|
||||||
|
DBG_G_E << "Event: Right button up.\n";
|
||||||
mouse_button_up(event, mouse_over, right_);
|
mouse_button_up(event, mouse_over, right_);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -359,7 +365,7 @@ void tevent_handler::mouse_leave(const SDL_Event& /*event*/, twidget* /*mouse_ov
|
|||||||
mouse_focus_ = 0;
|
mouse_focus_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tevent_handler::mouse_button_down(const SDL_Event& event, twidget* mouse_over, tmouse_button& button)
|
void tevent_handler::mouse_button_down(const SDL_Event& /*event*/, twidget* mouse_over, tmouse_button& button)
|
||||||
{
|
{
|
||||||
if(button.is_down) {
|
if(button.is_down) {
|
||||||
WRN_G_E << "In 'button down' for button '" << button.name
|
WRN_G_E << "In 'button down' for button '" << button.name
|
||||||
@ -440,7 +446,7 @@ void tevent_handler::mouse_click(twidget* widget, tmouse_button& button)
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
widget->mouse_left_button_click(*this);
|
(widget->*button.click)(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,6 +101,16 @@ void ttext_::mouse_left_button_double_click(tevent_handler&)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ttext_::mouse_middle_button_click(tevent_handler&)
|
||||||
|
{
|
||||||
|
DBG_G_E << "Text_box: middle mouse button click.\n";
|
||||||
|
#ifdef __unix__
|
||||||
|
// pastes on UNIX systems.
|
||||||
|
paste_selection();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void ttext_::key_press(tevent_handler& /*event*/, bool& handled, SDLKey key, SDLMod modifier, Uint16 unicode)
|
void ttext_::key_press(tevent_handler& /*event*/, bool& handled, SDLKey key, SDLMod modifier, Uint16 unicode)
|
||||||
{
|
{
|
||||||
DBG_G_E << "Text_box: key press.\n";
|
DBG_G_E << "Text_box: key press.\n";
|
||||||
|
@ -48,6 +48,8 @@ public:
|
|||||||
void mouse_left_button_up(tevent_handler&);
|
void mouse_left_button_up(tevent_handler&);
|
||||||
void mouse_left_button_double_click(tevent_handler&);
|
void mouse_left_button_double_click(tevent_handler&);
|
||||||
|
|
||||||
|
void mouse_middle_button_click(tevent_handler&);
|
||||||
|
|
||||||
void key_press(tevent_handler& event, bool& handled, SDLKey key, SDLMod modifier, Uint16 unicode);
|
void key_press(tevent_handler& event, bool& handled, SDLKey key, SDLMod modifier, Uint16 unicode);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user