<commit_before>#ifdef PIXELBOOST_LIBRARY_USE_GWEN

#include "glm/glm.hpp"

#include "gwen/Controls/Canvas.h"

#include "pixelboost/framework/engine.h"
#include "pixelboost/input/keyboardManager.h"
#include "pixelboost/input/mouseManager.h"
#include "pixelboost/misc/gwen/inputHandler.h"

using namespace pb;

class pb::GwenKeyboardHandler : public KeyboardHandler
{
public:
    GwenKeyboardHandler(Gwen::Controls::Canvas* canvas, Gwen::Controls::Base* root)
        : _Canvas(canvas)
        , _Root(root)
    {
        SetPriority(1000);
    }
    
    bool OnKeyDown(KeyboardKey key, ModifierKeys modifier, char character)
    {
        if (modifier == kModifierKeyControl)
            return false;
        
        if (Gwen::KeyboardFocus == _Root)
            return false;
        
        if (key == kKeyboardKeyCharacter)
            return _Canvas->InputCharacter(character);
        else
            return _Canvas->InputKey(key, true);
        
        return false;
    }
    
    bool OnKeyUp(KeyboardKey key, ModifierKeys modifier, char character)
    {
        if (modifier == kModifierKeyControl)
            return false;
        
        if (Gwen::KeyboardFocus == _Root)
            return false;
        
        if (key != kKeyboardKeyCharacter)
            return _Canvas->InputKey(key, false);
        
        return false;
    }
    
private:
    Gwen::Controls::Base* _Root;
    Gwen::Controls::Canvas*	_Canvas;
};

class pb::GwenMouseHandler : public MouseHandler
{
public:
    GwenMouseHandler(Gwen::Controls::Canvas* canvas, Gwen::Controls::Base* root)
        : _Canvas(canvas)
        , _Root(root)
    {
        SetPriority(1000);
    }
    
    bool OnMouseDown(MouseButton button, ModifierKeys modifierKeys, glm::vec2 position)
    {
        _Canvas->InputMouseButton((int)button, true);
        
        Gwen::Controls::Base* hoveredControl = Gwen::HoveredControl;
        if (!hoveredControl || hoveredControl == _Root)
            return false;
        
        return true;
    }
    
    bool OnMouseMove(glm::vec2 position)
    {
        glm::vec2 delta = position - _PrevMouse;
        _PrevMouse = position;
        
        _Canvas->InputMouseMoved(position.x, position.y, delta[0], delta[1]);
        
        Gwen::Controls::Base* hoveredControl = Gwen::HoveredControl;
        if (!hoveredControl || hoveredControl == _Root)
            return false;
        
        return true;
    }
    
    bool OnMouseUp(MouseButton button, ModifierKeys modifierKeys, glm::vec2 position)
    {
        _Canvas->InputMouseButton((int)button, false);
        
        Gwen::Controls::Base* hoveredControl = Gwen::HoveredControl;
        if (!hoveredControl || hoveredControl == _Root)
            return false;
        
        return true;
    }
    
    bool OnMouseScroll(ModifierKeys modifierKeys, glm::vec2 scroll)
    {
        _Canvas->InputMouseWheel(scroll.y*120);
        
        Gwen::Controls::Base* hoveredControl = Gwen::HoveredControl;
        if (!hoveredControl || hoveredControl == _Root)
            return false;
        
        return true;
    }
    
    bool OnMouseZoom(glm::vec2 zoom)
    {
        Gwen::Controls::Base* hoveredControl = Gwen::HoveredControl;
        if (!hoveredControl || hoveredControl == _Root)
            return false;
        
        return true;
    }
    
    bool OnMouseRotate(float rotate)<commit_msg>Slow down default GWEN mouse scroll speed<commit_after>#ifdef PIXELBOOST_LIBRARY_USE_GWEN

#include "glm/glm.hpp"

#include "gwen/Controls/Canvas.h"

#include "pixelboost/framework/engine.h"
#include "pixelboost/input/keyboardManager.h"
#include "pixelboost/input/mouseManager.h"
#include "pixelboost/misc/gwen/inputHandler.h"

using namespace pb;

class pb::GwenKeyboardHandler : public KeyboardHandler
{
public:
    GwenKeyboardHandler(Gwen::Controls::Canvas* canvas, Gwen::Controls::Base* root)
        : _Canvas(canvas)
        , _Root(root)
    {
        SetPriority(1000);
    }
    
    bool OnKeyDown(KeyboardKey key, ModifierKeys modifier, char character)
    {
        if (modifier == kModifierKeyControl)
            return false;
        
        if (Gwen::KeyboardFocus == _Root)
            return false;
        
        if (key == kKeyboardKeyCharacter)
            return _Canvas->InputCharacter(character);
        else
            return _Canvas->InputKey(key, true);
        
        return false;
    }
    
    bool OnKeyUp(KeyboardKey key, ModifierKeys modifier, char character)
    {
        if (modifier == kModifierKeyControl)
            return false;
        
        if (Gwen::KeyboardFocus == _Root)
            return false;
        
        if (key != kKeyboardKeyCharacter)
            return _Canvas->InputKey(key, false);
        
        return false;
    }
    
private:
    Gwen::Controls::Base* _Root;
    Gwen::Controls::Canvas*	_Canvas;
};

class pb::GwenMouseHandler : public MouseHandler
{
public:
    GwenMouseHandler(Gwen::Controls::Canvas* canvas, Gwen::Controls::Base* root)
        : _Canvas(canvas)
        , _Root(root)
    {
        SetPriority(1000);
    }
    
    bool OnMouseDown(MouseButton button, ModifierKeys modifierKeys, glm::vec2 position)
    {
        _Canvas->InputMouseButton((int)button, true);
        
        Gwen::Controls::Base* hoveredControl = Gwen::HoveredControl;
        if (!hoveredControl || hoveredControl == _Root)
            return false;
        
        return true;
    }
    
    bool OnMouseMove(glm::vec2 position)
    {
        glm::vec2 delta = position - _PrevMouse;
        _PrevMouse = position;
        
        _Canvas->InputMouseMoved(position.x, position.y, delta[0], delta[1]);
        
        Gwen::Controls::Base* hoveredControl = Gwen::HoveredControl;
        if (!hoveredControl || hoveredControl == _Root)
            return false;
        
        return true;
    }
    
    bool OnMouseUp(MouseButton button, ModifierKeys modifierKeys, glm::vec2 position)
    {
        _Canvas->InputMouseButton((int)button, false);
        
        Gwen::Controls::Base* hoveredControl = Gwen::HoveredControl;
        if (!hoveredControl || hoveredControl == _Root)
            return false;
        
        return true;
    }
    
    bool OnMouseScroll(ModifierKeys modifierKeys, glm::vec2 scroll)
    {
        _Canvas->InputMouseWheel(scroll.y*10);
        
        Gwen::Controls::Base* hoveredControl = Gwen::HoveredControl;
        if (!hoveredControl || hoveredControl == _Root)
            return false;
        
        return true;
    }
    
    bool OnMouseZoom(glm::vec2 zoom)
    {
        Gwen::Controls::Base* hoveredControl = Gwen::HoveredControl;
        if (!hoveredControl || hoveredControl == _Root)
            return false;
        
        return true;
    }
    
    bool OnMouseRotate(float rotate)
{'fraction_non_alphanumeric': 0.10218763764498605, 'fraction_numerical': 0.00543238878285127, 'mean_word_length': 2.3180711154408185, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '247476', 'n_tokens_mistral': 2031, 'n_tokens_neox': 2010, 'n_words': 399}