Browse Source

Get size from LV2 X11 UI in case it does not report the host

tags/1.9.8
falkTX 6 years ago
parent
commit
6629dd821e
2 changed files with 15 additions and 4 deletions
  1. +4
    -4
      source/bridges-ui/CarlaBridgeUI.hpp
  2. +11
    -0
      source/utils/CarlaPluginUI.cpp

+ 4
- 4
source/bridges-ui/CarlaBridgeUI.hpp View File

@@ -1,6 +1,6 @@
/*
* Carla Bridge UI
* Copyright (C) 2011-2014 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2017 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -74,9 +74,9 @@ public:
// ---------------------------------------------------------------------
// UI initialization

virtual bool init(const int argc, const char* argv[]);
virtual void exec(const bool showUI);
virtual void idleUI() {}
virtual bool init(const int argc, const char* argv[]);
virtual void exec(const bool showUI);
virtual void idleUI() {}

// ---------------------------------------------------------------------
// UI management


+ 11
- 0
source/utils/CarlaPluginUI.cpp View File

@@ -59,6 +59,7 @@ public:
fWindow(0),
fIsVisible(false),
fFirstShow(true),
fSetSizeCalledAtLeastOnce(false),
fEventProc(nullptr)
{
fDisplay = XOpenDisplay(nullptr);
@@ -132,6 +133,14 @@ public:
{
if (const Window childWindow = getChildWindow())
{
if (! fSetSizeCalledAtLeastOnce)
{
XSizeHints hints;
carla_zeroStruct(hints);
if (XGetNormalHints(fDisplay, childWindow, &hints) && hints.width > 0 && hints.height > 0)
setSize(hints.width, hints.height, false);
}

const Atom _xevp = XInternAtom(fDisplay, "_XEventProc", False);

gErrorTriggered = false;
@@ -242,6 +251,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(fDisplay != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fWindow != 0,);

fSetSizeCalledAtLeastOnce = true;
XResizeWindow(fDisplay, fWindow, width, height);

if (! fIsResizable)
@@ -316,6 +326,7 @@ private:
Window fWindow;
bool fIsVisible;
bool fFirstShow;
bool fSetSizeCalledAtLeastOnce;
EventProcPtr fEventProc;

CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(X11PluginUI)


Loading…
Cancel
Save