1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Modal component fix. Minor tweaks.

This commit is contained in:
jules 2012-11-19 23:29:39 +00:00
parent 880fa4d673
commit f24f7b638c
5 changed files with 29 additions and 34 deletions

View file

@ -2254,11 +2254,10 @@ private:
#pragma warning (pop)
int w, h;
RECT r;
GetWindowRect (pluginHWND, &r);
w = r.right - r.left;
h = r.bottom - r.top;
int w = r.right - r.left;
int h = r.bottom - r.top;
if (rect != nullptr)
{

View file

@ -129,10 +129,9 @@ bool InterprocessConnection::isConnected() const
String InterprocessConnection::getConnectedHostName() const
{
if (pipe != nullptr)
{
return "localhost";
}
else if (socket != nullptr)
if (socket != nullptr)
{
if (! socket->isLocal())
return socket->getHostName();
@ -236,14 +235,13 @@ void InterprocessConnection::connectionLostInt()
struct DataDeliveryMessage : public Message
{
DataDeliveryMessage (InterprocessConnection* owner_, const MemoryBlock& data_)
: owner (owner_), data (data_)
DataDeliveryMessage (InterprocessConnection* ipc, const MemoryBlock& d)
: owner (ipc), data (d)
{}
void messageCallback()
{
InterprocessConnection* const ipc = owner;
if (ipc != nullptr)
if (InterprocessConnection* const ipc = owner)
ipc->messageReceived (data);
}

View file

@ -236,7 +236,7 @@ void ModalComponentManager::bringModalComponentsToFront (bool topOneShouldGrabFo
class ModalComponentManager::ReturnValueRetriever : public ModalComponentManager::Callback
{
public:
ReturnValueRetriever (int& value_, bool& finished_) : value (value_), finished (finished_) {}
ReturnValueRetriever (int& v, bool& done) : value (v), finished (done) {}
void modalStateFinished (int returnValue)
{
@ -256,29 +256,28 @@ int ModalComponentManager::runEventLoopForCurrentComponent()
// This can only be run from the message thread!
jassert (MessageManager::getInstance()->isThisTheMessageThread());
Component* currentlyModal = getModalComponent (0);
if (currentlyModal == nullptr)
return 0;
WeakReference<Component> prevFocused (Component::getCurrentlyFocusedComponent());
int returnValue = 0;
bool finished = false;
attachCallback (currentlyModal, new ReturnValueRetriever (returnValue, finished));
JUCE_TRY
if (Component* currentlyModal = getModalComponent (0))
{
while (! finished)
{
if (! MessageManager::getInstance()->runDispatchLoopUntil (20))
break;
}
}
JUCE_CATCH_EXCEPTION
WeakReference<Component> prevFocused (Component::getCurrentlyFocusedComponent());
if (prevFocused != nullptr)
prevFocused->grabKeyboardFocus();
bool finished = false;
attachCallback (currentlyModal, new ReturnValueRetriever (returnValue, finished));
JUCE_TRY
{
while (! finished)
{
if (! MessageManager::getInstance()->runDispatchLoopUntil (20))
break;
}
}
JUCE_CATCH_EXCEPTION
if (prevFocused != nullptr && ! prevFocused->isCurrentlyBlockedByAnotherModalComponent())
prevFocused->grabKeyboardFocus();
}
return returnValue;
}

View file

@ -1041,10 +1041,11 @@ struct StateHelpers
{
context.extensions.glBufferData (GL_ARRAY_BUFFER, numVertices * sizeof (VertexInfo), vertexData, GL_DYNAMIC_DRAW);
glDrawElements (GL_TRIANGLES, (numVertices * 3) / 2, GL_UNSIGNED_SHORT, 0);
JUCE_CHECK_OPENGL_ERROR
numVertices = 0;
}
ShaderQuadQueue& operator= (const ShaderQuadQueue&);
JUCE_DECLARE_NON_COPYABLE (ShaderQuadQueue);
};
//==============================================================================

View file

@ -261,9 +261,7 @@ OpenGLTextureFromImage::OpenGLTextureFromImage (const Image& image)
imageHeight (image.getHeight())
{
JUCE_CHECK_OPENGL_ERROR
OpenGLFrameBuffer* const fb = OpenGLImageType::getFrameBufferFrom (image);
if (fb != nullptr)
if (OpenGLFrameBuffer* const fb = OpenGLImageType::getFrameBufferFrom (image))
{
textureID = fb->getTextureID();
fullWidthProportion = 1.0f;