Browse Source

Small updates to OpenGLContext.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
7436e26887
15 changed files with 114 additions and 81 deletions
  1. +1
    -1
      extras/Jucer (experimental)/Source/Project/jucer_NewProjectWizard.cpp
  2. +1
    -1
      extras/Jucer (experimental)/Source/Project/jucer_Project.cpp
  3. +2
    -2
      extras/Jucer (experimental)/Source/Project/jucer_Project.h
  4. +2
    -2
      extras/Jucer (experimental)/Source/Project/jucer_ProjectSaver.h
  5. +45
    -29
      juce_amalgamated.cpp
  6. +12
    -9
      juce_amalgamated.h
  7. +2
    -2
      src/gui/components/layout/juce_ComponentMovementWatcher.cpp
  8. +2
    -2
      src/gui/components/layout/juce_ComponentMovementWatcher.h
  9. +8
    -4
      src/gui/components/special/juce_OpenGLComponent.h
  10. +8
    -10
      src/io/files/juce_ZipFile.cpp
  11. +2
    -3
      src/io/files/juce_ZipFile.h
  12. +9
    -3
      src/native/linux/juce_linux_Windowing.cpp
  13. +6
    -1
      src/native/mac/juce_mac_OpenGLComponent.mm
  14. +7
    -4
      src/native/windows/juce_win32_OpenGLComponent.cpp
  15. +7
    -8
      src/native/windows/juce_win32_Windowing.cpp

+ 1
- 1
extras/Jucer (experimental)/Source/Project/jucer_NewProjectWizard.cpp View File

@@ -239,7 +239,7 @@ public:
project.getProjectType() = Project::audioPlugin; project.getProjectType() = Project::audioPlugin;
project.getObjectiveCClassSuffix() = project.getProjectUID(); project.getObjectiveCClassSuffix() = project.getProjectUID();
Project::Item group (project.createNewGroup()); Project::Item group (project.createNewGroup());
project.getMainGroup().addChild (group, 0); project.getMainGroup().addChild (group, 0);
group.getName() = "Source"; group.getName() = "Source";


+ 1
- 1
extras/Jucer (experimental)/Source/Project/jucer_Project.cpp View File

