Skip to content

Commit

Permalink
Resize more functional now
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Piolat committed Oct 25, 2024
1 parent 006d0e9 commit a59b437
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 7 additions & 2 deletions clap/dplug/clap/client.d
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -1112,5 +1116,6 @@ nothrow @nogc:
}

const(clap_host_t)* _host;
const(clap_host_gui_t)* _host_gui;
}

3 changes: 3 additions & 0 deletions clap/dplug/clap/types.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a59b437

Please sign in to comment.