From 73413fe1c39534e3cc4e0d1ef1b8b86a593e4eac Mon Sep 17 00:00:00 2001 From: Hanspeter Portner Date: Wed, 14 Apr 2021 00:04:29 +0200 Subject: [PATCH] nk: fix last commit. --- VERSION | 2 +- midi_matrix_channel_filter_nk.c | 42 ++++++++++++++++----------------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/VERSION b/VERSION index 0fca64c..befa3cf 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.29.9 +0.29.11 diff --git a/midi_matrix_channel_filter_nk.c b/midi_matrix_channel_filter_nk.c index 2967d25..2099bba 100644 --- a/midi_matrix_channel_filter_nk.c +++ b/midi_matrix_channel_filter_nk.c @@ -194,27 +194,6 @@ instantiate(const LV2UI_Descriptor *descriptor, handle->controller = controller; handle->writer = write_function; - const float scale = nk_pugl_get_scale(); - - nk_pugl_config_t *cfg = &handle->win.cfg; - cfg->width = 640 * scale; - cfg->height = 640 * scale; - cfg->resizable = true; - cfg->fixed_aspect = true; - cfg->ignore = false; - cfg->class = "channel_filter"; - cfg->title = "Channel Filter"; - cfg->parent = (intptr_t)parent; - cfg->host_resize = host_resize; - cfg->data = handle; - cfg->expose = _expose; - - if(asprintf(&cfg->font.face, "%sCousine-Regular.ttf", bundle_path) == -1) - cfg->font.face= NULL; - cfg->font.size = 13 * scale; - - *(intptr_t *)widget = nk_pugl_init(&handle->win); - const LV2_URID ui_scaleFactor = handle->map->map(handle->map->handle, LV2_UI__scaleFactor); @@ -230,9 +209,28 @@ instantiate(const LV2UI_Descriptor *descriptor, if(handle->scale == 0.f) { - handle->scale = nk_pugl_get_scale(&handle->win); + handle->scale = nk_pugl_get_scale(); } + nk_pugl_config_t *cfg = &handle->win.cfg; + cfg->width = 640 * handle->scale; + cfg->height = 640 * handle->scale; + cfg->resizable = true; + cfg->fixed_aspect = true; + cfg->ignore = false; + cfg->class = "channel_filter"; + cfg->title = "Channel Filter"; + cfg->parent = (intptr_t)parent; + cfg->host_resize = host_resize; + cfg->data = handle; + cfg->expose = _expose; + + if(asprintf(&cfg->font.face, "%sCousine-Regular.ttf", bundle_path) == -1) + cfg->font.face= NULL; + cfg->font.size = 13 * handle->scale; + + *(intptr_t *)widget = nk_pugl_init(&handle->win); + nk_pugl_show(&handle->win); nk_patcher_init(&handle->patch, 0.8f); -- 2.38.5