From 0979c285c0cdaf7efc65bdf86882db20596e1de7 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 8 Jun 2018 19:14:17 +0200 Subject: Make pugl work with testmain. --- plugingui/Makefile.am | 10 ++++++++-- plugingui/nativewindow_pugl.cc | 8 ++------ plugingui/testmain.cc | 15 ++++++++++++++- 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; -- cgit v1.2.3