commit bdcdd576a42c8525d2e69dc1683d3f5fe62c671f
parent 74680dedcf658ac9298afea5a7cc9237e46a283e
Author: falkTX <falktx@falktx.com>
Date: Sun, 16 May 2021 12:24:32 +0100
Add CrossingMode for window focus event; Cleanup
Signed-off-by: falkTX <falktx@falktx.com>
Diffstat:
4 files changed, 8 insertions(+), 44 deletions(-)
diff --git a/dgl/Window.hpp b/dgl/Window.hpp
@@ -252,7 +252,7 @@ protected:
A function called when the window gains or loses the keyboard focus.
The default implementation does nothing.
*/
- virtual void onFocus(bool focus);
+ virtual void onFocus(bool focus, CrossingMode mode);
/**
A function called when the window is resized.
@@ -278,16 +278,6 @@ END_NAMESPACE_DGL
* add eventcrossing/enter-leave event
*/
-// class StandaloneWindow;
-// class Widget;
-
-// #ifdef DISTRHO_DEFINES_H_INCLUDED
-// START_NAMESPACE_DISTRHO
-// class UI;
-// class UIExporter;
-// END_NAMESPACE_DISTRHO
-// #endif
-
#if 0
#ifndef DGL_FILE_BROWSER_DISABLED
/**
@@ -332,8 +322,6 @@ END_NAMESPACE_DGL
void exec(bool lockWait = false);
- const GraphicsContext& getGraphicsContext() const noexcept;
-
void addIdleCallback(IdleCallback* const callback);
void removeIdleCallback(IdleCallback* const callback);
@@ -341,38 +329,13 @@ END_NAMESPACE_DGL
bool openFileBrowser(const FileBrowserOptions& options);
#endif
-
protected:
#ifndef DGL_FILE_BROWSER_DISABLED
virtual void fileBrowserSelected(const char* filename);
#endif
- // internal
- void _setAutoScaling(double scaling) noexcept;
-
- virtual void _addWidget(Widget* const widget);
- virtual void _removeWidget(Widget* const widget);
- void _idle();
-
bool handlePluginKeyboard(const bool press, const uint key);
bool handlePluginSpecial(const bool press, const Key key);
-
-// friend class Widget;
-// friend class StandaloneWindow;
-// #ifdef DISTRHO_DEFINES_H_INCLUDED
-// friend class DISTRHO_NAMESPACE::UI;
-// friend class DISTRHO_NAMESPACE::UIExporter;
-// #endif
-
- // Prevent copies
-// #ifdef DISTRHO_PROPER_CPP11_SUPPORT
-// Window& operator=(Window&) = delete;
-// Window& operator=(const Window&) = delete;
-// #else
-// Window& operator=(Window&);
-// Window& operator=(const Window&);
-// #endif
-
#endif
// -----------------------------------------------------------------------
diff --git a/dgl/src/Window.cpp b/dgl/src/Window.cpp
@@ -232,7 +232,7 @@ bool Window::onClose()
return true;
}
-void Window::onFocus(bool)
+void Window::onFocus(bool, CrossingMode)
{
}
diff --git a/dgl/src/WindowPrivateData.cpp b/dgl/src/WindowPrivateData.cpp
@@ -384,15 +384,15 @@ void Window::PrivateData::onPuglClose()
close();
}
-void Window::PrivateData::onPuglFocus(const bool focus)
+void Window::PrivateData::onPuglFocus(const bool focus, const CrossingMode mode)
{
- DGL_DBGp("onPuglFocus : %i %u %u\n", focus);
+ DGL_DBGp("onPuglFocus : %i %i\n", focus, mode);
// if (fModal.childFocus != nullptr)
// return fModal.childFocus->focus();
#ifndef DPF_TEST_WINDOW_CPP
- self->onFocus(focus);
+ self->onFocus(focus, mode);
#endif
}
@@ -532,7 +532,8 @@ PuglStatus Window::PrivateData::puglEventCallback(PuglView* const view, const Pu
case PUGL_FOCUS_IN:
///< Keyboard focus left view, a #PuglEventFocus
case PUGL_FOCUS_OUT:
- pData->onPuglFocus(event->type == PUGL_FOCUS_IN);
+ pData->onPuglFocus(event->type == PUGL_FOCUS_IN,
+ static_cast<CrossingMode>(event->focus.mode));
break;
///< Key pressed, a #PuglEventKey
diff --git a/dgl/src/WindowPrivateData.hpp b/dgl/src/WindowPrivateData.hpp
@@ -109,7 +109,7 @@ struct Window::PrivateData : IdleCallback {
void onPuglConfigure(int width, int height);
void onPuglExpose();
void onPuglClose();
- void onPuglFocus(bool focus);
+ void onPuglFocus(bool focus, CrossingMode mode);
void onPuglKey(const Events::KeyboardEvent& ev);
void onPuglSpecial(const Events::SpecialEvent& ev);
void onPuglText(const Events::CharacterInputEvent& ev);