< prev index next >

src/java.desktop/unix/native/libsplashscreen/splashscreen_sys.c

Print this page


   1 /*
   2  * Copyright (c) 2005, 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


  25 
  26 #include "splashscreen_impl.h"
  27 #include <X11/Xlib.h>
  28 #include <X11/Xutil.h>
  29 #include <X11/extensions/shape.h>
  30 #include <X11/Xmd.h>
  31 #include <X11/Xatom.h>
  32 #include <X11/cursorfont.h>
  33 #include <sys/types.h>
  34 #include <pthread.h>
  35 #include <signal.h>
  36 #include <unistd.h>
  37 #include <sys/time.h>
  38 #include <errno.h>
  39 #include <iconv.h>
  40 #include <langinfo.h>
  41 #include <locale.h>
  42 #include <fcntl.h>
  43 #include <poll.h>
  44 #include <sizecalc.h>

  45 
  46 static Bool shapeSupported;
  47 static int shapeEventBase, shapeErrorBase;
  48 
  49 void SplashRemoveDecoration(Splash * splash);
  50 
  51 
  52 /* Could use npt but decided to cut down on linked code size */
  53 char* SplashConvertStringAlloc(const char* in, int* size) {
  54     const char     *codeset;
  55     const char     *codeset_out;
  56     iconv_t         cd;
  57     size_t          rc;
  58     char           *buf = NULL, *out;
  59     size_t          bufSize, inSize, outSize;
  60     const char* old_locale;
  61 
  62     if (!in) {
  63         return NULL;
  64     }


 783 void
 784 SplashUnlock(Splash * splash) {
 785     pthread_mutex_unlock(&splash->lock);
 786 }
 787 
 788 void
 789 SplashClosePlatform(Splash * splash) {
 790     sendctl(splash, SPLASHCTL_QUIT);
 791 }
 792 
 793 void
 794 SplashUpdate(Splash * splash) {
 795     sendctl(splash, SPLASHCTL_UPDATE);
 796 }
 797 
 798 void
 799 SplashReconfigure(Splash * splash) {
 800     sendctl(splash, SPLASHCTL_RECONFIGURE);
 801 }
 802 
 803 SPLASHEXPORT jboolean
 804 SplashGetScaledImageName(const char* jarName, const char* fileName,
 805                            float *scaleFactor, char *scaledImgName,
 806                            const size_t scaledImageNameLength)
 807 {
 808     *scaleFactor = 1;
 809 #ifndef __linux__
 810     return JNI_FALSE;
 811 #endif
 812     *scaleFactor = (float)getNativeScaleFactor(NULL);
 813     return GetScaledImageName(fileName, scaledImgName, scaleFactor, scaledImageNameLength);
 814 }
 815 
   1 /*
   2  * Copyright (c) 2005, 2018, 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


  25 
  26 #include "splashscreen_impl.h"
  27 #include <X11/Xlib.h>
  28 #include <X11/Xutil.h>
  29 #include <X11/extensions/shape.h>
  30 #include <X11/Xmd.h>
  31 #include <X11/Xatom.h>
  32 #include <X11/cursorfont.h>
  33 #include <sys/types.h>
  34 #include <pthread.h>
  35 #include <signal.h>
  36 #include <unistd.h>
  37 #include <sys/time.h>
  38 #include <errno.h>
  39 #include <iconv.h>
  40 #include <langinfo.h>
  41 #include <locale.h>
  42 #include <fcntl.h>
  43 #include <poll.h>
  44 #include <sizecalc.h>
  45 #include "jni.h"
  46 
  47 static Bool shapeSupported;
  48 static int shapeEventBase, shapeErrorBase;
  49 
  50 void SplashRemoveDecoration(Splash * splash);
  51 
  52 
  53 /* Could use npt but decided to cut down on linked code size */
  54 char* SplashConvertStringAlloc(const char* in, int* size) {
  55     const char     *codeset;
  56     const char     *codeset_out;
  57     iconv_t         cd;
  58     size_t          rc;
  59     char           *buf = NULL, *out;
  60     size_t          bufSize, inSize, outSize;
  61     const char* old_locale;
  62 
  63     if (!in) {
  64         return NULL;
  65     }


 784 void
 785 SplashUnlock(Splash * splash) {
 786     pthread_mutex_unlock(&splash->lock);
 787 }
 788 
 789 void
 790 SplashClosePlatform(Splash * splash) {
 791     sendctl(splash, SPLASHCTL_QUIT);
 792 }
 793 
 794 void
 795 SplashUpdate(Splash * splash) {
 796     sendctl(splash, SPLASHCTL_UPDATE);
 797 }
 798 
 799 void
 800 SplashReconfigure(Splash * splash) {
 801     sendctl(splash, SPLASHCTL_RECONFIGURE);
 802 }
 803 
 804 JNIEXPORT jboolean JNICALL
 805 SplashGetScaledImageName(const char* jarName, const char* fileName,
 806                            float *scaleFactor, char *scaledImgName,
 807                            const size_t scaledImageNameLength)
 808 {
 809     *scaleFactor = 1;
 810 #ifndef __linux__
 811     return JNI_FALSE;
 812 #endif
 813     *scaleFactor = (float)getNativeScaleFactor(NULL);
 814     return GetScaledImageName(fileName, scaledImgName, scaleFactor, scaledImageNameLength);
 815 }
 816 
< prev index next >