Ticket #3194: alternative.patch
File alternative.patch, 2.6 KB (added by , 7 years ago) |
---|
-
source/gui/CGUI.cpp
InReaction CGUI::HandleEvent(const SDL_E 73 73 74 74 std::map<CStr, std::vector<IGUIObject*> >::iterator it = m_HotkeyObjects.find(hotkey); 75 75 if (it != m_HotkeyObjects.end()) 76 76 for (IGUIObject* const& obj : it->second) 77 77 { 78 // Update hotkey status before sending the event, 79 // else the status will be outdated when processing the GUI event. 80 HotkeyInputHandler(ev); 81 ret = IN_HANDLED; 82 83 if (ev->ev.type == SDL_HOTKEYDOWN) 84 obj->SendEvent(GUIM_PRESSED, "press"); 85 else 86 obj->SendEvent(GUIM_RELEASED, "release"); 78 if ((ev->ev.type == SDL_HOTKEYDOWN && obj->SendEvent(GUIM_PRESSED, "press") == IN_HANDLED) || 79 (ev->ev.type == SDL_HOTKEYUP && obj->SendEvent(GUIM_RELEASED, "release") == IN_HANDLED)) 80 { 81 ret = IN_HANDLED; 82 } 87 83 } 88 84 } 89 85 90 86 else if (ev->ev.type == SDL_MOUSEMOTION) 91 87 { -
source/ps/Hotkey.cpp
1 /* Copyright (C) 201 5Wildfire Games.1 /* Copyright (C) 2016 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * 4 4 * 0 A.D. is free software: you can redistribute it and/or modify 5 5 * it under the terms of the GNU General Public License as published by 6 6 * the Free Software Foundation, either version 2 of the License, or … … InReaction HotkeyInputHandler(const SDL_ 304 304 for (size_t i = 0; i < closestMapNames.size(); ++i) 305 305 { 306 306 SDL_Event_ hotkeyNotification; 307 307 hotkeyNotification.ev.type = SDL_HOTKEYDOWN; 308 308 hotkeyNotification.ev.user.data1 = const_cast<char*>(closestMapNames[i]); 309 310 // Update g_HotkeyMap since this event will be processed by the GUI handler before 311 // updating g_HotkeyMap, while the GUI handler requires that init prior 312 HotkeyInputHandler(&hotkeyNotification); 313 309 314 in_push_priority_event(&hotkeyNotification); 310 315 } 311 316 312 317 // -- KEYUP SECTION -- 313 318 … … InReaction HotkeyInputHandler(const SDL_ 332 337 if (accept) 333 338 { 334 339 SDL_Event_ hotkeyNotification; 335 340 hotkeyNotification.ev.type = SDL_HOTKEYUP; 336 341 hotkeyNotification.ev.user.data1 = const_cast<char*>(hotkey.name.c_str()); 342 343 // Update g_HotkeyMap since this event will be processed by the GUI handler before 344 // updating g_HotkeyMap, while the GUI handler requires that init prior 345 HotkeyInputHandler(&hotkeyNotification); 346 337 347 in_push_priority_event(&hotkeyNotification); 338 348 } 339 349 } 340 350 341 351 return IN_PASS;