Ticket #850: minimap_ticket850.patch
File minimap_ticket850.patch, 3.5 KB (added by , 13 years ago) |
---|
-
gui/CGUI.cpp
132 132 // TODO Gee: Optimizations needed! 133 133 // these two recursive function are quite overhead heavy. 134 134 135 // pNearest will after this point at the hovered object, possibly NULL 136 pNearest = FindObjectUnderMouse(); 135 // If no object is currently capturing the mouse, pNearest will point at the topmost hovered object, possibly NULL. 136 if (m_MouseCapturingObject == NULL) 137 pNearest = FindObjectUnderMouse(); 138 else 139 pNearest = m_MouseCapturingObject; 137 140 138 141 // Is placed in the UpdateMouseOver function 139 142 //if (ev->ev.type == SDL_MOUSEMOTION && pNearest) … … 157 160 158 161 if (pNearest) 159 162 { 163 // Should this GUIObject capture all mouse-input until the left mouse-button is released again? 164 if(pNearest->DoesCaptureMouse()) 165 m_MouseCapturingObject = pNearest; 166 160 167 ret = pNearest->SendEvent(GUIM_MOUSE_PRESS_LEFT, "mouseleftpress"); 161 168 } 162 169 break; … … 206 213 { 207 214 ret = pNearest->SendEvent(GUIM_MOUSE_RELEASE_LEFT, "mouseleftrelease"); 208 215 } 216 // Stop capturing 217 m_MouseCapturingObject = NULL; 209 218 } 210 219 break; 211 220 case SDL_BUTTON_RIGHT: … … 382 391 NULL, NULL, NULL, NULL 383 392 }; 384 393 385 CGUI::CGUI() : m_MouseButtons(0), m_FocusedObject(NULL), m_ InternalNameNumber(0)394 CGUI::CGUI() : m_MouseButtons(0), m_FocusedObject(NULL), m_MouseCapturingObject(NULL), m_InternalNameNumber(0) 386 395 { 387 396 m_BaseObject = new CGUIDummyObject; 388 397 m_BaseObject->SetGUI(this); -
gui/IGUIObject.h
405 405 */ 406 406 void SetFocus(); 407 407 408 bool DoesCaptureMouse() { return m_CaptureMouseAfterLMBClick; } 409 408 410 protected: 409 411 /** 410 412 * Check if object is focused. … … 549 551 550 552 // Is mouse hovering the object? used with the function MouseOver() 551 553 bool m_MouseHovering; 554 555 // Still receive mouse input after click-dragging the cursor out of the GUIObject until 556 // LMB is released? 557 bool m_CaptureMouseAfterLMBClick; 552 558 553 559 /** 554 560 * Settings pool, all an object's settings are located here -
gui/IGUIObject.cpp
44 44 m_pGUI(NULL), 45 45 m_pParent(NULL), 46 46 m_MouseHovering(false), 47 m_JSObject(NULL) 47 m_JSObject(NULL), 48 m_CaptureMouseAfterLMBClick(false) 48 49 { 49 50 AddSetting(GUIST_bool, "enabled"); 50 51 AddSetting(GUIST_bool, "hidden"); -
gui/MiniMap.cpp
60 60 AddSetting(GUIST_CStr, "tooltip_style"); 61 61 m_Clicking = false; 62 62 m_Hovering = false; 63 m_CaptureMouseAfterLMBClick = true; 63 64 } 64 65 65 66 CMiniMap::~CMiniMap() … … 105 106 } 106 107 case GUIM_MOUSE_LEAVE: 107 108 { 108 m_Clicking = false;109 109 m_Hovering = false; 110 110 break; 111 111 } -
gui/CGUI.h
629 629 */ 630 630 IGUIObject* m_FocusedObject; 631 631 632 /** 633 * Object that captures all mouse input. 634 * This is currently only needed for the minimap. 635 */ 636 IGUIObject* m_MouseCapturingObject; 637 632 638 /** 633 639 * Just pointers for fast name access, each object 634 640 * is really constructed within its parent for easy