@@ -349,7 +349,7 @@ void Project::createPropertyEditors (Array <PropertyComponent*>& props)
props.add (new TextPropertyComponent (getObjectiveCClassSuffix(), "Objective-C Name Suffix", 256, false)); props.add (new TextPropertyComponent (getObjectiveCClassSuffix(), "Objective-C Name Suffix", 256, false));
props.getLast()->setTooltip ("An optional string which will be appended to objective-C class names. If you're building a plugin, it's important to define this, to avoid name clashes between multiple plugin modules that are dynamically loaded into the same address space."); props.getLast()->setTooltip ("An optional string which will be appended to objective-C class names. If you're building a plugin, it's important to define this, to avoid name clashes between multiple plugin modules that are dynamically loaded into the same address space.");
if (isAudioPlugin()) if (isAudioPlugin())
{ {
props.add (new BooleanPropertyComponent (shouldBuildVST(), "Build VST", "Enabled")); props.add (new BooleanPropertyComponent (shouldBuildVST(), "Build VST", "Enabled"));


+ 2
- 2
extras/Jucer (experimental)/Source/Project/jucer_Project.h View File

@@ -108,12 +108,12 @@ public:
const Image getSmallIcon(); const Image getSmallIcon();
Value getObjectiveCClassSuffix() const { return getProjectValue ("objCSuffix"); } Value getObjectiveCClassSuffix() const { return getProjectValue ("objCSuffix"); }
Value shouldBuildVST() const { return getProjectValue ("buildVST"); } Value shouldBuildVST() const { return getProjectValue ("buildVST"); }
Value shouldBuildRTAS() const { return getProjectValue ("buildRTAS"); } Value shouldBuildRTAS() const { return getProjectValue ("buildRTAS"); }
Value shouldBuildAU() const { return getProjectValue ("buildAU"); } Value shouldBuildAU() const { return getProjectValue ("buildAU"); }
bool shouldAddVSTFolderToPath() { return (isAudioPlugin() && (bool) shouldBuildVST().getValue()) || getJuceConfigFlag ("JUCE_PLUGINHOST_VST").toString() == configFlagEnabled; } bool shouldAddVSTFolderToPath() { return (isAudioPlugin() && (bool) shouldBuildVST().getValue()) || getJuceConfigFlag ("JUCE_PLUGINHOST_VST").toString() == configFlagEnabled; }
Value getPluginName() const { return getProjectValue ("pluginName"); } Value getPluginName() const { return getProjectValue ("pluginName"); }
Value getPluginDesc() const { return getProjectValue ("pluginDesc"); } Value getPluginDesc() const { return getProjectValue ("pluginDesc"); }
Value getPluginManufacturer() const { return getProjectValue ("pluginManufacturer"); } Value getPluginManufacturer() const { return getProjectValue ("pluginManufacturer"); }


+ 2
- 2
extras/Jucer (experimental)/Source/Project/jucer_ProjectSaver.h View File

@@ -363,10 +363,10 @@ private:
<< "#define JucePlugin_RTASCategory " << ((bool) project.getPluginIsSynth().getValue() ? "ePlugInCategory_SWGenerators" : "ePlugInCategory_None") << newLine << "#define JucePlugin_RTASCategory " << ((bool) project.getPluginIsSynth().getValue() ? "ePlugInCategory_SWGenerators" : "ePlugInCategory_None") << newLine
<< "#define JucePlugin_RTASManufacturerCode JucePlugin_ManufacturerCode" << newLine << "#define JucePlugin_RTASManufacturerCode JucePlugin_ManufacturerCode" << newLine
<< "#define JucePlugin_RTASProductId JucePlugin_PluginCode" << newLine; << "#define JucePlugin_RTASProductId JucePlugin_PluginCode" << newLine;
if (project.getObjectiveCClassSuffix().toString().isNotEmpty()) if (project.getObjectiveCClassSuffix().toString().isNotEmpty())
out << "#define JUCE_ObjCExtraSuffix " << project.getObjectiveCClassSuffix().toString() << newLine; out << "#define JUCE_ObjCExtraSuffix " << project.getObjectiveCClassSuffix().toString() << newLine;
out << "#define JUCE_USE_VSTSDK_2_4 1" << newLine out << "#define JUCE_USE_VSTSDK_2_4 1" << newLine
<< newLine << newLine
<< "#endif // " << headerGuard << newLine; << "#endif // " << headerGuard << newLine;


+ 45
- 29
juce_amalgamated.cpp View File

@@ -9180,7 +9180,7 @@ public:
} }
} }


~ZipInputStream() throw()
~ZipInputStream()
{ {
#if JUCE_DEBUG #if JUCE_DEBUG
if (inputStream != 0 && inputStream == file.inputStream) if (inputStream != 0 && inputStream == file.inputStream)
@@ -9191,12 +9191,12 @@ public:
delete inputStream; delete inputStream;
} }


int64 getTotalLength() throw()
int64 getTotalLength()
{ {
return zipEntryInfo.compressedSize; return zipEntryInfo.compressedSize;
} }


int read (void* buffer, int howMany) throw()
int read (void* buffer, int howMany)
{ {
if (headerSize <= 0) if (headerSize <= 0)
return 0; return 0;
@@ -9224,17 +9224,17 @@ public:
return num; return num;
} }


bool isExhausted() throw()
bool isExhausted()
{ {
return headerSize <= 0 || pos >= zipEntryInfo.compressedSize; return headerSize <= 0 || pos >= zipEntryInfo.compressedSize;
} }


int64 getPosition() throw()
int64 getPosition()
{ {
return pos; return pos;
} }


bool setPosition (int64 newPos) throw()
bool setPosition (int64 newPos)
{ {
pos = jlimit ((int64) 0, (int64) zipEntryInfo.compressedSize, newPos); pos = jlimit ((int64) 0, (int64) zipEntryInfo.compressedSize, newPos);
return true; return true;
@@ -9252,8 +9252,7 @@ private:
ZipInputStream& operator= (const ZipInputStream&); ZipInputStream& operator= (const ZipInputStream&);
}; };


ZipFile::ZipFile (InputStream* const source_,
const bool deleteStreamWhenDestroyed) throw()
ZipFile::ZipFile (InputStream* const source_, const bool deleteStreamWhenDestroyed)
: inputStream (source_) : inputStream (source_)
#if JUCE_DEBUG #if JUCE_DEBUG
, numOpenStreams (0) , numOpenStreams (0)
@@ -9285,7 +9284,7 @@ ZipFile::ZipFile (InputSource* const inputSource_)
init(); init();
} }


