DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit a98ae22b7a82a8a8a960fd119f8ef96ef0f09c8c
parent 634321eb715eb64dd737a7893fa39b71c6d5d863
Author: falkTX <falktx@falktx.com>
Date:   Mon, 17 May 2021 23:26:29 +0100

Get rid of Events namespace, put everything inside Widget again

Signed-off-by: falkTX <falktx@falktx.com>

Diffstat:
Ddgl/Events.hpp | 228-------------------------------------------------------------------------------
Mdgl/Widget.hpp | 201+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
Mdgl/src/Common.hpp | 4++--
Mdgl/src/TopLevelWidgetPrivateData.cpp | 18+++++++++---------
Mdgl/src/TopLevelWidgetPrivateData.hpp | 12++++++------
Mdgl/src/WidgetPrivateData.cpp | 12++++++------
Mdgl/src/WidgetPrivateData.hpp | 12++++++------
Mdgl/src/WindowPrivateData.cpp | 22+++++++++++-----------
Mdgl/src/WindowPrivateData.hpp | 14+++++++-------
9 files changed, 245 insertions(+), 278 deletions(-)

diff --git a/dgl/Events.hpp b/dgl/Events.hpp @@ -1,228 +0,0 @@ -/* - * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com> - * - * Permission to use, copy, modify, and/or distribute this software for any purpose with - * or without fee is hereby granted, provided that the above copyright notice and this - * permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN - * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef DGL_EVENTS_HPP_INCLUDED -#define DGL_EVENTS_HPP_INCLUDED - -#include "Geometry.hpp" - -START_NAMESPACE_DGL - -// -------------------------------------------------------------------------------------------------------------------- - -namespace Events -{ - /** - Base event data. - These are the fields present on all Widget events. - - @a mod Currently active keyboard modifiers, @see Modifier. - @a mod Event flags, @see Flag. - @a time Event timestamp (if any). - */ - struct BaseEvent { - uint mod; - uint flags; - uint time; - - /** Constuctor */ - BaseEvent() noexcept : mod(0x0), flags(0x0), time(0) {} - /** Destuctor */ - virtual ~BaseEvent() noexcept {} - }; - - /** - Keyboard event. - - This event represents low-level key presses and releases. - This can be used for "direct" keyboard handing like key bindings, but must not be interpreted as text input. - - Keys are represented portably as Unicode code points, using the "natural" code point for the key. - The @a key field is the code for the pressed key, without any modifiers applied. - For example, a press or release of the 'A' key will have `key` 97 ('a') - regardless of whether shift or control are being held. - - Alternatively, the raw @a keycode can be used to work directly with physical keys, - but note that this value is not portable and differs between platforms and hardware. - - @a press True if the key was pressed, false if released. - @a key Unicode point of the key pressed. - @a keycode Raw keycode. - @see onKeyboard - */ - struct KeyboardEvent : BaseEvent { - bool press; - uint key; - uint keycode; - - /** Constuctor */ - KeyboardEvent() noexcept - : BaseEvent(), - press(false), - key(0), - keycode(0) {} - }; - - /** - Special keyboard event. - - This event allows the use of keys that do not have unicode points. - Note that some are non-printable keys. - - @a press True if the key was pressed, false if released. - @a key The key pressed. - @see onSpecial - */ - struct SpecialEvent : BaseEvent { - bool press; - Key key; - - /** Constuctor */ - SpecialEvent() noexcept - : BaseEvent(), - press(false), - key(Key(0)) {} - }; - - /** - Character input event. - - This event represents text input, usually as the result of a key press. - The text is given both as a Unicode character code and a UTF-8 string. - - Note that this event is generated by the platform's input system, - so there is not necessarily a direct correspondence between text events and physical key presses. - For example, with some input methods a sequence of several key presses will generate a single character. - - @a keycode Raw key code. - @a character Unicode character code. - @a string UTF-8 string. - @see onCharacterInput - */ - struct CharacterInputEvent : BaseEvent { - uint keycode; - uint character; - char string[8]; - - /** Constuctor */ - CharacterInputEvent() noexcept - : BaseEvent(), - keycode(0), - character(0), - string{'\0','\0','\0','\0','\0','\0','\0','\0'} {} - }; - - /** - Mouse press or release event. - - @a button The button number starting from 1 (1 = left, 2 = middle, 3 = right). - @a press True if the button was pressed, false if released. - @a pos The widget-relative coordinates of the pointer. - @see onMouse - */ - struct MouseEvent : BaseEvent { - uint button; - bool press; - Point<double> pos; - - /** Constuctor */ - MouseEvent() noexcept - : BaseEvent(), - button(0), - press(false), - pos(0.0, 0.0) {} - }; - - /** - Mouse motion event. - - @a pos The widget-relative coordinates of the pointer. - @see onMotion - */ - struct MotionEvent : BaseEvent { - Point<double> pos; - - /** Constuctor */ - MotionEvent() noexcept - : BaseEvent(), - pos(0.0, 0.0) {} - }; - - /** - Mouse scroll event. - - The scroll distance is expressed in "lines", - an arbitrary unit that corresponds to a single tick of a detented mouse wheel. - For example, `delta.y` = 1.0 scrolls 1 line up. - Some systems and devices support finer resolution and/or higher values for fast scrolls, - so programs should handle any value gracefully. - - @a pos The widget-relative coordinates of the pointer. - @a delta The scroll distance. - @a direction The direction of the scroll or "smooth". - @see onScroll - */ - struct ScrollEvent : BaseEvent { - Point<double> pos; - Point<double> delta; - ScrollDirection direction; - - /** Constuctor */ - ScrollEvent() noexcept - : BaseEvent(), - pos(0.0, 0.0), - delta(0.0, 0.0), - direction(kScrollSmooth) {} - }; - - /** - Resize event. - @a size The new widget size. - @a oldSize The previous size, may be null. - @see onResize - */ - struct ResizeEvent { - Size<uint> size; - Size<uint> oldSize; - - /** Constuctor */ - ResizeEvent() noexcept - : size(0, 0), - oldSize(0, 0) {} - }; - - /** - Widget position changed event. - @a pos The new absolute position of the widget. - @a oldPos The previous absolute position of the widget. - @see onPositionChanged - */ - struct PositionChangedEvent { - Point<int> pos; - Point<int> oldPos; - - /** Constuctor */ - PositionChangedEvent() noexcept - : pos(0, 0), - oldPos(0, 0) {} - }; -} - -// -------------------------------------------------------------------------------------------------------------------- - -END_NAMESPACE_DGL - -#endif // DGL_EVENTS_HPP_INCLUDED diff --git a/dgl/Widget.hpp b/dgl/Widget.hpp @@ -17,7 +17,7 @@ #ifndef DGL_WIDGET_HPP_INCLUDED #define DGL_WIDGET_HPP_INCLUDED -#include "Events.hpp" +#include "Geometry.hpp" START_NAMESPACE_DGL @@ -29,8 +29,6 @@ class SubWidget; class TopLevelWidget; class Window; -using namespace Events; - // -------------------------------------------------------------------------------------------------------------------- /** @@ -54,6 +52,203 @@ using namespace Events; */ class Widget { +public: + /** + Base event data. + These are the fields present on all Widget events. + + @a mod Currently active keyboard modifiers, @see Modifier. + @a mod Event flags, @see Flag. + @a time Event timestamp (if any). + */ + struct BaseEvent { + uint mod; + uint flags; + uint time; + + /** Constuctor */ + BaseEvent() noexcept : mod(0x0), flags(0x0), time(0) {} + /** Destuctor */ + virtual ~BaseEvent() noexcept {} + }; + + /** + Keyboard event. + + This event represents low-level key presses and releases. + This can be used for "direct" keyboard handing like key bindings, but must not be interpreted as text input. + + Keys are represented portably as Unicode code points, using the "natural" code point for the key. + The @a key field is the code for the pressed key, without any modifiers applied. + For example, a press or release of the 'A' key will have `key` 97 ('a') + regardless of whether shift or control are being held. + + Alternatively, the raw @a keycode can be used to work directly with physical keys, + but note that this value is not portable and differs between platforms and hardware. + + @a press True if the key was pressed, false if released. + @a key Unicode point of the key pressed. + @a keycode Raw keycode. + @see onKeyboard + */ + struct KeyboardEvent : BaseEvent { + bool press; + uint key; + uint keycode; + + /** Constuctor */ + KeyboardEvent() noexcept + : BaseEvent(), + press(false), + key(0), + keycode(0) {} + }; + + /** + Special keyboard event. + + This event allows the use of keys that do not have unicode points. + Note that some are non-printable keys. + + @a press True if the key was pressed, false if released. + @a key The key pressed. + @see onSpecial + */ + struct SpecialEvent : BaseEvent { + bool press; + Key key; + + /** Constuctor */ + SpecialEvent() noexcept + : BaseEvent(), + press(false), + key(Key(0)) {} + }; + + /** + Character input event. + + This event represents text input, usually as the result of a key press. + The text is given both as a Unicode character code and a UTF-8 string. + + Note that this event is generated by the platform's input system, + so there is not necessarily a direct correspondence between text events and physical key presses. + For example, with some input methods a sequence of several key presses will generate a single character. + + @a keycode Raw key code. + @a character Unicode character code. + @a string UTF-8 string. + @see onCharacterInput + */ + struct CharacterInputEvent : BaseEvent { + uint keycode; + uint character; + char string[8]; + + /** Constuctor */ + CharacterInputEvent() noexcept + : BaseEvent(), + keycode(0), + character(0), + string{'\0','\0','\0','\0','\0','\0','\0','\0'} {} + }; + + /** + Mouse press or release event. + + @a button The button number starting from 1 (1 = left, 2 = middle, 3 = right). + @a press True if the button was pressed, false if released. + @a pos The widget-relative coordinates of the pointer. + @see onMouse + */ + struct MouseEvent : BaseEvent { + uint button; + bool press; + Point<double> pos; + + /** Constuctor */ + MouseEvent() noexcept + : BaseEvent(), + button(0), + press(false), + pos(0.0, 0.0) {} + }; + + /** + Mouse motion event. + + @a pos The widget-relative coordinates of the pointer. + @see onMotion + */ + struct MotionEvent : BaseEvent { + Point<double> pos; + + /** Constuctor */ + MotionEvent() noexcept + : BaseEvent(), + pos(0.0, 0.0) {} + }; + + /** + Mouse scroll event. + + The scroll distance is expressed in "lines", + an arbitrary unit that corresponds to a single tick of a detented mouse wheel. + For example, `delta.y` = 1.0 scrolls 1 line up. + Some systems and devices support finer resolution and/or higher values for fast scrolls, + so programs should handle any value gracefully. + + @a pos The widget-relative coordinates of the pointer. + @a delta The scroll distance. + @a direction The direction of the scroll or "smooth". + @see onScroll + */ + struct ScrollEvent : BaseEvent { + Point<double> pos; + Point<double> delta; + ScrollDirection direction; + + /** Constuctor */ + ScrollEvent() noexcept + : BaseEvent(), + pos(0.0, 0.0), + delta(0.0, 0.0), + direction(kScrollSmooth) {} + }; + + /** + Resize event. + @a size The new widget size. + @a oldSize The previous size, may be null. + @see onResize + */ + struct ResizeEvent { + Size<uint> size; + Size<uint> oldSize; + + /** Constuctor */ + ResizeEvent() noexcept + : size(0, 0), + oldSize(0, 0) {} + }; + + /** + Widget position changed event. + @a pos The new absolute position of the widget. + @a oldPos The previous absolute position of the widget. + @see onPositionChanged + */ + struct PositionChangedEvent { + Point<int> pos; + Point<int> oldPos; + + /** Constuctor */ + PositionChangedEvent() noexcept + : pos(0, 0), + oldPos(0, 0) {} + }; + +private: /** Private constructor, reserved for TopLevelWidget class. */ diff --git a/dgl/src/Common.hpp b/dgl/src/Common.hpp @@ -42,7 +42,7 @@ struct ButtonImpl { self(s), callback_img(nullptr) {} - bool onMouse(const Events::MouseEvent& ev) + bool onMouse(const Widget::MouseEvent& ev) { // button was released, handle it now if (button != -1 && ! ev.press) @@ -83,7 +83,7 @@ struct ButtonImpl { return false; } - bool onMotion(const Events::MotionEvent& ev) + bool onMotion(const Widget::MotionEvent& ev) { // keep pressed if (button != -1) diff --git a/dgl/src/TopLevelWidgetPrivateData.cpp b/dgl/src/TopLevelWidgetPrivateData.cpp @@ -37,7 +37,7 @@ TopLevelWidget::PrivateData::~PrivateData() window.pData->topLevelWidget = nullptr; } -bool TopLevelWidget::PrivateData::keyboardEvent(const Events::KeyboardEvent& ev) +bool TopLevelWidget::PrivateData::keyboardEvent(const KeyboardEvent& ev) { // give top-level widget chance to catch this event first if (self->onKeyboard(ev)) @@ -47,7 +47,7 @@ bool TopLevelWidget::PrivateData::keyboardEvent(const Events::KeyboardEvent& ev) return selfw->pData->giveKeyboardEventForSubWidgets(ev); } -bool TopLevelWidget::PrivateData::specialEvent(const Events::SpecialEvent& ev) +bool TopLevelWidget::PrivateData::specialEvent(const SpecialEvent& ev) { // give top-level widget chance to catch this event first if (self->onSpecial(ev)) @@ -57,7 +57,7 @@ bool TopLevelWidget::PrivateData::specialEvent(const Events::SpecialEvent& ev) return selfw->pData->giveSpecialEventForSubWidgets(ev); } -bool TopLevelWidget::PrivateData::characterInputEvent(const Events::CharacterInputEvent& ev) +bool TopLevelWidget::PrivateData::characterInputEvent(const CharacterInputEvent& ev) { // give top-level widget chance to catch this event first if (self->onCharacterInput(ev)) @@ -67,9 +67,9 @@ bool TopLevelWidget::PrivateData::characterInputEvent(const Events::CharacterInp return selfw->pData->giveCharacterInputEventForSubWidgets(ev); } -bool TopLevelWidget::PrivateData::mouseEvent(const Events::MouseEvent& ev) +bool TopLevelWidget::PrivateData::mouseEvent(const MouseEvent& ev) { - Events::MouseEvent rev = ev; + MouseEvent rev = ev; if (window.pData->autoScaling) { @@ -87,9 +87,9 @@ bool TopLevelWidget::PrivateData::mouseEvent(const Events::MouseEvent& ev) return selfw->pData->giveMouseEventForSubWidgets(rev); } -bool TopLevelWidget::PrivateData::motionEvent(const Events::MotionEvent& ev) +bool TopLevelWidget::PrivateData::motionEvent(const MotionEvent& ev) { - Events::MotionEvent rev = ev; + MotionEvent rev = ev; if (window.pData->autoScaling) { @@ -107,9 +107,9 @@ bool TopLevelWidget::PrivateData::motionEvent(const Events::MotionEvent& ev) return selfw->pData->giveMotionEventForSubWidgets(rev); } -bool TopLevelWidget::PrivateData::scrollEvent(const Events::ScrollEvent& ev) +bool TopLevelWidget::PrivateData::scrollEvent(const ScrollEvent& ev) { - Events::ScrollEvent rev = ev; + ScrollEvent rev = ev; if (window.pData->autoScaling) { diff --git a/dgl/src/TopLevelWidgetPrivateData.hpp b/dgl/src/TopLevelWidgetPrivateData.hpp @@ -33,12 +33,12 @@ struct TopLevelWidget::PrivateData { explicit PrivateData(TopLevelWidget* const s, Window& w); ~PrivateData(); void display(); - bool keyboardEvent(const Events::KeyboardEvent& ev); - bool specialEvent(const Events::SpecialEvent& ev); - bool characterInputEvent(const Events::CharacterInputEvent& ev); - bool mouseEvent(const Events::MouseEvent& ev); - bool motionEvent(const Events::MotionEvent& ev); - bool scrollEvent(const Events::ScrollEvent& ev); + bool keyboardEvent(const KeyboardEvent& ev); + bool specialEvent(const SpecialEvent& ev); + bool characterInputEvent(const CharacterInputEvent& ev); + bool mouseEvent(const MouseEvent& ev); + bool motionEvent(const MotionEvent& ev); + bool scrollEvent(const ScrollEvent& ev); void fallbackOnResize(); DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PrivateData) diff --git a/dgl/src/WidgetPrivateData.cpp b/dgl/src/WidgetPrivateData.cpp @@ -69,7 +69,7 @@ void Widget::PrivateData::displaySubWidgets(const uint width, const uint height, // ----------------------------------------------------------------------- -bool Widget::PrivateData::giveKeyboardEventForSubWidgets(const Events::KeyboardEvent& ev) +bool Widget::PrivateData::giveKeyboardEventForSubWidgets(const KeyboardEvent& ev) { if (! visible) return false; @@ -87,7 +87,7 @@ bool Widget::PrivateData::giveKeyboardEventForSubWidgets(const Events::KeyboardE return false; } -bool Widget::PrivateData::giveSpecialEventForSubWidgets(const Events::SpecialEvent& ev) +bool Widget::PrivateData::giveSpecialEventForSubWidgets(const SpecialEvent& ev) { if (! visible) return false; @@ -105,7 +105,7 @@ bool Widget::PrivateData::giveSpecialEventForSubWidgets(const Events::SpecialEve return false; } -bool Widget::PrivateData::giveCharacterInputEventForSubWidgets(const Events::CharacterInputEvent& ev) +bool Widget::PrivateData::giveCharacterInputEventForSubWidgets(const CharacterInputEvent& ev) { if (! visible) return false; @@ -123,7 +123,7 @@ bool Widget::PrivateData::giveCharacterInputEventForSubWidgets(const Events::Cha return false; } -bool Widget::PrivateData::giveMouseEventForSubWidgets(Events::MouseEvent& ev) +bool Widget::PrivateData::giveMouseEventForSubWidgets(MouseEvent& ev) { if (! visible) return false; @@ -150,7 +150,7 @@ bool Widget::PrivateData::giveMouseEventForSubWidgets(Events::MouseEvent& ev) return false; } -bool Widget::PrivateData::giveMotionEventForSubWidgets(Events::MotionEvent& ev) +bool Widget::PrivateData::giveMotionEventForSubWidgets(MotionEvent& ev) { if (! visible) return false; @@ -177,7 +177,7 @@ bool Widget::PrivateData::giveMotionEventForSubWidgets(Events::MotionEvent& ev) return false; } -bool Widget::PrivateData::giveScrollEventForSubWidgets(Events::ScrollEvent& ev) +bool Widget::PrivateData::giveScrollEventForSubWidgets(ScrollEvent& ev) { if (! visible) return false; diff --git a/dgl/src/WidgetPrivateData.hpp b/dgl/src/WidgetPrivateData.hpp @@ -43,12 +43,12 @@ struct Widget::PrivateData { void displaySubWidgets(uint width, uint height, double autoScaleFactor); - bool giveKeyboardEventForSubWidgets(const Events::KeyboardEvent& ev); - bool giveSpecialEventForSubWidgets(const Events::SpecialEvent& ev); - bool giveCharacterInputEventForSubWidgets(const Events::CharacterInputEvent& ev); - bool giveMouseEventForSubWidgets(Events::MouseEvent& ev); - bool giveMotionEventForSubWidgets(Events::MotionEvent& ev); - bool giveScrollEventForSubWidgets(Events::ScrollEvent& ev); + bool giveKeyboardEventForSubWidgets(const KeyboardEvent& ev); + bool giveSpecialEventForSubWidgets(const SpecialEvent& ev); + bool giveCharacterInputEventForSubWidgets(const CharacterInputEvent& ev); + bool giveMouseEventForSubWidgets(MouseEvent& ev); + bool giveMotionEventForSubWidgets(MotionEvent& ev); + bool giveScrollEventForSubWidgets(ScrollEvent& ev); static TopLevelWidget* findTopLevelWidget(Widget* const w); diff --git a/dgl/src/WindowPrivateData.cpp b/dgl/src/WindowPrivateData.cpp @@ -533,7 +533,7 @@ void Window::PrivateData::onPuglFocus(const bool focus, const CrossingMode mode) self->onFocus(focus, mode); } -void Window::PrivateData::onPuglKey(const Events::KeyboardEvent& ev) +void Window::PrivateData::onPuglKey(const Widget::KeyboardEvent& ev) { DGL_DBGp("onPuglKey : %i %u %u\n", ev.press, ev.key, ev.keycode); @@ -546,7 +546,7 @@ void Window::PrivateData::onPuglKey(const Events::KeyboardEvent& ev) #endif } -void Window::PrivateData::onPuglSpecial(const Events::SpecialEvent& ev) +void Window::PrivateData::onPuglSpecial(const Widget::SpecialEvent& ev) { DGL_DBGp("onPuglSpecial : %i %u\n", ev.press, ev.key); @@ -559,7 +559,7 @@ void Window::PrivateData::onPuglSpecial(const Events::SpecialEvent& ev) #endif } -void Window::PrivateData::onPuglText(const Events::CharacterInputEvent& ev) +void Window::PrivateData::onPuglText(const Widget::CharacterInputEvent& ev) { DGL_DBGp("onPuglText : %u %u %s\n", ev.keycode, ev.character, ev.string); @@ -572,7 +572,7 @@ void Window::PrivateData::onPuglText(const Events::CharacterInputEvent& ev) #endif } -void Window::PrivateData::onPuglMouse(const Events::MouseEvent& ev) +void Window::PrivateData::onPuglMouse(const Widget::MouseEvent& ev) { DGL_DBGp("onPuglMouse : %i %i %f %f\n", ev.button, ev.press, ev.pos.getX(), ev.pos.getY()); @@ -585,7 +585,7 @@ void Window::PrivateData::onPuglMouse(const Events::MouseEvent& ev) #endif } -void Window::PrivateData::onPuglMotion(const Events::MotionEvent& ev) +void Window::PrivateData::onPuglMotion(const Widget::MotionEvent& ev) { DGL_DBGp("onPuglMotion : %f %f\n", ev.pos.getX(), ev.pos.getY()); @@ -598,7 +598,7 @@ void Window::PrivateData::onPuglMotion(const Events::MotionEvent& ev) #endif } -void Window::PrivateData::onPuglScroll(const Events::ScrollEvent& ev) +void Window::PrivateData::onPuglScroll(const Widget::ScrollEvent& ev) { DGL_DBGp("onPuglScroll : %f %f %f %f\n", ev.pos.getX(), ev.pos.getY(), ev.delta.getX(), ev.delta.getY()); @@ -684,7 +684,7 @@ PuglStatus Window::PrivateData::puglEventCallback(PuglView* const view, const Pu { // unused x, y, xRoot, yRoot (double) // TODO special keys? - Events::KeyboardEvent ev; + Widget::KeyboardEvent ev; ev.mod = event->key.state; ev.flags = event->key.flags; ev.time = static_cast<uint>(event->key.time * 1000.0 + 0.5); @@ -701,7 +701,7 @@ PuglStatus Window::PrivateData::puglEventCallback(PuglView* const view, const Pu case PUGL_TEXT: { // unused x, y, xRoot, yRoot (double) - Events::CharacterInputEvent ev; + Widget::CharacterInputEvent ev; ev.mod = event->text.state; ev.flags = event->text.flags; ev.time = static_cast<uint>(event->text.time * 1000.0 + 0.5); @@ -724,7 +724,7 @@ PuglStatus Window::PrivateData::puglEventCallback(PuglView* const view, const Pu ///< Mouse button released, a #PuglEventButton case PUGL_BUTTON_RELEASE: { - Events::MouseEvent ev; + Widget::MouseEvent ev; ev.mod = event->button.state; ev.flags = event->button.flags; ev.time = static_cast<uint>(event->button.time * 1000.0 + 0.5); @@ -738,7 +738,7 @@ PuglStatus Window::PrivateData::puglEventCallback(PuglView* const view, const Pu ///< Pointer moved, a #PuglEventMotion case PUGL_MOTION: { - Events::MotionEvent ev; + Widget::MotionEvent ev; ev.mod = event->motion.state; ev.flags = event->motion.flags; ev.time = static_cast<uint>(event->motion.time * 1000.0 + 0.5); @@ -750,7 +750,7 @@ PuglStatus Window::PrivateData::puglEventCallback(PuglView* const view, const Pu ///< Scrolled, a #PuglEventScroll case PUGL_SCROLL: { - Events::ScrollEvent ev; + Widget::ScrollEvent ev; ev.mod = event->scroll.state; ev.flags = event->scroll.flags; ev.time = static_cast<uint>(event->scroll.time * 1000.0 + 0.5); diff --git a/dgl/src/WindowPrivateData.hpp b/dgl/src/WindowPrivateData.hpp @@ -18,7 +18,7 @@ #define DGL_WINDOW_PRIVATE_DATA_HPP_INCLUDED #include "../Window.hpp" -#include "../Events.hpp" +#include "../Widget.hpp" #include "ApplicationPrivateData.hpp" #include "pugl.hpp" @@ -149,12 +149,12 @@ struct Window::PrivateData : IdleCallback { void onPuglExpose(); void onPuglClose(); void onPuglFocus(bool focus, CrossingMode mode); - void onPuglKey(const Events::KeyboardEvent& ev); - void onPuglSpecial(const Events::SpecialEvent& ev); - void onPuglText(const Events::CharacterInputEvent& ev); - void onPuglMouse(const Events::MouseEvent& ev); - void onPuglMotion(const Events::MotionEvent& ev); - void onPuglScroll(const Events::ScrollEvent& ev); + void onPuglKey(const Widget::KeyboardEvent& ev); + void onPuglSpecial(const Widget::SpecialEvent& ev); + void onPuglText(const Widget::CharacterInputEvent& ev); + void onPuglMouse(const Widget::MouseEvent& ev); + void onPuglMotion(const Widget::MotionEvent& ev); + void onPuglScroll(const Widget::ScrollEvent& ev); // Pugl event handling entry point static PuglStatus puglEventCallback(PuglView* view, const PuglEvent* event);