summaryrefslogtreecommitdiff
path: root/macosx/plugins/DFXVideo/macsrc
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-08-17 20:06:59 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-08-17 20:06:59 +0000
commit37ba81a540460a7d34a33c23d2353ac84f887576 (patch)
tree64490fe788c3efbc894bc4e418e098e8696a8040 /macosx/plugins/DFXVideo/macsrc
parent30195666f40ca64b0bdf34ed783215d27f000cd7 (diff)
downloadpcsxr-37ba81a540460a7d34a33c23d2353ac84f887576.tar.gz
Make more plug-ins use and implement RunOnMainThreadSync.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@86706 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/plugins/DFXVideo/macsrc')
-rwxr-xr-xmacosx/plugins/DFXVideo/macsrc/PluginGLView.h9
-rwxr-xr-xmacosx/plugins/DFXVideo/macsrc/PluginGLView.m2
-rwxr-xr-xmacosx/plugins/DFXVideo/macsrc/drawgl.m2
3 files changed, 11 insertions, 2 deletions
diff --git a/macosx/plugins/DFXVideo/macsrc/PluginGLView.h b/macosx/plugins/DFXVideo/macsrc/PluginGLView.h
index fe2e5f78..77fe06c9 100755
--- a/macosx/plugins/DFXVideo/macsrc/PluginGLView.h
+++ b/macosx/plugins/DFXVideo/macsrc/PluginGLView.h
@@ -24,6 +24,15 @@
#define IMAGE_COUNT 2
+static inline void RunOnMainThreadSync(dispatch_block_t block)
+{
+ if ([NSThread isMainThread]) {
+ block();
+ } else {
+ dispatch_sync(dispatch_get_main_queue(), block);
+ }
+}
+
@interface PluginGLView : NSOpenGLView
{
GLubyte *image_base;
diff --git a/macosx/plugins/DFXVideo/macsrc/PluginGLView.m b/macosx/plugins/DFXVideo/macsrc/PluginGLView.m
index 39cfb5ad..778721fb 100755
--- a/macosx/plugins/DFXVideo/macsrc/PluginGLView.m
+++ b/macosx/plugins/DFXVideo/macsrc/PluginGLView.m
@@ -606,7 +606,7 @@ void BlitScreen16NS(unsigned char * surf,long x,long y)
//printf("y=%i",PSXDisplay.DisplayPosition.y);
- dispatch_sync(dispatch_get_main_queue(), ^{
+ RunOnMainThreadSync(^{
unsigned char * surf;
long x = PSXDisplay.DisplayPosition.x;
long y = PSXDisplay.DisplayPosition.y;
diff --git a/macosx/plugins/DFXVideo/macsrc/drawgl.m b/macosx/plugins/DFXVideo/macsrc/drawgl.m
index fd127469..efccb132 100755
--- a/macosx/plugins/DFXVideo/macsrc/drawgl.m
+++ b/macosx/plugins/DFXVideo/macsrc/drawgl.m
@@ -114,7 +114,7 @@ unsigned long ulInitDisplay(void) // OPEN GAME WINDOW
BuildDispMenu(0);
}
__block NSWindow *window = nil;
- dispatch_sync(dispatch_get_main_queue(), ^{
+ RunOnMainThreadSync(^{
PluginWindowController *windowController = [PluginWindowController openGameView];
glView = [windowController openGLView];