diff options
Diffstat (limited to 'src/nativewindow/native')
-rw-r--r-- | src/nativewindow/native/macosx/OSXmisc.m | 28 | ||||
-rw-r--r-- | src/nativewindow/native/x11/Xmisc.c | 6 | ||||
-rw-r--r-- | src/nativewindow/native/x11/Xmisc.h | 26 |
3 files changed, 57 insertions, 3 deletions
diff --git a/src/nativewindow/native/macosx/OSXmisc.m b/src/nativewindow/native/macosx/OSXmisc.m index 2cc272a41..87494e946 100644 --- a/src/nativewindow/native/macosx/OSXmisc.m +++ b/src/nativewindow/native/macosx/OSXmisc.m @@ -156,6 +156,18 @@ static NSScreen * OSXUtil_getNSScreenByCGDirectDisplayID(CGDirectDisplayID displ } return (NSScreen *) [screens objectAtIndex: 0]; } +static int OSXUtil_getNSScreenIdxByCGDirectDisplayID(CGDirectDisplayID displayID) { + NSArray *screens = [NSScreen screens]; + int i; + for(i=[screens count]-1; i>=0; i--) { + NSScreen * screen = (NSScreen *) [screens objectAtIndex: i]; + CGDirectDisplayID dID = OSXUtil_getCGDirectDisplayIDByNSScreen(screen); + if( dID == displayID ) { + return i; + } + } + return -1; +} /* * Class: Java_jogamp_nativewindow_macosx_OSXUtil @@ -263,6 +275,22 @@ JNIEXPORT jobject JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_GetInsets0 /* * Class: Java_jogamp_nativewindow_macosx_OSXUtil + * Method: GetNSScreenIdx0 + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_GetNSScreenIdx0 + (JNIEnv *env, jclass unused, jint displayID) +{ + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + + int idx = OSXUtil_getNSScreenIdxByCGDirectDisplayID((CGDirectDisplayID)displayID); + [pool release]; + + return idx; +} + +/* + * Class: Java_jogamp_nativewindow_macosx_OSXUtil * Method: GetPixelScale0 * Signature: (I)D */ diff --git a/src/nativewindow/native/x11/Xmisc.c b/src/nativewindow/native/x11/Xmisc.c index a2e744cd8..efb4620ba 100644 --- a/src/nativewindow/native/x11/Xmisc.c +++ b/src/nativewindow/native/x11/Xmisc.c @@ -52,12 +52,12 @@ #include <dlfcn.h> #undef __USE_GNU +#include "Xmisc.h" + /* Current versions of Solaris don't expose the XF86 extensions, although with the recent transition to Xorg this will probably happen in an upcoming release */ -#if !defined(__sun_obsolete) && !defined(_HPUX) -#include <X11/extensions/xf86vmode.h> -#else +#if defined(__sun_obsolete) || defined(_HPUX) /* Need to provide stubs for these */ Bool XF86VidModeGetGammaRampSize( Display *display, diff --git a/src/nativewindow/native/x11/Xmisc.h b/src/nativewindow/native/x11/Xmisc.h index 91f2ac5d9..d8868f802 100644 --- a/src/nativewindow/native/x11/Xmisc.h +++ b/src/nativewindow/native/x11/Xmisc.h @@ -39,4 +39,30 @@ #include <X11/Xlib.h> #include <X11/Xutil.h> +#if !defined(__sun_obsolete) && !defined(_HPUX) +#include <X11/extensions/xf86vmode.h> +#else +Bool XF86VidModeGetGammaRampSize( + Display* /* dpy */, + int /* screen */, + int* /* size */ +); +Bool XF86VidModeGetGammaRamp( + Display* /* dpy */, + int /* screen */, + int /* size */, + unsigned short* /* red array */, + unsigned short* /* green array */, + unsigned short* /* blue array */ +); +Bool XF86VidModeSetGammaRamp( + Display* /* dpy */, + int /* screen */, + int /* size */, + unsigned short* /* red array */, + unsigned short* /* green array */, + unsigned short* /* blue array */ +); +#endif /* defined(__sun_obsolete) || defined(_HPUX) */ + #endif /* Xmisc_h */ |