ZipFile::~ZipFile() throw()
ZipFile::~ZipFile()
{ {
#if JUCE_DEBUG #if JUCE_DEBUG
entries.clear(); entries.clear();
@@ -9307,7 +9306,6 @@ int ZipFile::getNumEntries() const throw()
const ZipFile::ZipEntry* ZipFile::getEntry (const int index) const throw() const ZipFile::ZipEntry* ZipFile::getEntry (const int index) const throw()
{ {
ZipEntryInfo* const zei = entries [index]; ZipEntryInfo* const zei = entries [index];

return zei != 0 ? &(zei->entry) : 0; return zei != 0 ? &(zei->entry) : 0;
} }


@@ -60986,7 +60984,7 @@ void ComponentMovementWatcher::componentMovedOrResized (Component&, bool wasMove
componentMovedOrResized (wasMoved, wasResized); componentMovedOrResized (wasMoved, wasResized);
} }


void ComponentMovementWatcher::registerWithParentComps() throw()
void ComponentMovementWatcher::registerWithParentComps()
{ {
Component* p = component->getParentComponent(); Component* p = component->getParentComponent();


@@ -60998,7 +60996,7 @@ void ComponentMovementWatcher::registerWithParentComps() throw()
} }
} }


void ComponentMovementWatcher::unregister() throw()
void ComponentMovementWatcher::unregister()
{ {
for (int i = registeredParentComps.size(); --i >= 0;) for (int i = registeredParentComps.size(); --i >= 0;)
registeredParentComps.getUnchecked(i)->removeComponentListener (this); registeredParentComps.getUnchecked(i)->removeComponentListener (this);
@@ -239277,7 +239275,7 @@ static HPALETTE palette = 0;
static bool createPaletteIfNeeded = true; static bool createPaletteIfNeeded = true;
static bool shouldDeactivateTitleBar = true; static bool shouldDeactivateTitleBar = true;


static HICON createHICONFromImage (const Image& image, const BOOL isIcon, int hotspotX, int hotspotY) throw();
static HICON createHICONFromImage (const Image& image, const BOOL isIcon, int hotspotX, int hotspotY);
#define WM_TRAYNOTIFY WM_USER + 100 #define WM_TRAYNOTIFY WM_USER + 100


using ::abs; using ::abs;
@@ -241511,7 +241509,7 @@ void juce_updateMultiMonitorInfo (Array <Rectangle<int> >& monitorCoords, const
} }
} }


static const Image createImageFromHBITMAP (HBITMAP bitmap) throw()
static const Image createImageFromHBITMAP (HBITMAP bitmap)
{ {
Image im; Image im;


@@ -241550,7 +241548,7 @@ static const Image createImageFromHBITMAP (HBITMAP bitmap) throw()
return im; return im;
} }


static const Image createImageFromHICON (HICON icon) throw()
static const Image createImageFromHICON (HICON icon)
{ {
ICONINFO info; ICONINFO info;


@@ -241579,7 +241577,7 @@ static const Image createImageFromHICON (HICON icon) throw()
return Image(); return Image();
} }


static HICON createHICONFromImage (const Image& image, const BOOL isIcon, int hotspotX, int hotspotY) throw()
static HICON createHICONFromImage (const Image& image, const BOOL isIcon, int hotspotX, int hotspotY)
{ {
WindowsBitmapImage* nativeBitmap = new WindowsBitmapImage (Image::ARGB, image.getWidth(), image.getHeight(), true); WindowsBitmapImage* nativeBitmap = new WindowsBitmapImage (Image::ARGB, image.getWidth(), image.getHeight(), true);
Image bitmap (nativeBitmap); Image bitmap (nativeBitmap);
@@ -241910,15 +241908,14 @@ private:
JuceDataObject& operator= (const JuceDataObject&); JuceDataObject& operator= (const JuceDataObject&);
}; };


static HDROP createHDrop (const StringArray& fileNames) throw()
static HDROP createHDrop (const StringArray& fileNames)
{ {
int totalChars = 0; int totalChars = 0;
for (int i = fileNames.size(); --i >= 0;) for (int i = fileNames.size(); --i >= 0;)
totalChars += fileNames[i].length() + 1; totalChars += fileNames[i].length() + 1;


HDROP hDrop = (HDROP) GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT, HDROP hDrop = (HDROP) GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT,
sizeof (DROPFILES)
+ sizeof (WCHAR) * (totalChars + 2));
sizeof (DROPFILES) + sizeof (WCHAR) * (totalChars + 2));


