Skip to content

Commit

Permalink
Update X11 constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyschoen committed Nov 10, 2023
1 parent e3b6e3b commit ac28be8
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Source/PluginEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ PluginEditor::PluginEditor(PluginProcessor& p)
// NEVER touch pluginConstrainer outside of plugin mode!
pluginConstrainer.setMinimumSize(850, 650);
setUseBorderResizer(true);
#if JUCE_LINUX
OSUtils::updateX11Constraints(getPeer()->getWindowHandle());
#endif
}
else {
constrainer.setMinimumSize(850, 650);
Expand Down
7 changes: 7 additions & 0 deletions Source/PluginMode.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ class PluginMode : public Component {
editor->pluginConstrainer.setSizeLimits(newWidth, newHeight, newWidth, newHeight);
}

#if JUCE_LINUX
OSUtils::updateX11Constraints(getPeer()->getWindowHandle());
#endif
editor->setSize(newWidth, newHeight);
setBounds(0, 0, newWidth, newHeight);
}
Expand All @@ -161,6 +164,10 @@ class PluginMode : public Component {
editor->pluginConstrainer.setSizeLimits(850, 650, 99000, 99000);
editor->setBounds(windowBounds);
}

#if JUCE_LINUX
OSUtils::updateX11Constraints(getPeer()->getWindowHandle());
#endif

if (auto* tabbar = editor->getActiveTabbar()) {
tabbar->resized();
Expand Down
2 changes: 1 addition & 1 deletion Source/Statusbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ class CPUMeter : public Component
void cpuUsageChanged(float newCpuUsage) override
{
CriticalSection::ScopedLockType lock(cpuMeterMutex);
cpuUsage.add(newCpuUsage);
cpuUsage.add(newCpuUsage); // FIXME: we should use a circular buffer instead
cpuUsage.remove(0);
updateCPUGraph();
}
Expand Down
6 changes: 6 additions & 0 deletions Source/Utility/OSUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ OSUtils::KeyboardLayout OSUtils::getKeyboardLayout()
// Selects Linux and BSD
#if defined(__unix__) && !defined(__APPLE__)


bool OSUtils::updateX11Constraints(void* handle)
{
XWindowSystem::getInstance()->updateConstraints(handle);
}

bool OSUtils::isX11WindowMaximised(void* handle)
{
enum window_state_t {
Expand Down
1 change: 1 addition & 0 deletions Source/Utility/OSUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ struct OSUtils {
#elif defined(__unix__) && !defined(__APPLE__)
static void maximiseX11Window(void* handle, bool shouldBeMaximised);
static bool isX11WindowMaximised(void* handle);
static void updateX11Constraints(void* handle)
#elif JUCE_MAC
static void enableInsetTitlebarButtons(void* nativeHandle, bool enabled);
static void HideTitlebarButtons(void* view, bool hideMinimiseButton, bool hideMaximiseButton, bool hideCloseButton);
Expand Down

0 comments on commit ac28be8

Please sign in to comment.