mail[Wesnoth-commits] r33589 - /trunk/src/preferences_display.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by alinktomine on March 13, 2009 - 03:07:
Author: alink
Date: Fri Mar 13 03:07:45 2009
New Revision: 33589

URL: http://svn.gna.org/viewcvs/wesnoth?rev=33589&view=rev
Log:
Fix escape for cancelling hotkey assignment.
(at least on my side, where it seems that a keyboard mod=4096 is always 
active)

Modified:
    trunk/src/preferences_display.cpp

Modified: trunk/src/preferences_display.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/preferences_display.cpp?rev=33589&r1=33588&r2=33589&view=diff
==============================================================================
--- trunk/src/preferences_display.cpp (original)
+++ trunk/src/preferences_display.cpp Fri Mar 13 03:07:45 2009
@@ -283,7 +283,9 @@
                        SDL_Event event;
                        event.type = 0;
                        int character=0,keycode=0; // Just to avoid warning
-                       int mod=0;
+                       int mod = 0;
+                       const int any_mod = KMOD_CTRL | KMOD_ALT | KMOD_LMETA;
+
                        while (event.type!=SDL_KEYDOWN) SDL_PollEvent(&event);
                        do {
                                if (event.type==SDL_KEYDOWN)
@@ -298,8 +300,7 @@
                        } while (event.type!=SDL_KEYUP);
                        restorer.restore();
                        disp.update_display();
-
-                       if (keycode == SDLK_ESCAPE && mod == 0) {
+                       if (keycode == SDLK_ESCAPE && (mod & any_mod) == 0) {
                                //cancel -- no action
                        } else {
                                const hotkey::hotkey_item& oldhk = 
hotkey::get_hotkey(character, keycode, (mod & KMOD_SHIFT) != 0,
@@ -320,8 +321,7 @@
 
                                        if ((newhk.get_id() == 
hotkey::HOTKEY_SCREENSHOT
                                                        || newhk.get_id() == 
hotkey::HOTKEY_MAP_SCREENSHOT)
-                                                        && (mod & KMOD_CTRL) 
== 0 && (mod & KMOD_ALT) == 0
-                                                        && (mod & 
KMOD_LMETA) == 0) {
+                                                        && (mod & any_mod) 
== 0) {
                                                gui::message_dialog(disp,"", 
_("Warning: screenshot hotkeys not combined with Control, Alt or Meta 
keys.")).show();
                                        }
                                }




Related Messages


Powered by MHonArc, Updated Fri Mar 13 03:20:14 2009