Ticket #3194: gui_hotkey_release_event_v1.patch
File gui_hotkey_release_event_v1.patch, 3.0 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/gui/session/hotkeys/misc.xml
48 48 49 49 <object hotkey="session.stop"> 50 50 <action on="Press">stopUnits(g_Selection.toList());</action> 51 51 </object> 52 52 53 <object hotkey="session.batchtrain"> 54 <action on="Press">updateSelectionDetails();</action> 55 <action on="Release">updateSelectionDetails();</action> 56 </object> 57 58 <object hotkey="session.massbarter"> 59 <action on="Press">updateSelectionDetails();</action> 60 <action on="Release">updateSelectionDetails();</action> 61 </object> 62 53 63 <!-- Find idle warrior - TODO: Potentially move this to own UI button? --> 54 64 <object hotkey="selection.idlewarrior"> 55 65 <action on="Press">findIdleUnit(["Hero", "Champion", "CitizenSoldier", "Siege", "Warship", "Dog"]);</action> 56 66 </object> 57 67 -
source/gui/CGUI.cpp
const u32 MAX_OBJECT_DEPTH = 100; // Max 63 63 64 64 InReaction CGUI::HandleEvent(const SDL_Event_* ev) 65 65 { 66 66 InReaction ret = IN_PASS; 67 67 68 if (ev->ev.type == SDL_HOTKEYDOWN )68 if (ev->ev.type == SDL_HOTKEYDOWN || ev->ev.type == SDL_HOTKEYUP) 69 69 { 70 70 const char* hotkey = static_cast<const char*>(ev->ev.user.data1); 71 71 72 std::map<CStr, std::vector<IGUIObject*> >::iterator it = m_HotkeyObjects.find(hotkey); 72 73 if (it != m_HotkeyObjects.end()) 73 74 for (IGUIObject* const& obj : it->second) 74 obj->SendEvent(GUIM_PRESSED, "press"); 75 { 76 // Update hotkey status before sending the event, 77 // else the status will be outdated when processing the GUI event. 78 HotkeyInputHandler(ev); 79 ret = IN_HANDLED; 80 81 if (ev->ev.type == SDL_HOTKEYDOWN) 82 obj->SendEvent(GUIM_PRESSED, "press"); 83 else 84 obj->SendEvent(GUIM_RELEASED, "release"); 85 } 75 86 } 76 87 77 88 else if (ev->ev.type == SDL_MOUSEMOTION) 78 89 { 79 90 // Yes the mouse position is stored as float to avoid -
source/gui/GUIbase.h
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 … … enum EGUIMessageType 70 70 GUIM_MOUSE_RELEASE_RIGHT, 71 71 GUIM_MOUSE_WHEEL_UP, 72 72 GUIM_MOUSE_WHEEL_DOWN, 73 73 GUIM_SETTINGS_UPDATED, // SGUIMessage.m_Value = name of setting 74 74 GUIM_PRESSED, 75 GUIM_RELEASED, 75 76 GUIM_DOUBLE_PRESSED, 76 77 GUIM_MOUSE_MOTION, 77 78 GUIM_LOAD, // Called when an object is added to the GUI. 78 79 GUIM_GOT_FOCUS, 79 80 GUIM_LOST_FOCUS,