summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2018-06-08 19:14:17 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2018-06-08 19:29:07 +0200
commit0979c285c0cdaf7efc65bdf86882db20596e1de7 (patch)
treed58393521280fa1725c4113951d1e87cecf8482f
parent0531409611867ae8dad711e52d6534fa634d40cc (diff)
Make pugl work with testmain.
-rw-r--r--plugingui/Makefile.am10
-rw-r--r--plugingui/nativewindow_pugl.cc8
-rw-r--r--plugingui/testmain.cc15
3 files changed, 24 insertions, 9 deletions
diff --git a/plugingui/Makefile.am b/plugingui/Makefile.am
index f9d9c09..ee6b457 100644
--- a/plugingui/Makefile.am
+++ b/plugingui/Makefile.am
@@ -150,8 +150,14 @@ endif
plugingui_LDADD = libdggui.la $(top_srcdir)/src/libdg.la
-plugingui_CXXFLAGS = $(SNDFILE_CXXFLAGS) $(PTHREAD_CFLAGS) $(EXPAT_CFLAGS) \
- -I$(top_srcdir)/include -I$(top_srcdir)/src -I$(top_srcdir)/hugin
+plugingui_CXXFLAGS = \
+ $(GUI_CPPFLAGS) \
+ $(SNDFILE_CXXFLAGS) \
+ $(PTHREAD_CFLAGS) \
+ $(EXPAT_CFLAGS) \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src \
+ -I$(top_srcdir)/hugin
plugingui_CFLAGS = $(plugingui_CXXFLAGS)
diff --git a/plugingui/nativewindow_pugl.cc b/plugingui/nativewindow_pugl.cc
index 59f03b1..f94b82b 100644
--- a/plugingui/nativewindow_pugl.cc
+++ b/plugingui/nativewindow_pugl.cc
@@ -272,7 +272,6 @@ void NativeWindowPugl::onDisplay(PuglView* view)
Window& window = native->window;
//window.redraw();
- printf("!!! %p %d %d\n", native, (int)window.wpixbuf.width, (int)window.wpixbuf.height);
if((window.wpixbuf.width < 16) || (window.wpixbuf.height < 16))
{
return;
@@ -359,9 +358,8 @@ void NativeWindowPugl::onKeyboard(PuglView* view, bool press, uint32_t key)
KeyEvent* e = new KeyEvent();
e->direction = press ? Direction::down : Direction::up;
- printf("%d\n", key);
-
- switch(key) {
+ switch(key)
+ {
case PUGL_KEY_LEFT: e->keycode = Key::left; break;
case PUGL_KEY_RIGHT: e->keycode = Key::right; break;
case PUGL_KEY_UP: e->keycode = Key::up; break;
@@ -378,8 +376,6 @@ void NativeWindowPugl::onKeyboard(PuglView* view, bool press, uint32_t key)
e->text.assign(1, (char)key);
}
- printf("\t text: %s\n", e->text.c_str());
-
native->eventq.push_back(e);
}
diff --git a/plugingui/testmain.cc b/plugingui/testmain.cc
index 9d10bd9..b122756 100644
--- a/plugingui/testmain.cc
+++ b/plugingui/testmain.cc
@@ -37,23 +37,36 @@ int main()
{
INFO(example, "We are up and running");
+ void* native_window_handle{nullptr};
+#ifndef UI_PUGL
GUI::Window parent{nullptr};
parent.setCaption("PluginGui Test Application");
+ native_window_handle = parent.getNativeWindowHandle();
+#endif
Settings settings;
- GUI::MainWindow main_window(settings, parent.getNativeWindowHandle());
+ GUI::MainWindow main_window(settings, native_window_handle);
+
+#ifndef UI_PUGL
CONNECT(&parent, eventHandler()->closeNotifier, &main_window,
&GUI::MainWindow::closeEventHandler);
parent.show();
+#endif
main_window.show();
// TODO: automatically use drumgizmo_plugin.h size here
+#ifndef UI_PUGL
parent.resize(750, 613);
+#else
+ main_window.resize(750, 613);
+#endif
while(true)
{
+#ifndef UI_PUGL
parent.eventHandler()->processEvents();
+#endif
if(!main_window.processEvents())
{
break;