From a59b437e8c39b7dd21bff07c6241e7313f4a6d33 Mon Sep 17 00:00:00 2001 From: Guillaume Piolat Date: Fri, 25 Oct 2024 17:26:29 +0200 Subject: [PATCH] Resize more functional now --- clap/dplug/clap/client.d | 9 +++++++-- clap/dplug/clap/types.d | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/clap/dplug/clap/client.d b/clap/dplug/clap/client.d index e70924c0..32455228 100644 --- a/clap/dplug/clap/client.d +++ b/clap/dplug/clap/client.d @@ -1050,6 +1050,7 @@ nothrow @nogc: this(const(clap_host_t)* host) { _host = host; + _host_gui = cast(clap_host_gui_t*) host.get_extension(host, "clap.gui".ptr); } /// Notifies the host that editing of a parameter has begun from UI side. @@ -1082,8 +1083,11 @@ nothrow @nogc: /// Returns: `true` if the host parent window has been resized. override bool requestResize(int widthLogicalPixels, int heightLogicalPixels) { - // TODO - return false; + if (!_host_gui) + return false; + if (widthLogicalPixels < 0 || heightLogicalPixels < 0) + return false; + return _host_gui.request_resize(_host, widthLogicalPixels, heightLogicalPixels); } override bool notifyResized() @@ -1112,5 +1116,6 @@ nothrow @nogc: } const(clap_host_t)* _host; + const(clap_host_gui_t)* _host_gui; } diff --git a/clap/dplug/clap/types.d b/clap/dplug/clap/types.d index 777e94ae..459fc400 100644 --- a/clap/dplug/clap/types.d +++ b/clap/dplug/clap/types.d @@ -1216,6 +1216,8 @@ extern(C) nothrow @nogc: struct clap_host_gui_t { +extern(C) nothrow @nogc: + // The host should call get_resize_hints() again. // [thread-safe & !floating] void function(const clap_host_t *host) resize_hints_changed; @@ -1252,6 +1254,7 @@ struct clap_host_gui_t struct clap_host_t { +extern(C) nothrow @nogc: clap_version_t clap_version; // initialized to CLAP_VERSION void* host_data; // reserved pointer for the host