< prev index next >

src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c

Print this page
rev 16167 : 8170525: Fix minor issues in AWT/ECC/PKCS11 coding
Reviewed-by: vinnie, clanger, prr, ssadetsky
   1 /*
   2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


1218     StatusWindow *statusWindow;
1219 
1220     AWT_LOCK();
1221 
1222     if (!isX11InputMethodGRefInList((jobject)client_data)) {
1223         if ((jobject)client_data == currentX11InputMethodInstance) {
1224             currentX11InputMethodInstance = NULL;
1225         }
1226         goto finally;
1227     }
1228 
1229     if (NULL == (pX11IMData = getX11InputMethodData(env, (jobject)client_data))
1230         || NULL == (statusWindow = pX11IMData->statusWindow)){
1231         goto finally;
1232     }
1233    currentX11InputMethodInstance = (jobject)client_data;
1234 
1235     if (status_draw->type == XIMTextType){
1236         XIMText *text = (status_draw->data).text;
1237         if (text != NULL){
1238           if (text->string.multi_byte != NULL){
1239               strcpy(statusWindow->status, text->string.multi_byte);

1240           }
1241           else{
1242               char *mbstr = wcstombsdmp(text->string.wide_char, text->length);
1243               strcpy(statusWindow->status, mbstr);

1244           }
1245           statusWindow->on = True;
1246           onoffStatusWindow(pX11IMData, statusWindow->parent, True);
1247           paintStatusWindow(statusWindow);
1248         }
1249         else {
1250             statusWindow->on = False;
1251             /*just turnoff the status window
1252             paintStatusWindow(statusWindow);
1253             */
1254             onoffStatusWindow(pX11IMData, 0, False);
1255         }
1256     }
1257 
1258  finally:
1259     AWT_UNLOCK();
1260 }
1261 #endif /* __linux__ || MACOSX */
1262 
1263 static void CommitStringCallback(XIC ic, XPointer client_data, XPointer call_data) {


   1 /*
   2  * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


1218     StatusWindow *statusWindow;
1219 
1220     AWT_LOCK();
1221 
1222     if (!isX11InputMethodGRefInList((jobject)client_data)) {
1223         if ((jobject)client_data == currentX11InputMethodInstance) {
1224             currentX11InputMethodInstance = NULL;
1225         }
1226         goto finally;
1227     }
1228 
1229     if (NULL == (pX11IMData = getX11InputMethodData(env, (jobject)client_data))
1230         || NULL == (statusWindow = pX11IMData->statusWindow)){
1231         goto finally;
1232     }
1233    currentX11InputMethodInstance = (jobject)client_data;
1234 
1235     if (status_draw->type == XIMTextType){
1236         XIMText *text = (status_draw->data).text;
1237         if (text != NULL){
1238           if (text->string.multi_byte != NULL) {
1239               strncpy(statusWindow->status, text->string.multi_byte, MAX_STATUS_LEN);
1240               statusWindow->status[MAX_STATUS_LEN - 1] = '\0';
1241           }
1242           else {
1243               char *mbstr = wcstombsdmp(text->string.wide_char, text->length);
1244               strncpy(statusWindow->status, mbstr, MAX_STATUS_LEN);
1245               statusWindow->status[MAX_STATUS_LEN - 1] = '\0';
1246           }
1247           statusWindow->on = True;
1248           onoffStatusWindow(pX11IMData, statusWindow->parent, True);
1249           paintStatusWindow(statusWindow);
1250         }
1251         else {
1252             statusWindow->on = False;
1253             /*just turnoff the status window
1254             paintStatusWindow(statusWindow);
1255             */
1256             onoffStatusWindow(pX11IMData, 0, False);
1257         }
1258     }
1259 
1260  finally:
1261     AWT_UNLOCK();
1262 }
1263 #endif /* __linux__ || MACOSX */
1264 
1265 static void CommitStringCallback(XIC ic, XPointer client_data, XPointer call_data) {


< prev index next >