if (hDrop != 0) if (hDrop != 0)
{ {
@@ -241943,7 +241940,7 @@ static HDROP createHDrop (const StringArray& fileNames) throw()
return hDrop; return hDrop;
} }


static bool performDragDrop (FORMATETC* const format, STGMEDIUM* const medium, const DWORD whatToDo) throw()
static bool performDragDrop (FORMATETC* const format, STGMEDIUM* const medium, const DWORD whatToDo)
{ {
JuceDropSource* const source = new JuceDropSource(); JuceDropSource* const source = new JuceDropSource();
JuceDataObject* const data = new JuceDataObject (source, format, medium); JuceDataObject* const data = new JuceDataObject (source, format, medium);
@@ -244010,14 +244007,17 @@ public:


~WindowedGLContext() ~WindowedGLContext()
{ {
makeInactive();

wglDeleteContext (renderContext);

deleteContext();
ReleaseDC ((HWND) nativeWindow->getNativeHandle(), dc); ReleaseDC ((HWND) nativeWindow->getNativeHandle(), dc);
delete nativeWindow; delete nativeWindow;
} }


void deleteContext()
{
makeInactive();
wglDeleteContext (renderContext);
}

bool makeActive() const throw() bool makeActive() const throw()
{ {
jassert (renderContext != 0); jassert (renderContext != 0);
@@ -259132,15 +259132,21 @@ public:


~WindowedGLContext() ~WindowedGLContext()
{ {
makeInactive();

ScopedXLock xlock; ScopedXLock xlock;
glXDestroyContext (display, renderContext);
deleteContext();


XUnmapWindow (display, embeddedWindow); XUnmapWindow (display, embeddedWindow);
XDestroyWindow (display, embeddedWindow); XDestroyWindow (display, embeddedWindow);
} }


void deleteContext()
{
makeInactive();

ScopedXLock xlock;
glXDestroyContext (display, renderContext);
}

bool makeActive() const throw() bool makeActive() const throw()
{ {
jassert (renderContext != 0); jassert (renderContext != 0);
@@ -266813,10 +266819,15 @@ public:
} }


~WindowedGLContext() ~WindowedGLContext()
{
deleteContext();
viewHolder = 0;
}

void deleteContext()
{ {
makeInactive(); makeInactive();
[renderContext clearDrawable]; [renderContext clearDrawable];
viewHolder = 0;
} }


bool makeActive() const throw() bool makeActive() const throw()
@@ -272397,10 +272408,15 @@ public:
} }


~WindowedGLContext() ~WindowedGLContext()
{
deleteContext();
viewHolder = 0;
}

void deleteContext()
{ {
makeInactive(); makeInactive();
[renderContext clearDrawable]; [renderContext clearDrawable];
viewHolder = 0;
} }


bool makeActive() const throw() bool makeActive() const throw()


+ 12
- 9
juce_amalgamated.h View File

@@ -15750,8 +15750,7 @@ public:
@param deleteStreamWhenDestroyed if set to true, the object passed-in @param deleteStreamWhenDestroyed if set to true, the object passed-in
will be deleted when this ZipFile object is deleted will be deleted when this ZipFile object is deleted
*/ */
ZipFile (InputStream* inputStream,
bool deleteStreamWhenDestroyed) throw();
ZipFile (InputStream* inputStream, bool deleteStreamWhenDestroyed);


/** Creates a ZipFile based for a file. */ /** Creates a ZipFile based for a file. */
ZipFile (const File& file); ZipFile (const File& file);
@@ -15764,7 +15763,7 @@ public:
ZipFile (InputSource* inputSource); ZipFile (InputSource* inputSource);


/** Destructor. */ /** Destructor. */
~ZipFile() throw();
~ZipFile();


/** /**
Contains information about one of the entries in a ZipFile. Contains information about one of the entries in a ZipFile.
@@ -51455,8 +51454,8 @@ private:
bool reentrant; bool reentrant;
Rectangle<int> lastBounds; Rectangle<int> lastBounds;


void unregister() throw();
void registerWithParentComps() throw();
void unregister();
void registerWithParentComps();


ComponentMovementWatcher (const ComponentMovementWatcher&); ComponentMovementWatcher (const ComponentMovementWatcher&);
ComponentMovementWatcher& operator= (const ComponentMovementWatcher&); ComponentMovementWatcher& operator= (const ComponentMovementWatcher&);
@@ -56878,6 +56877,12 @@ public:
*/ */
virtual void* getRawContext() const throw() = 0; virtual void* getRawContext() const throw() = 0;


/** Deletes the context.
This doesn't touch other resources, such as window handles, etc.
You'll probably never have to call this method directly.
*/
virtual void deleteContext() = 0;

/** Returns the context that's currently in active use by the calling thread. /** Returns the context that's currently in active use by the calling thread.


Returns 0 if there isn't an active context. Returns 0 if there isn't an active context.
@@ -57050,10 +57055,8 @@ public:
*/ */
void* getNativeWindowHandle() const; void* getNativeWindowHandle() const;


/** Call this to manually delete the current GL context, if there is one.
This can be useful to cause a clear-out of the context, which will be automatically
re-created when it's needed.
*/
/** Delete the context.
This can be called back on the same thread that created the context. */
void deleteContext(); void deleteContext();


juce_UseDebuggingNewOperator juce_UseDebuggingNewOperator


+ 2
- 2
src/gui/components/layout/juce_ComponentMovementWatcher.cpp View File

@@ -101,7 +101,7 @@ void ComponentMovementWatcher::componentMovedOrResized (Component&, bool wasMove
componentMovedOrResized (wasMoved, wasResized); componentMovedOrResized (wasMoved, wasResized);
} }
void ComponentMovementWatcher::registerWithParentComps() throw()
void ComponentMovementWatcher::registerWithParentComps()
{ {
Component* p = component->getParentComponent(); Component* p = component->getParentComponent();
@@ -113,7 +113,7 @@ void ComponentMovementWatcher::registerWithParentComps() throw()
} }
} }
void ComponentMovementWatcher::unregister() throw()
void ComponentMovementWatcher::unregister()
{ {
for (int i = registeredParentComps.size(); --i >= 0;) for (int i = registeredParentComps.size(); --i >= 0;)
registeredParentComps.getUnchecked(i)->removeComponentListener (this); registeredParentComps.getUnchecked(i)->removeComponentListener (this);


+ 2
- 2
src/gui/components/layout/juce_ComponentMovementWatcher.h View File

@@ -82,8 +82,8 @@ private:
bool reentrant; bool reentrant;
Rectangle<int> lastBounds; Rectangle<int> lastBounds;
void unregister() throw();
void registerWithParentComps() throw();
void unregister();
void registerWithParentComps();
ComponentMovementWatcher (const ComponentMovementWatcher&); ComponentMovementWatcher (const ComponentMovementWatcher&);
ComponentMovementWatcher& operator= (const ComponentMovementWatcher&); ComponentMovementWatcher& operator= (const ComponentMovementWatcher&);


+ 8
- 4
src/gui/components/special/juce_OpenGLComponent.h View File

@@ -146,6 +146,12 @@ public:
*/ */
virtual void* getRawContext() const throw() = 0; virtual void* getRawContext() const throw() = 0;
/** Deletes the context.
This doesn't touch other resources, such as window handles, etc.
You'll probably never have to call this method directly.
*/
virtual void deleteContext() = 0;
//============================================================================== //==============================================================================
/** Returns the context that's currently in active use by the calling thread. /** Returns the context that's currently in active use by the calling thread.
@@ -330,10 +336,8 @@ public:
*/ */
void* getNativeWindowHandle() const; void* getNativeWindowHandle() const;
/** Call this to manually delete the current GL context, if there is one.
This can be useful to cause a clear-out of the context, which will be automatically
re-created when it's needed.
*/
/** Delete the context.
This can be called back on the same thread that created the context. */
void deleteContext(); void deleteContext();
juce_UseDebuggingNewOperator juce_UseDebuggingNewOperator


+ 8
- 10
src/io/files/juce_ZipFile.cpp View File

@@ -83,7 +83,7 @@ public:
} }
} }
~ZipInputStream() throw()
~ZipInputStream()
{ {
#if JUCE_DEBUG #if JUCE_DEBUG
if (inputStream != 0 && inputStream == file.inputStream) if (inputStream != 0 && inputStream == file.inputStream)
@@ -94,12 +94,12 @@ public:
delete inputStream; delete inputStream;
} }
int64 getTotalLength() throw()
int64 getTotalLength()
{ {
return zipEntryInfo.compressedSize; return zipEntryInfo.compressedSize;
} }
int read (void* buffer, int howMany) throw()
int read (void* buffer, int howMany)
{ {
if (headerSize <= 0) if (headerSize <= 0)
return 0; return 0;
@@ -127,17 +127,17 @@ public:
return num; return num;
} }
bool isExhausted() throw()
bool isExhausted()
{ {
return headerSize <= 0 || pos >= zipEntryInfo.compressedSize; return headerSize <= 0 || pos >= zipEntryInfo.compressedSize;
} }
int64 getPosition() throw()
int64 getPosition()
{ {
return pos; return pos;
} }
bool setPosition (int64 newPos) throw()
bool setPosition (int64 newPos)
{ {
pos = jlimit ((int64) 0, (int64) zipEntryInfo.compressedSize, newPos); pos = jlimit ((int64) 0, (int64) zipEntryInfo.compressedSize, newPos);
return true; return true;
@@ -158,8 +158,7 @@ private:
//============================================================================== //==============================================================================
ZipFile::ZipFile (InputStream* const source_,
const bool deleteStreamWhenDestroyed) throw()
ZipFile::ZipFile (InputStream* const source_, const bool deleteStreamWhenDestroyed)
: inputStream (source_) : inputStream (source_)
#if JUCE_DEBUG #if JUCE_DEBUG
, numOpenStreams (0) , numOpenStreams (0)
@@ -191,7 +190,7 @@ ZipFile::ZipFile (InputSource* const inputSource_)
init(); init();
} }
ZipFile::~ZipFile() throw()
ZipFile::~ZipFile()
{ {
#if JUCE_DEBUG #if JUCE_DEBUG
entries.clear(); entries.clear();
@@ -214,7 +213,6 @@ int ZipFile::getNumEntries() const throw()
const ZipFile::ZipEntry* ZipFile::getEntry (const int index) const throw() const ZipFile::ZipEntry* ZipFile::getEntry (const int index) const throw()
{ {
ZipEntryInfo* const zei = entries [index]; ZipEntryInfo* const zei = entries [index];
return zei != 0 ? &(zei->entry) : 0; return zei != 0 ? &(zei->entry) : 0;
} }


+ 2
- 3
src/io/files/juce_ZipFile.h View File

@@ -50,8 +50,7 @@ public:
@param deleteStreamWhenDestroyed if set to true, the object passed-in @param deleteStreamWhenDestroyed if set to true, the object passed-in
will be deleted when this ZipFile object is deleted will be deleted when this ZipFile object is deleted
*/ */
ZipFile (InputStream* inputStream,
bool deleteStreamWhenDestroyed) throw();
ZipFile (InputStream* inputStream, bool deleteStreamWhenDestroyed);
/** Creates a ZipFile based for a file. */ /** Creates a ZipFile based for a file. */
ZipFile (const File& file); ZipFile (const File& file);
@@ -64,7 +63,7 @@ public:
ZipFile (InputSource* inputSource); ZipFile (InputSource* inputSource);
/** Destructor. */ /** Destructor. */
~ZipFile() throw();
~ZipFile();
//============================================================================== //==============================================================================
/** /**


+ 9
- 3
src/native/linux/juce_linux_Windowing.cpp View File

@@ -3233,15 +3233,21 @@ public:
~WindowedGLContext() ~WindowedGLContext()
{ {
makeInactive();
ScopedXLock xlock; ScopedXLock xlock;
glXDestroyContext (display, renderContext);
deleteContext();
XUnmapWindow (display, embeddedWindow); XUnmapWindow (display, embeddedWindow);
XDestroyWindow (display, embeddedWindow); XDestroyWindow (display, embeddedWindow);
} }
void deleteContext()
{
makeInactive();
ScopedXLock xlock;
glXDestroyContext (display, renderContext);
}
bool makeActive() const throw() bool makeActive() const throw()
{ {
jassert (renderContext != 0); jassert (renderContext != 0);


+ 6
- 1
src/native/mac/juce_mac_OpenGLComponent.mm View File

@@ -175,10 +175,15 @@ public:
} }
~WindowedGLContext() ~WindowedGLContext()
{
deleteContext();
viewHolder = 0;
}
void deleteContext()
{ {
makeInactive(); makeInactive();
[renderContext clearDrawable]; [renderContext clearDrawable];
viewHolder = 0;
} }
bool makeActive() const throw() bool makeActive() const throw()


+ 7
- 4
src/native/windows/juce_win32_OpenGLComponent.cpp View File

@@ -115,14 +115,17 @@ public:
~WindowedGLContext() ~WindowedGLContext()
{ {
makeInactive();
wglDeleteContext (renderContext);
deleteContext();
ReleaseDC ((HWND) nativeWindow->getNativeHandle(), dc); ReleaseDC ((HWND) nativeWindow->getNativeHandle(), dc);
delete nativeWindow; delete nativeWindow;
} }
void deleteContext()
{
makeInactive();
wglDeleteContext (renderContext);
}
bool makeActive() const throw() bool makeActive() const throw()
{ {
jassert (renderContext != 0); jassert (renderContext != 0);


+ 7
- 8
src/native/windows/juce_win32_Windowing.cpp View File

@@ -58,7 +58,7 @@ static HPALETTE palette = 0;
static bool createPaletteIfNeeded = true; static bool createPaletteIfNeeded = true;
static bool shouldDeactivateTitleBar = true; static bool shouldDeactivateTitleBar = true;
static HICON createHICONFromImage (const Image& image, const BOOL isIcon, int hotspotX, int hotspotY) throw();
static HICON createHICONFromImage (const Image& image, const BOOL isIcon, int hotspotX, int hotspotY);
#define WM_TRAYNOTIFY WM_USER + 100 #define WM_TRAYNOTIFY WM_USER + 100
using ::abs; using ::abs;
@@ -2338,7 +2338,7 @@ void juce_updateMultiMonitorInfo (Array <Rectangle<int> >& monitorCoords, const
} }
//============================================================================== //==============================================================================
static const Image createImageFromHBITMAP (HBITMAP bitmap) throw()
static const Image createImageFromHBITMAP (HBITMAP bitmap)
{ {
Image im; Image im;
@@ -2377,7 +2377,7 @@ static const Image createImageFromHBITMAP (HBITMAP bitmap) throw()
return im; return im;
} }
static const Image createImageFromHICON (HICON icon) throw()
static const Image createImageFromHICON (HICON icon)
{ {
ICONINFO info; ICONINFO info;
@@ -2406,7 +2406,7 @@ static const Image createImageFromHICON (HICON icon) throw()
return Image(); return Image();
} }
static HICON createHICONFromImage (const Image& image, const BOOL isIcon, int hotspotX, int hotspotY) throw()
static HICON createHICONFromImage (const Image& image, const BOOL isIcon, int hotspotX, int hotspotY)
{ {
WindowsBitmapImage* nativeBitmap = new WindowsBitmapImage (Image::ARGB, image.getWidth(), image.getHeight(), true); WindowsBitmapImage* nativeBitmap = new WindowsBitmapImage (Image::ARGB, image.getWidth(), image.getHeight(), true);
Image bitmap (nativeBitmap); Image bitmap (nativeBitmap);
@@ -2742,15 +2742,14 @@ private:
JuceDataObject& operator= (const JuceDataObject&); JuceDataObject& operator= (const JuceDataObject&);
}; };
static HDROP createHDrop (const StringArray& fileNames) throw()
static HDROP createHDrop (const StringArray& fileNames)
{ {
int totalChars = 0; int totalChars = 0;
for (int i = fileNames.size(); --i >= 0;) for (int i = fileNames.size(); --i >= 0;)
totalChars += fileNames[i].length() + 1; totalChars += fileNames[i].length() + 1;
HDROP hDrop = (HDROP) GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT, HDROP hDrop = (HDROP) GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT,
sizeof (DROPFILES)
+ sizeof (WCHAR) * (totalChars + 2));
sizeof (DROPFILES) + sizeof (WCHAR) * (totalChars + 2));
if (hDrop != 0) if (hDrop != 0)
{ {
@@ -2775,7 +2774,7 @@ static HDROP createHDrop (const StringArray& fileNames) throw()
return hDrop; return hDrop;
} }
static bool performDragDrop (FORMATETC* const format, STGMEDIUM* const medium, const DWORD whatToDo) throw()
static bool performDragDrop (FORMATETC* const format, STGMEDIUM* const medium, const DWORD whatToDo)
{ {
JuceDropSource* const source = new JuceDropSource(); JuceDropSource* const source = new JuceDropSource();
JuceDataObject* const data = new JuceDataObject (source, format, medium); JuceDataObject* const data = new JuceDataObject (source, format, medium);


Loading…
Cancel
Save