Browse Source

Add CrossingMode for window focus event; Cleanup

Signed-off-by: falkTX <falktx@falktx.com>
pull/272/head
falkTX 4 years ago
parent
commit
bdcdd576a4
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
4 changed files with 8 additions and 44 deletions
  1. +1
    -38
      dgl/Window.hpp
  2. +1
    -1
      dgl/src/Window.cpp
  3. +5
    -4
      dgl/src/WindowPrivateData.cpp
  4. +1
    -1
      dgl/src/WindowPrivateData.hpp

+ 1
- 38
dgl/Window.hpp View File

@@ -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

// -----------------------------------------------------------------------


+ 1
- 1
dgl/src/Window.cpp View File

@@ -232,7 +232,7 @@ bool Window::onClose()
return true;
}

void Window::onFocus(bool)
void Window::onFocus(bool, CrossingMode)
{
}



+ 5
- 4
dgl/src/WindowPrivateData.cpp View File

@@ -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


+ 1
- 1
dgl/src/WindowPrivateData.hpp View File

@@ -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);


Loading…
Cancel
Save