commit 057615bfc2aa8368b79f1369b615381b968cd3cb
parent dcb57e11e88da46479ef01494e77e9b052c143fd
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date: Mon, 7 Feb 2022 20:58:48 +0100
Work with logical pixels on macOS and physical with x11 and windows
Diffstat:
4 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/clap/ext/gui-cocoa.h b/include/clap/ext/gui-cocoa.h
@@ -10,6 +10,7 @@ extern "C" {
#pragma pack(push, CLAP_ALIGN)
+// size will be in logical pixels
typedef struct clap_plugin_gui_cocoa {
// [main-thread]
bool (*attach)(const clap_plugin_t *plugin, void *nsView);
diff --git a/include/clap/ext/gui-win32.h b/include/clap/ext/gui-win32.h
@@ -13,6 +13,7 @@ extern "C" {
// we don't want to include windows.h from this file.
typedef void *clap_hwnd;
+// size will be in physical pixels
typedef struct clap_plugin_gui_win32 {
// [main-thread]
bool (*attach)(const clap_plugin_t *plugin, clap_hwnd window);
diff --git a/include/clap/ext/gui-x11.h b/include/clap/ext/gui-x11.h
@@ -10,6 +10,7 @@ extern "C" {
#pragma pack(push, CLAP_ALIGN)
+// size will be in physical pixels
typedef struct clap_plugin_gui_x11 {
// Use the protocol XEmbed
// https://specifications.freedesktop.org/xembed-spec/xembed-spec-latest.html
diff --git a/include/clap/ext/gui.h b/include/clap/ext/gui.h
@@ -37,6 +37,8 @@ extern "C" {
#pragma pack(push, CLAP_ALIGN)
+// Size (width, height) is in pixels; the corresponding windowing system extension is
+// responsible to define if it is physical pixels or logical pixels.
typedef struct clap_plugin_gui {
// Create and allocate all resources necessary for the gui.
// After this call, the GUI is ready to be shown but it is not yet visible.
@@ -55,7 +57,7 @@ typedef struct clap_plugin_gui {
// [main-thread,optional]
bool (*set_scale)(const clap_plugin_t *plugin, double scale);
- // Get the current size of the plugin UI, in physical pixels.
+ // Get the current size of the plugin UI.
// clap_plugin_gui->create() must have been called prior to asking the size.
// [main-thread]
bool (*get_size)(const clap_plugin_t *plugin, uint32_t *width, uint32_t *height);