175 (JNIEnv *env, jobject self) |
175 (JNIEnv *env, jobject self) |
176 { |
176 { |
177 NSBeep(); // produces both sound and visual flash, if configured in System Preferences |
177 NSBeep(); // produces both sound and visual flash, if configured in System Preferences |
178 } |
178 } |
179 |
179 |
180 CGDirectDisplayID |
|
181 FindCGDirectDisplayIDForScreenIndex(jint screenIndex) |
|
182 { |
|
183 // most common case - just one monitor |
|
184 CGDirectDisplayID screenID = CGMainDisplayID(); |
|
185 |
|
186 CGDisplayCount displayCount = 0; |
|
187 CGGetOnlineDisplayList(0, NULL, &displayCount); |
|
188 |
|
189 if ((displayCount > 1) && |
|
190 (screenIndex >= 0) && |
|
191 (screenIndex < (jint)displayCount)) |
|
192 { |
|
193 if (displayCount < 10) { |
|
194 // stack allocated optimization for less than 10 monitors |
|
195 CGDirectDisplayID onlineDisplays[displayCount]; |
|
196 CGGetOnlineDisplayList(displayCount, onlineDisplays, &displayCount); |
|
197 screenID = (CGDirectDisplayID)onlineDisplays[screenIndex]; |
|
198 } else { |
|
199 CGDirectDisplayID *onlineDisplays = |
|
200 malloc(displayCount*sizeof(CGDirectDisplayID)); |
|
201 if (onlineDisplays != NULL) { |
|
202 CGGetOnlineDisplayList(displayCount, onlineDisplays, |
|
203 &displayCount); |
|
204 screenID = (CGDirectDisplayID)onlineDisplays[screenIndex]; |
|
205 free(onlineDisplays); |
|
206 } |
|
207 } |
|
208 } |
|
209 |
|
210 return screenID; |
|
211 } |
|
212 |
|
213 /* |
180 /* |
214 * Class: sun_lwawt_macosx_LWCToolkit |
181 * Class: sun_lwawt_macosx_LWCToolkit |
215 * Method: initIDs |
182 * Method: initIDs |
216 * Signature: ()V |
183 * Signature: ()V |
217 */ |
184 */ |