[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src show_dialog.cpp widgets/menu.cpp wi...
From: |
Philippe Plantier |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src show_dialog.cpp widgets/menu.cpp wi... |
Date: |
Sun, 21 Aug 2005 10:16:30 -0400 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Philippe Plantier <address@hidden> 05/08/21 14:16:30
Modified files:
src : show_dialog.cpp
src/widgets : menu.cpp menu.hpp
Log message:
* Menus now require keyboard focus to be able to respond to the HOME,
END, etc. keys.
* Menus are now able to acquire keyboard focus.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/show_dialog.cpp.diff?tr1=1.137&tr2=1.138&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/menu.cpp.diff?tr1=1.98&tr2=1.99&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/menu.hpp.diff?tr1=1.40&tr2=1.41&r1=text&r2=text
Patches:
Index: wesnoth/src/show_dialog.cpp
diff -u wesnoth/src/show_dialog.cpp:1.137 wesnoth/src/show_dialog.cpp:1.138
--- wesnoth/src/show_dialog.cpp:1.137 Fri Aug 5 22:23:42 2005
+++ wesnoth/src/show_dialog.cpp Sun Aug 21 14:16:30 2005
@@ -1,4 +1,4 @@
-/* $Id: show_dialog.cpp,v 1.137 2005/08/05 22:23:42 j_daniel Exp $ */
+/* $Id: show_dialog.cpp,v 1.138 2005/08/21 14:16:30 gruikya Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -669,9 +669,7 @@
CKey key;
- bool left_button = true, right_button = true, key_down = true,
- up_arrow = false, down_arrow = false,
- page_up = false, page_down = false;
+ bool left_button = true, right_button = true, key_down = true;
disp.invalidate_all();
@@ -693,12 +691,6 @@
const bool new_key_down = key[SDLK_SPACE] || key[SDLK_RETURN] ||
key[SDLK_ESCAPE];
- const bool new_up_arrow = key[SDLK_UP] != 0;
- const bool new_down_arrow = key[SDLK_DOWN] != 0;
-
- const bool new_page_up = key[SDLK_PAGEUP] != 0;
- const bool new_page_down = key[SDLK_PAGEDOWN] != 0;
-
if((!key_down && key[SDLK_RETURN] || menu_.double_clicked()) &&
(type == YES_NO || type == OK_CANCEL || type == OK_ONLY ||
type == CLOSE_ONLY)) {
@@ -754,11 +746,6 @@
return res;
}
}
-
- up_arrow = new_up_arrow;
- down_arrow = new_down_arrow;
- page_up = new_page_up;
- page_down = new_page_down;
events::raise_process_event();
events::raise_draw_event();
Index: wesnoth/src/widgets/menu.cpp
diff -u wesnoth/src/widgets/menu.cpp:1.98 wesnoth/src/widgets/menu.cpp:1.99
--- wesnoth/src/widgets/menu.cpp:1.98 Wed Jul 20 08:56:52 2005
+++ wesnoth/src/widgets/menu.cpp Sun Aug 21 14:16:30 2005
@@ -1,4 +1,4 @@
-/* $Id: menu.cpp,v 1.98 2005/07/20 08:56:52 ott Exp $ */
+/* $Id: menu.cpp,v 1.99 2005/08/21 14:16:30 gruikya Exp $ */
/*
Copyright (C) 2003-5 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -524,10 +524,13 @@
{
scrollarea::handle_event(event);
if(event.type == SDL_KEYDOWN) {
- key_press(event.key.keysym.sym);
+ // Only pass key events if we have the focus
+ if (focus())
+ key_press(event.key.keysym.sym);
} else if(event.type == SDL_MOUSEBUTTONDOWN &&
event.button.button == SDL_BUTTON_LEFT ||
event.type == DOUBLE_CLICK_EVENT) {
+
int x = 0;
int y = 0;
if(event.type == SDL_MOUSEBUTTONDOWN) {
@@ -540,6 +543,7 @@
const int item = hit(x,y);
if(item != -1) {
+ set_focus(true);
move_selection(item);
if(click_selects_) {
Index: wesnoth/src/widgets/menu.hpp
diff -u wesnoth/src/widgets/menu.hpp:1.40 wesnoth/src/widgets/menu.hpp:1.41
--- wesnoth/src/widgets/menu.hpp:1.40 Wed Jul 20 08:56:52 2005
+++ wesnoth/src/widgets/menu.hpp Sun Aug 21 14:16:30 2005
@@ -1,4 +1,4 @@
-/* $Id: menu.hpp,v 1.40 2005/07/20 08:56:52 ott Exp $ */
+/* $Id: menu.hpp,v 1.41 2005/08/21 14:16:30 gruikya Exp $ */
/*
Copyright (C) 2003-5 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -122,6 +122,8 @@
protected:
void handle_event(const SDL_Event& event);
void set_inner_location(const SDL_Rect& rect);
+
+ bool requires_event_focus() const { return true; };
private:
size_t max_items_onscreen() const;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth/src show_dialog.cpp widgets/menu.cpp wi...,
Philippe Plantier <=