src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
branchihse-warnings-cflags-branch
changeset 56230 489867818774
parent 47216 71c04702a3d5
equal deleted inserted replaced
56229:0015bf3a82e0 56230:489867818774
   314 Java_java_awt_TextField_initIDs
   314 Java_java_awt_TextField_initIDs
   315   (JNIEnv *env, jclass cls)
   315   (JNIEnv *env, jclass cls)
   316 {
   316 {
   317 }
   317 }
   318 
   318 
   319 JNIEXPORT jboolean JNICALL AWTIsHeadless() {
   319 JNIEXPORT jboolean JNICALL AWTIsHeadless(void) {
   320 #ifdef HEADLESS
   320 #ifdef HEADLESS
   321     return JNI_TRUE;
   321     return JNI_TRUE;
   322 #else
   322 #else
   323     return JNI_FALSE;
   323     return JNI_FALSE;
   324 #endif
   324 #endif
   405 // for single client desktop configurations.  For SunRay servers, it
   405 // for single client desktop configurations.  For SunRay servers, it
   406 // is highly recomended to use aging algorithm (set static poll timeout
   406 // is highly recomended to use aging algorithm (set static poll timeout
   407 // to 0).
   407 // to 0).
   408 static int32_t static_poll_timeout = 0;
   408 static int32_t static_poll_timeout = 0;
   409 
   409 
   410 static Bool isMainThread() {
   410 static Bool isMainThread(void) {
   411     return awt_MainThread == pthread_self();
   411     return awt_MainThread == pthread_self();
   412 }
   412 }
   413 
   413 
   414 /*
   414 /*
   415  * Creates the AWT utility pipe. This pipe exists solely so that
   415  * Creates the AWT utility pipe. This pipe exists solely so that
   416  * we can cause the main event thread to wake up from a poll() or
   416  * we can cause the main event thread to wake up from a poll() or
   417  * select() by writing to this pipe.
   417  * select() by writing to this pipe.
   418  */
   418  */
   419 static void
   419 static void
   420 awt_pipe_init() {
   420 awt_pipe_init(void) {
   421 
   421 
   422     if (awt_pipe_inited) {
   422     if (awt_pipe_inited) {
   423         return;
   423         return;
   424     }
   424     }
   425 
   425 
   448 } /* awt_pipe_init() */
   448 } /* awt_pipe_init() */
   449 
   449 
   450 /**
   450 /**
   451  * Reads environment variables to initialize timeout fields.
   451  * Reads environment variables to initialize timeout fields.
   452  */
   452  */
   453 static void readEnv() {
   453 static void readEnv(void) {
   454     char * value;
   454     char * value;
   455     int tmp_poll_alg;
   455     int tmp_poll_alg;
   456     static Boolean env_read = False;
   456     static Boolean env_read = False;
   457     if (env_read) return;
   457     if (env_read) return;
   458 
   458 
   715 
   715 
   716 /**
   716 /**
   717  * Schedules next auto-flush event or performs forced flush depending
   717  * Schedules next auto-flush event or performs forced flush depending
   718  * on the time of the previous flush.
   718  * on the time of the previous flush.
   719  */
   719  */
   720 void awt_output_flush() {
   720 void awt_output_flush(void) {
   721     if (awt_next_flush_time == 0) {
   721     if (awt_next_flush_time == 0) {
   722         JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
   722         JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
   723 
   723 
   724         jlong curTime = awtJNI_TimeMillis(); // current time
   724         jlong curTime = awtJNI_TimeMillis(); // current time
   725         jlong l_awt_last_flush_time = awt_last_flush_time; // last time we flushed queue
   725         jlong l_awt_last_flush_time = awt_last_flush_time; // last time we flushed queue
   742 
   742 
   743 
   743 
   744 /**
   744 /**
   745  * Wakes-up poll() in performPoll
   745  * Wakes-up poll() in performPoll
   746  */
   746  */
   747 static void wakeUp() {
   747 static void wakeUp(void) {
   748     static char wakeUp_char = 'p';
   748     static char wakeUp_char = 'p';
   749     if (!isMainThread() && awt_pipe_inited) {
   749     if (!isMainThread() && awt_pipe_inited) {
   750         write ( AWT_WRITEPIPE, &wakeUp_char, 1 );
   750         write ( AWT_WRITEPIPE, &wakeUp_char, 1 );
   751     }
   751     }
   752 }
   752 }
   989         num_buttons = getNumButtons();
   989         num_buttons = getNumButtons();
   990     }
   990     }
   991     return num_buttons;
   991     return num_buttons;
   992 }
   992 }
   993 
   993 
   994 int32_t getNumButtons() {
   994 int32_t getNumButtons(void) {
   995     int32_t major_opcode, first_event, first_error;
   995     int32_t major_opcode, first_event, first_error;
   996     int32_t xinputAvailable;
   996     int32_t xinputAvailable;
   997     int32_t numDevices, devIdx, clsIdx;
   997     int32_t numDevices, devIdx, clsIdx;
   998     XDeviceInfo* devices;
   998     XDeviceInfo* devices;
   999     XDeviceInfo* aDevice;
   999     XDeviceInfo* aDevice;