diff --git a/cegui/include/CEGUI/InputAggregator.h b/cegui/include/CEGUI/InputAggregator.h index 7b9c66884..6af45e9e7 100644 --- a/cegui/include/CEGUI/InputAggregator.h +++ b/cegui/include/CEGUI/InputAggregator.h @@ -95,8 +95,13 @@ class CEGUIEXPORT InputAggregator : public InjectedInputReceiver, /*! \brief Initialises this InputAggregator with some default simple-key mappings + \param handle_on_keyup + When set to true semantic actions will be registered on key up + otherwise semantic actions are handled on key down. If false + it is recommended to call setModifierKeys before any injectKeyDown + calls to make sure that modifiers are properly set. */ - virtual void initialise(); + virtual void initialise(bool handle_on_keyup = true); /*! \brief @@ -156,6 +161,31 @@ class CEGUIEXPORT InputAggregator : public InjectedInputReceiver, void setMouseMoveScalingFactor(float factor); float getMouseMoveScalingFactor() const; + /*! + \brief + Returns a semantic action matching the scan_code + */ + int getSemanticAction(Key::Scan scan_code, bool shift_down, bool alt_down, + bool ctrl_down) const; + + /*! + \brief + Gets semantic action for scan_code and sends the event + \return + True if the semantic action was handled + */ + bool handleScanCode(Key::Scan scan_code, bool shift_down, bool alt_down, + bool ctrl_down); + + /*! + \brief + Sets the status of modifier keys to the specified values. + + Call this before injectKeyDown if InputAggregator is set to handle + actions on keydown. + */ + void setModifierKeys(bool shift_down, bool alt_down, bool ctrl_down); + /************************************************************************/ /* InjectedInputReceiver interface implementation */ /************************************************************************/ @@ -165,7 +195,17 @@ class CEGUIEXPORT InputAggregator : public InjectedInputReceiver, virtual bool injectMouseButtonDown(MouseButton button); virtual bool injectMouseButtonUp(MouseButton button); + /*! + \return + True if set to handle keys on key down and the input was consumed. + When not to set handle actions on key down will always return true. + */ virtual bool injectKeyDown(Key::Scan scan_code); + /*! + \return + True if set to handle keys on key up and the input was consumed. + When not to set handle actions on key up will always return true. + */ virtual bool injectKeyUp(Key::Scan scan_code); virtual bool injectChar(String::value_type code_point); @@ -209,6 +249,9 @@ class CEGUIEXPORT InputAggregator : public InjectedInputReceiver, bool d_generateMouseClickEvents; MouseClickTracker* d_mouseClickTrackers; + //! When set to true will handle semantic actions on key up + bool d_handleInKeyUp; + //! Scaling factor applied to injected cursor move deltas. float d_mouseMovementScalingFactor; diff --git a/cegui/include/CEGUI/RendererModules/Ogre/GeometryBuffer.h b/cegui/include/CEGUI/RendererModules/Ogre/GeometryBuffer.h index 98cc7d2a2..c71edbb5c 100644 --- a/cegui/include/CEGUI/RendererModules/Ogre/GeometryBuffer.h +++ b/cegui/include/CEGUI/RendererModules/Ogre/GeometryBuffer.h @@ -37,8 +37,6 @@ #include #include -#include - #include #include diff --git a/cegui/include/CEGUI/RendererModules/Ogre/Renderer.h b/cegui/include/CEGUI/RendererModules/Ogre/Renderer.h index 8609e8b52..23707331e 100644 --- a/cegui/include/CEGUI/RendererModules/Ogre/Renderer.h +++ b/cegui/include/CEGUI/RendererModules/Ogre/Renderer.h @@ -178,6 +178,13 @@ class OGRE_GUIRENDERER_API OgreRenderer : public Renderer static OgreRenderer& create(Ogre::RenderTarget& target, const int abi = CEGUI_VERSION_ABI); + /*! + \brief + Creates a new renderer that can be used to create a context on a new Ogre window + */ + static OgreRenderer& registerWindow(OgreRenderer& main_window, + Ogre::RenderTarget &new_window); + //! destroy an OgreRenderer object. static void destroy(OgreRenderer& renderer); diff --git a/cegui/include/CEGUI/widgets/All.h b/cegui/include/CEGUI/widgets/All.h index 71bf51c22..aa39e84d2 100644 --- a/cegui/include/CEGUI/widgets/All.h +++ b/cegui/include/CEGUI/widgets/All.h @@ -37,7 +37,6 @@ #include "./GroupBox.h" #include "./HorizontalLayoutContainer.h" #include "./ItemEntry.h" -#include "./LayoutCell.h" #include "./ListboxItem.h" #include "./ListboxTextItem.h" #include "./ListHeader.h" diff --git a/cegui/include/CEGUI/widgets/LayoutCell.h b/cegui/include/CEGUI/widgets/LayoutCell.h deleted file mode 100644 index 14a0ff8ef..000000000 --- a/cegui/include/CEGUI/widgets/LayoutCell.h +++ /dev/null @@ -1,155 +0,0 @@ -/*********************************************************************** - created: 22/2/2011 - author: Martin Preisler - - purpose: Defines base (and default) layout cell class -*************************************************************************/ -/*************************************************************************** - * Copyright (C) 2004 - 2011 Paul D Turner & The CEGUI Development Team - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - ***************************************************************************/ -#ifndef _CEGUILayoutCell_h_ -#define _CEGUILayoutCell_h_ - -#include "../Window.h" - -#include - -#if defined(_MSC_VER) -# pragma warning(push) -# pragma warning(disable : 4251) -#endif - -// Start of CEGUI namespace section -namespace CEGUI -{ - -/*! -\brief - Represents a cell in a layout container - -\par - Layout cell's role is to encapsulate widgets inside a layout container. - It also contains a "Margin" property to set contained widget's margin on - all 4 edges. - - Unless you want to set the margin, you should never encounter this class. - Everything is encapsulated automatically when adding widgets into layout - containers. You will however see instances of this class inside XML layout - files. -*/ -class CEGUIEXPORT LayoutCell : public Window -{ -public: - /************************************************************************* - Event name constants - *************************************************************************/ - //! Namespace for events - static const String EventNamespace; - //! Window factory name - static const String WidgetTypeName; - - /*! - \brief - Constructor for LayoutCell class - - \param type - String object holding Window type (usually provided by WindowFactory). - - \param name - String object holding unique name for the Window. - */ - LayoutCell(const String& type, const String& name); - - /*! - \brief - Destructor - */ - virtual ~LayoutCell(void); - - virtual const CachedRectf& getClientChildContentArea() const; - - virtual void notifyScreenAreaChanged(bool recursive); - -protected: - /// @copydoc Window::getUnclippedInnerRect_impl - virtual Rectf getUnclippedInnerRect_impl(bool skipAllPixelAlignment) const; - - Rectf getClientChildContentArea_impl(bool skipAllPixelAlignment) const; - - /// @copydoc Window::addChild_impl - virtual void addChild_impl(Element* element); - /// @copydoc Window::removeChild_impl - virtual void removeChild_impl(Element* element); - - /************************************************************************* - Event trigger methods - *************************************************************************/ - /*! - \brief - Handler called when child window gets sized - - \param e - WindowEventArgs object whose 'window' pointer field is set to the - window that triggered the event. For this event the trigger window is - the one that was sized. - */ - virtual bool handleChildSized(const EventArgs& e); - - /*! - \brief - Handler called when child window gets added - - \param e - WindowEventArgs object whose 'window' pointer field is set to the - window that triggered the event. For this event the trigger window is - the one that was added. - */ - virtual bool handleChildAdded(const EventArgs& e); - - /*! - \brief - Handler called when child window gets removed - - \param e - WindowEventArgs object whose 'window' pointer field is set to the - window that triggered the event. For this event the trigger window is - the one that was removed. - */ - virtual bool handleChildRemoved(const EventArgs& e); - - /************************************************************************* - Implementation Data - *************************************************************************/ - typedef std::multimap ConnectionTracker; - //! Tracks event connections we make. - ConnectionTracker d_eventConnections; - - CachedRectf d_clientChildContentArea; -}; - -} // End of CEGUI namespace section - -#if defined(_MSC_VER) -# pragma warning(pop) -#endif - -#endif // end of guard _CEGUILayoutCell_h_ diff --git a/cegui/src/InputAggregator.cpp b/cegui/src/InputAggregator.cpp index 3081cb984..296fb5135 100644 --- a/cegui/src/InputAggregator.cpp +++ b/cegui/src/InputAggregator.cpp @@ -84,7 +84,8 @@ InputAggregator::InputAggregator(InputEventReceiver* input_receiver) : d_displaySizeChangedConnection( System::getSingletonPtr()->subscribeEvent(System::EventDisplaySizeChanged, Event::Subscriber(&InputAggregator::onDisplaySizeChanged, this))), - d_keysPressed() + d_keysPressed(), + d_handleInKeyUp(true) { // Initialize the array memset(d_keyValuesMappings, SV_NoValue, sizeof(SemanticValue) * 0xFF); @@ -190,6 +191,83 @@ void InputAggregator::onMouseButtonMultiClickToleranceChanged(InputAggregatorEve fireEvent(EventMouseButtonMultiClickToleranceChanged, args); } +//----------------------------------------------------------------------------// +int InputAggregator::getSemanticAction(Key::Scan scan_code, bool shift_down, + bool alt_down, bool ctrl_down) const +{ + int value = d_keyValuesMappings[scan_code]; + + // handle combined keys + if (ctrl_down && shift_down) + { + if (scan_code == Key::ArrowLeft) + value = SV_SelectPreviousWord; + else if (scan_code == Key::ArrowRight) + value = SV_SelectNextWord; + else if (scan_code == Key::End) + value = SV_SelectToEndOfDocument; + else if (scan_code == Key::Home) + value = SV_SelectToStartOfDocument; + } + else if (ctrl_down) + { + if (scan_code == Key::ArrowLeft) + value = SV_GoToPreviousWord; + else if (scan_code == Key::ArrowRight) + value = SV_GoToNextWord; + else if (scan_code == Key::End) + value = SV_GoToEndOfDocument; + else if (scan_code == Key::Home) + value = SV_GoToStartOfDocument; + else if (scan_code == Key::A) + value = SV_SelectAll; + else if (scan_code == Key::C) + value = SV_Copy; + else if (scan_code == Key::V) + value = SV_Paste; + else if (scan_code == Key::X) + value = SV_Cut; + else if (scan_code == Key::Tab) + value = SV_NavigateToPrevious; + } + else if (shift_down) + { + if (scan_code == Key::ArrowLeft) + value = SV_SelectPreviousCharacter; + else if (scan_code == Key::ArrowRight) + value = SV_SelectNextCharacter; + else if (scan_code == Key::ArrowUp) + value = SV_SelectUp; + else if (scan_code == Key::ArrowDown) + value = SV_SelectDown; + else if (scan_code == Key::End) + value = SV_SelectToEndOfLine; + else if (scan_code == Key::Home) + value = SV_SelectToStartOfLine; + else if (scan_code == Key::PageUp) + value = SV_SelectPreviousPage; + else if (scan_code == Key::PageDown) + value = SV_SelectNextPage; + } + + return value; +} + +bool InputAggregator::handleScanCode(Key::Scan scan_code, bool shift_down, + bool alt_down, bool ctrl_down) +{ + + int value = getSemanticAction(scan_code, shift_down, alt_down, + ctrl_down); + + if (value != SV_NoValue) + { + SemanticInputEvent semantic_event(value); + return d_inputReceiver->injectInputEvent(semantic_event); + } + + return false; +} //----------------------------------------------------------------------------// void InputAggregator::onMouseMoveScalingFactorChanged(InputAggregatorEventArgs& args) { @@ -295,79 +373,30 @@ bool InputAggregator::injectMouseButtonUp(MouseButton button) bool InputAggregator::injectKeyDown(Key::Scan scan_code) { + if (d_inputReceiver == 0) + return false; + d_keysPressed[scan_code] = true; - return true; + + if (d_handleInKeyUp) + return true; + + return handleScanCode(scan_code, isShiftPressed(), isAltPressed(), + isControlPressed()); } bool InputAggregator::injectKeyUp(Key::Scan scan_code) { if (d_inputReceiver == 0) return false; - - int value = d_keyValuesMappings[scan_code]; - - // handle combined keys - if (isControlPressed() && isShiftPressed()) - { - if (scan_code == Key::ArrowLeft) - value = SV_SelectPreviousWord; - else if (scan_code == Key::ArrowRight) - value = SV_SelectNextWord; - else if (scan_code == Key::End) - value = SV_SelectToEndOfDocument; - else if (scan_code == Key::Home) - value = SV_SelectToStartOfDocument; - } - else if (isControlPressed()) - { - if (scan_code == Key::ArrowLeft) - value = SV_GoToPreviousWord; - else if (scan_code == Key::ArrowRight) - value = SV_GoToNextWord; - else if (scan_code == Key::End) - value = SV_GoToEndOfDocument; - else if (scan_code == Key::Home) - value = SV_GoToStartOfDocument; - else if (scan_code == Key::A) - value = SV_SelectAll; - else if (scan_code == Key::C) - value = SV_Copy; - else if (scan_code == Key::V) - value = SV_Paste; - else if (scan_code == Key::X) - value = SV_Cut; - else if (scan_code == Key::Tab) - value = SV_NavigateToPrevious; - } - else if (isShiftPressed()) - { - if (scan_code == Key::ArrowLeft) - value = SV_SelectPreviousCharacter; - else if (scan_code == Key::ArrowRight) - value = SV_SelectNextCharacter; - else if (scan_code == Key::ArrowUp) - value = SV_SelectUp; - else if (scan_code == Key::ArrowDown) - value = SV_SelectDown; - else if (scan_code == Key::End) - value = SV_SelectToEndOfLine; - else if (scan_code == Key::Home) - value = SV_SelectToStartOfLine; - else if (scan_code == Key::PageUp) - value = SV_SelectPreviousPage; - else if (scan_code == Key::PageDown) - value = SV_SelectNextPage; - } - + d_keysPressed[scan_code] = false; - if (value != SV_NoValue) - { - SemanticInputEvent semantic_event(value); - return d_inputReceiver->injectInputEvent(semantic_event); - } - - return false; + if (!d_handleInKeyUp) + return true; + + return handleScanCode(scan_code, isShiftPressed(), isAltPressed(), + isControlPressed()); } bool InputAggregator::injectChar(String::value_type code_point) @@ -459,8 +488,10 @@ bool InputAggregator::injectPasteRequest() return d_inputReceiver->injectInputEvent(semantic_event); } -void InputAggregator::initialise() +void InputAggregator::initialise(bool handle_on_keyup /*= true*/) { + d_handleInKeyUp = handle_on_keyup; + d_keyValuesMappings[Key::Backspace] = SV_DeletePreviousCharacter; d_keyValuesMappings[Key::Delete] = SV_DeleteNextCharacter; @@ -494,7 +525,19 @@ bool InputAggregator::isControlPressed() { return d_keysPressed[Key::LeftControl] || d_keysPressed[Key::RightControl]; } +//----------------------------------------------------------------------------// +void InputAggregator::setModifierKeys(bool shift_down, bool alt_down, + bool ctrl_down) +{ + d_keysPressed[Key::LeftShift] = shift_down; + d_keysPressed[Key::RightShift] = shift_down; + d_keysPressed[Key::LeftAlt] = alt_down; + d_keysPressed[Key::RightAlt] = alt_down; + + d_keysPressed[Key::LeftControl] = ctrl_down; + d_keysPressed[Key::RightControl] = ctrl_down; +} //----------------------------------------------------------------------------// void InputAggregator::recomputeMultiClickAbsoluteTolerance() { diff --git a/cegui/src/RendererModules/Ogre/GeometryBuffer.cpp b/cegui/src/RendererModules/Ogre/GeometryBuffer.cpp index 8a31f4306..e8e4edd3a 100644 --- a/cegui/src/RendererModules/Ogre/GeometryBuffer.cpp +++ b/cegui/src/RendererModules/Ogre/GeometryBuffer.cpp @@ -296,7 +296,9 @@ void OgreGeometryBuffer::cleanUpVertexAttributes() d_renderOp.vertexData = 0; // Store the hardware buffer so that other instances can use it later - d_owner.returnVertexBuffer(d_hwBuffer); + // This check should also help prevent there being nullptrs in the pool + if (d_hwBuffer.get()) + d_owner.returnVertexBuffer(d_hwBuffer); d_hwBuffer.setNull(); } diff --git a/cegui/src/RendererModules/Ogre/Renderer.cpp b/cegui/src/RendererModules/Ogre/Renderer.cpp index e95ce7329..4810206ea 100644 --- a/cegui/src/RendererModules/Ogre/Renderer.cpp +++ b/cegui/src/RendererModules/Ogre/Renderer.cpp @@ -315,6 +315,15 @@ OgreResourceProvider& OgreRenderer::createOgreResourceProvider() return *new OgreResourceProvider(); } +//----------------------------------------------------------------------------// +OgreRenderer& OgreRenderer::registerWindow(OgreRenderer& main_window, + Ogre::RenderTarget &new_window) +{ + // Link the second renderer to the first for them to share some resources + + return *new OgreRenderer(new_window); +} + //----------------------------------------------------------------------------// #ifdef CEGUI_USE_OGRE_COMPOSITOR2 void OgreRenderer::createOgreCompositorResources() @@ -1222,7 +1231,16 @@ Ogre::HardwareVertexBufferSharedPtr OgreRenderer::getVertexBuffer(size_t for (size_t i = d_pimpl->d_vbPool.size(); --i > 0;) { - size_t current_over = d_pimpl->d_vbPool[i]->getNumVertices()-min_size; + // It seems that there can be nullptrs in the pool + Ogre::HardwareVertexBufferSharedPtr current = d_pimpl->d_vbPool[i]; + + if (!current.get()){ + + d_pimpl->d_vbPool.erase(d_pimpl->d_vbPool.begin()+i); + continue; + } + + size_t current_over = current->getNumVertices()-min_size; // Perfect match stops searching instantly if (current_over == 0) diff --git a/cegui/src/RendererModules/OpenGL/CMakeLists.txt b/cegui/src/RendererModules/OpenGL/CMakeLists.txt index 7de2e8a4a..b4edee85f 100644 --- a/cegui/src/RendererModules/OpenGL/CMakeLists.txt +++ b/cegui/src/RendererModules/OpenGL/CMakeLists.txt @@ -67,7 +67,8 @@ if (NOT CEGUI_BUILD_RENDERER_OPENGLES2) list (REMOVE_ITEM CORE_SOURCE_FILES GLES2Renderer.cpp GLES2Texture.cpp GLES2GeometryBuffer.cpp - GLES2FBOTextureTarget.cpp) + GLES2FBOTextureTarget.cpp + GLES2StateChangeWrapper.cpp) list (REMOVE_ITEM CORE_HEADER_FILES ${CMAKE_SOURCE_DIR}/cegui/include/CEGUI/RendererModules/OpenGL/GLES2Renderer.h ${CMAKE_SOURCE_DIR}/cegui/include/CEGUI/RendererModules/OpenGL/GLES2Texture.h ${CMAKE_SOURCE_DIR}/cegui/include/CEGUI/RendererModules/OpenGL/GLES2GeometryBuffer.h diff --git a/cegui/src/System.cpp b/cegui/src/System.cpp index 37cd96475..272c43f69 100644 --- a/cegui/src/System.cpp +++ b/cegui/src/System.cpp @@ -691,7 +691,6 @@ void System::addStandardWindowFactories() WindowFactoryManager::addWindowType(); WindowFactoryManager::addWindowType(); WindowFactoryManager::addWindowType(); - WindowFactoryManager::addWindowType(); WindowFactoryManager::addWindowType(); WindowFactoryManager::addWindowType(); WindowFactoryManager::addWindowType(); diff --git a/cegui/src/Window.cpp b/cegui/src/Window.cpp index fbcf300b9..aae8b2ff6 100644 --- a/cegui/src/Window.cpp +++ b/cegui/src/Window.cpp @@ -2659,8 +2659,6 @@ void Window::onSemanticInputEvent(SemanticEventArgs& e) return; } - - ++e.handled; } //----------------------------------------------------------------------------// diff --git a/cegui/src/widgets/LayoutCell.cpp b/cegui/src/widgets/LayoutCell.cpp deleted file mode 100644 index 7d7204548..000000000 --- a/cegui/src/widgets/LayoutCell.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/*********************************************************************** - created: 22/2/2011 - author: Martin Preisler - - purpose: Implements the LayoutCell class -*************************************************************************/ -/*************************************************************************** - * Copyright (C) 2004 - 2011 Paul D Turner & The CEGUI Development Team - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - ***************************************************************************/ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "CEGUI/widgets/LayoutCell.h" - -#if defined(_MSC_VER) -# pragma warning(push) -# pragma warning(disable : 4355) -#endif - -// Start of CEGUI namespace section -namespace CEGUI -{ - -const String LayoutCell::EventNamespace("LayoutCell"); -const String LayoutCell::WidgetTypeName("LayoutCell"); - -//----------------------------------------------------------------------------// -LayoutCell::LayoutCell(const String& type, const String& name): - Window(type, name), - - d_clientChildContentArea(this, static_cast(&LayoutCell::getClientChildContentArea_impl)) -{ - // cell should take the whole window by default I think - setSize(USize(cegui_reldim(1), cegui_reldim(1))); - - subscribeEvent(Window::EventChildAdded, - Event::Subscriber(&LayoutCell::handleChildAdded, this)); - subscribeEvent(Window::EventChildRemoved, - Event::Subscriber(&LayoutCell::handleChildRemoved, this)); -} - -//----------------------------------------------------------------------------// -LayoutCell::~LayoutCell(void) -{} - -const Element::CachedRectf& LayoutCell::getClientChildContentArea() const -{ - if (!d_parent) - { - return Window::getClientChildContentArea(); - } - else - { - return d_clientChildContentArea; - } -} - -//----------------------------------------------------------------------------// -void LayoutCell::notifyScreenAreaChanged(bool recursive) -{ - d_clientChildContentArea.invalidateCache(); - - Window::notifyScreenAreaChanged(recursive); -} - -//----------------------------------------------------------------------------// -Rectf LayoutCell::getUnclippedInnerRect_impl(bool skipAllPixelAlignment) const -{ - return d_parent ? - (skipAllPixelAlignment ? d_parent->getUnclippedInnerRect().getFresh(true) : d_parent->getUnclippedInnerRect().get()) : - Window::getUnclippedInnerRect_impl(skipAllPixelAlignment); -} - -//----------------------------------------------------------------------------// -Rectf LayoutCell::getClientChildContentArea_impl(bool skipAllPixelAlignment) const -{ - if (!d_parent) - { - return skipAllPixelAlignment ? Window::getClientChildContentArea().getFresh(true) : Window::getClientChildContentArea().get(); - } - else - { - return skipAllPixelAlignment ? - Rectf(getUnclippedOuterRect().getFresh(true).getPosition(), d_parent->getUnclippedInnerRect().getFresh(true).getSize()) : - Rectf(getUnclippedOuterRect().get().getPosition(), d_parent->getUnclippedInnerRect().get().getSize()); - } -} - -//----------------------------------------------------------------------------// -void LayoutCell::addChild_impl(Element* element) -{ - Window* wnd = dynamic_cast(element); - - if (!wnd) - CEGUI_THROW(InvalidRequestException( - "LayoutCell can only have Elements of type Window added as children " - "(Window path: " + getNamePath() + ").")); - - Window::addChild_impl(wnd); - - // we have to subscribe to the EventSized for layout updates - d_eventConnections.insert(std::make_pair(wnd, - wnd->subscribeEvent(Window::EventSized, - Event::Subscriber(&LayoutCell::handleChildSized, this)))); -} - -//----------------------------------------------------------------------------// -void LayoutCell::removeChild_impl(Element* element) -{ - Window* wnd = static_cast(element); - - // we want to get rid of the subscription, because the child window could - // get removed and added somewhere else, we would be wastefully updating - // layouts if it was sized inside other Window - ConnectionTracker::iterator conn; - - while ((conn = d_eventConnections.find(wnd)) != d_eventConnections.end()) - { - conn->second->disconnect(); - d_eventConnections.erase(conn); - } - - Window::removeChild_impl(wnd); -} - -//----------------------------------------------------------------------------// -bool LayoutCell::handleChildSized(const EventArgs&) -{ - //markNeedsLayouting(); - - return true; -} - -//----------------------------------------------------------------------------// -bool LayoutCell::handleChildAdded(const EventArgs&) -{ - if (getChildCount() > 0) - { - CEGUI_THROW(InvalidRequestException( - "You can't add more than one widget to a layout cell!")); - } - - //markNeedsLayouting(); - - return true; -} - -//----------------------------------------------------------------------------// -bool LayoutCell::handleChildRemoved(const EventArgs&) -{ - //markNeedsLayouting(); - - return true; -} - -#if defined(_MSC_VER) -# pragma warning(pop) -#endif - - -} // End of CEGUI namespace section diff --git a/cegui/src/widgets/MultiLineEditbox.cpp b/cegui/src/widgets/MultiLineEditbox.cpp index 926def828..9edce607c 100644 --- a/cegui/src/widgets/MultiLineEditbox.cpp +++ b/cegui/src/widgets/MultiLineEditbox.cpp @@ -1653,6 +1653,8 @@ void MultiLineEditbox::onSemanticInputEvent(SemanticEventArgs& e) if (e.d_semanticValue == SV_SelectAll && e.d_payload.source == CIS_Left) { handleSelectAllText(e); + + ++e.handled; } else if (e.d_semanticValue == SV_SelectWord && e.d_payload.source == CIS_Left) { diff --git a/cegui/src/widgets/PushButton.cpp b/cegui/src/widgets/PushButton.cpp index c1d7aa1f5..0fb8cfc35 100644 --- a/cegui/src/widgets/PushButton.cpp +++ b/cegui/src/widgets/PushButton.cpp @@ -101,7 +101,11 @@ void PushButton::onSemanticInputEvent(SemanticEventArgs& e) return; if (e.d_semanticValue == SV_Confirm) + { onClicked(e); + + ++e.handled; + } } } // End of CEGUI namespace section diff --git a/cegui/src/widgets/ToggleButton.cpp b/cegui/src/widgets/ToggleButton.cpp index 20f1df97b..9fcff26c7 100644 --- a/cegui/src/widgets/ToggleButton.cpp +++ b/cegui/src/widgets/ToggleButton.cpp @@ -108,7 +108,11 @@ void ToggleButton::onSemanticInputEvent(SemanticEventArgs& e) return; if (e.d_semanticValue == SV_Confirm) + { setSelected(getPostClickSelectState()); + + ++e.handled; + } } //----------------------------------------------------------------------------// diff --git a/cmake/FindDevIL.cmake b/cmake/FindDevIL.cmake index 45f2f2eb0..e767a32e4 100644 --- a/cmake/FindDevIL.cmake +++ b/cmake/FindDevIL.cmake @@ -24,7 +24,7 @@ if (WIN32 OR APPLE) endif() cegui_find_package_handle_standard_args(IL IL_LIB IL_H_PATH) -cegui_find_package_handle_standard_args(ILU ILU_LIB) +cegui_find_package_handle_standard_args(ILU ILU_LIB IL_H_PATH) # set up output vars if (IL_FOUND AND ILU_FOUND) diff --git a/samples/GameMenu/GameMenu.cpp b/samples/GameMenu/GameMenu.cpp index 1c384773e..d7587ec87 100644 --- a/samples/GameMenu/GameMenu.cpp +++ b/samples/GameMenu/GameMenu.cpp @@ -1,4 +1,4 @@ -/*********************************************************************** +/*********************************************************************** created: 31/7/2012 author: Lukas E Meindl *************************************************************************/ diff --git a/samples/browser/src/CEGuiOgreBaseApplication.cpp b/samples/browser/src/CEGuiOgreBaseApplication.cpp index 284e49e4b..b85908ade 100644 --- a/samples/browser/src/CEGuiOgreBaseApplication.cpp +++ b/samples/browser/src/CEGuiOgreBaseApplication.cpp @@ -121,7 +121,7 @@ CEGuiOgreBaseApplication::CEGuiOgreBaseApplication() : // The compositor has to be initialized if (!manager) { - d_ogreRoot->initialiseCompositor(); + assert(false && "No function to initialize Ogre::CompositorManager2..."); manager = d_ogreRoot->getCompositorManager2(); } @@ -430,6 +430,29 @@ CEGuiDemoFrameListener::CEGuiDemoFrameListener(CEGuiOgreBaseApplication* baseApp windowHndStr << (unsigned int)windowHnd; paramList.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str())); + // Prevent the window from capturing mouse making debugging impossible + // (on Windows and Linux) +#if defined OIS_WIN32_PLATFORM + paramList.insert(std::make_pair(std::string("w32_mouse"), + std::string("DISCL_FOREGROUND" ))); + paramList.insert(std::make_pair(std::string("w32_mouse"), + std::string("DISCL_NONEXCLUSIVE"))); + paramList.insert(std::make_pair(std::string("w32_keyboard"), + std::string("DISCL_FOREGROUND"))); + paramList.insert(std::make_pair(std::string("w32_keyboard"), + std::string("DISCL_NONEXCLUSIVE"))); +#elif defined OIS_LINUX_PLATFORM + paramList.insert(std::make_pair(std::string("x11_mouse_grab"), + std::string("false"))); + paramList.insert(std::make_pair(std::string("x11_mouse_hide"), + std::string("false"))); + paramList.insert(std::make_pair(std::string("x11_keyboard_grab"), + std::string("false"))); + paramList.insert(std::make_pair(std::string("XAutoRepeatOn"), + std::string("true"))); +#endif + + #if OGRE_PLATFORM != OGRE_PLATFORM_ANDROID && OGRE_PLATFORM != OGRE_PLATFORM_WINRT && OGRE_PLATFORM != OGRE_PLATFORM_LINUX && defined (DEBUG) paramList.insert(std::make_pair("x11_keyboard_grab", "false")); paramList.insert(std::make_pair("x11_mouse_grab", "false"));