Skip to content

Commit

Permalink
libmythui: Add a generic callback MythEvent
Browse files Browse the repository at this point in the history
- this will be used by hardware decoder classes to request that GPU
resources are created/destroyed in the UI thread.
  • Loading branch information
mark-kendall committed Feb 4, 2019
1 parent e76fce4 commit 4917b91
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mythtv/libs/libmythbase/mythevent.cpp
Expand Up @@ -26,3 +26,5 @@ QEvent::Type MythEvent::kEnableUDPListenerEventType =
(QEvent::Type) QEvent::registerEventType();
QEvent::Type ExternalKeycodeEvent::kEventType =
(QEvent::Type) QEvent::registerEventType();
QEvent::Type MythCallbackEvent::kCallbackType =
(QEvent::Type) QEvent::registerEventType();
20 changes: 20 additions & 0 deletions mythtv/libs/libmythbase/mythevent.h
Expand Up @@ -118,4 +118,24 @@ class MBASE_PUBLIC MythInfoMapEvent : public MythEvent
InfoMap m_infoMap;
};

class MBASE_PUBLIC MythCallbackEvent : public QEvent
{
public:
typedef void (*Callback)(void*, void*, void*);
MythCallbackEvent(Callback Function, void *Opaque1, void *Opaque2, void* Opaque3)
: QEvent(kCallbackType),
m_function(Function),
m_opaque1(Opaque1),
m_opaque2(Opaque2),
m_opaque3(Opaque3)
{
}

static Type kCallbackType;
Callback m_function;
void* m_opaque1;
void* m_opaque2;
void* m_opaque3;
};

#endif /* MYTHEVENT_H */
6 changes: 6 additions & 0 deletions mythtv/libs/libmythui/mythmainwindow.cpp
Expand Up @@ -2594,6 +2594,12 @@ void MythMainWindow::customEvent(QEvent *ce)
{
GetNotificationCenter()->ProcessQueue();
}
else if (ce->type() == MythCallbackEvent::kCallbackType)
{
MythCallbackEvent *me = static_cast<MythCallbackEvent*>(ce);
if (me && me->m_function)
me->m_function(me->m_opaque1, me->m_opaque2, me->m_opaque3);
}
}

QObject *MythMainWindow::getTarget(QKeyEvent &key)
Expand Down

0 comments on commit 4917b91

Please sign in to comment.