/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include "splashscreen_impl.h"
#include <X11/cursorfont.h>
#include <pthread.h>
#include <signal.h>
#include <unistd.h>
#include <errno.h>
#include <iconv.h>
#include <langinfo.h>
#include <locale.h>
#include <fcntl.h>
#include <poll.h>
#include <sizecalc.h>
/* Could use npt but decided to cut down on linked code size */
const char *codeset;
const char *codeset_out;
const char* old_locale;
if (!in) {
return NULL;
}
goto done;
}
/* we don't need BOM in output so we choose native BE or LE encoding here */
"UCS-2BE" : "UCS-2LE";
goto done;
}
if (!buf) {
return NULL;
}
// 2 bytes per source byte max
/* linux iconv wants char** source and solaris wants const char**...
cast to void* */
} else {
if (size) {
}
}
done:
return buf;
}
void
if (!splash->maskRequired)
return;
if (!shapeSupported)
return;
return;
}
if (!rects) {
return;
}
}
}
unsigned
SplashTime(void) {
unsigned long long msec;
return (unsigned) msec;
}
void
}
int
if (numColors > map_entries) {
}
nAllocated = 0; /* lower bound */
/* Binary search to determine the number of available cells */
} else
done = 1;
} else {
else
done = 1;
}
}
return nAllocated;
}
unsigned long *pr) {
return cmap;
}
void
unsigned long *pr) {
}
/* try centering using Xinerama hint
if there's no hint, use the center of the screen */
&bytes_after, (unsigned char**)(&prop));
return;
}
}
}
}
sizeHints.height = sizeHints.base_height = sizeHints.min_height = sizeHints.max_height = splash->height;
}
}
void
&attr);
}
}
/* for changing the visible shape of a window to an nonrectangular form */
void
if (!shapeSupported)
return;
if (!splash->maskRequired) {
return;
}
}
/* for reverting the visible shape of a window to an rectangular form */
void
if (!shapeSupported)
return;
if (splash->maskRequired)
return;
}
int
if (byteOrder == BYTE_ORDER_NATIVE)
switch (byteOrder) {
case BYTE_ORDER_LSBFIRST:
return LSBFirst;
case BYTE_ORDER_MSBFIRST:
return MSBFirst;
default:
return -1;
}
}
void
// making this method redraw a part of the image does not make
// much sense as SplashUpdateScreenData always re-generates
// the image completely, so whole window is always redrawn
}
}
if (splash->maskRequired) {
} else {
}
}
void
// if (splash->isVisible>0) {
}
}
int
// silently ignore non-fatal errors
/*
char msg[0x1000];
char buf[0x1000];
XGetErrorText(disp, err->error_code, msg, sizeof(msg));
fprintf(stderr, "Xerror %s, XID %x, ser# %d\n", msg, err->resourceid,
err->serial);
sprintf(buf, "%d", err->request_code);
XGetErrorDatabaseText(disp, "XRequest", buf, "Unknown", msg, sizeof(msg));
fprintf(stderr, "Major opcode %d (%s)\n", err->request_code, msg);
if (err->request_code > 128) {
fprintf(stderr, "Minor opcode %d\n", err->minor_code);
}
*/
return 0;
}
int
// for really bad errors, we should exit the thread we're on
return 0;
}
void
// This setting enables the synchronous Xlib mode!
// Don't use it == 1 in production builds!
#if (defined DEBUG)
_Xdebug = 1;
#endif
// We should not ignore any errors.
//XSetErrorHandler(HandleError);
// XSetIOErrorHandler(HandleIOError);
return;
}
if (shapeSupported) {
}
case TrueColor: {
// TrueColor depth probably can't be less
// than 8 bits, and it's always byte padded
break;
}
case PseudoColor: {
int availableColors;
int numColors;
int i;
if (numColors > availableColors) {
// Could not allocate the color cells. Most probably
// the pool got exhausted. Disable the splash screen.
fprintf(stderr, "Warning: unable to initialize the splashscreen. Not enough available color cells.\n");
return;
}
for (i = 0; i < numColors; i++) {
}
splash->colorIndex);
for (i = 0; i < numColors; i++) {
}
break;
}
default:
; /* FIXME: should probably be fixed, but javaws splash screen doesn't support other visuals either */
}
}
void
int i;
for (i = 0; i < splash->frameCount; i++) {
}
}
}
}
void
int i;
}
}
}
void
/* Different from win32 implementation - this loop
uses poll timeouts instead of a timer */
/* we should have splash _locked_ on entry!!! */
while (1) {
int rc;
int pipes_empty;
errno = 0;
- SplashTime();
if (timeout < 0) {
timeout = 0;
}
}
}
if (rc <= 0) {
errno = 0;
continue;
}
pipes_empty = 0;
while(!pipes_empty) {
char buf;
pipes_empty = 1;
pipes_empty = 0;
switch (buf) {
case SPLASHCTL_UPDATE:
}
break;
case SPLASHCTL_RECONFIGURE:
}
break;
case SPLASHCTL_QUIT:
return;
}
}
// we're not using "while(XPending)", processing one event
// at a time to avoid control pipe starvation
pipes_empty = 0;
case Expose:
// we're doing full redraw so we just
// skip the remaining painting events in the queue
&evt));
}
break;
/* ... */
}
}
}
}
}
/* we can't use OverrideRedirect for the window as the window should not be
always-on-top, so we must set appropriate wm hints
this functions sets olwm, mwm and EWMH hints for undecorated window at once
It works for: mwm, openbox, wmaker, metacity, KWin (FIXME: test more wm's)
Should work for: fvwm2.5.x, blackbox, olwm
Maybe works for: enlightenment, icewm
Does not work for: twm, fvwm2.4.7
*/
void
/* the struct below was copied from MwmUtil.h */
struct PROPMOTIFWMHINTS {
/* 32-bit property items are stored as long on the client (whether
* that means 32 bits or 64). XChangeProperty handles the conversion
* to the actual 32-bit quantities sent to the server.
*/
unsigned long flags;
unsigned long functions;
unsigned long decorations;
long inputMode;
unsigned long status;
}
/* WM_TAKE_FOCUS hint to avoid wm's transfer of focus to this window */
/* WM_DELETE_WINDOW hint to avoid closing this window with Alt-F4. See bug 6474035 */
}
/* mwm hints */
/* flags for decoration and functions */
mwm_hints.decorations = 0;
}
/* olwm hints */
}
/* generic EMWH hints
we do not set _NET_WM_WINDOW_TYPE to _NET_WM_WINDOW_TYPE_SPLASH
hint support due to gnome making this window always-on-top
so we have to set _NET_WM_STATE and _NET_WM_ALLOWED_ACTIONS correctly
_NET_WM_STATE: SKIP_TASKBAR and SKIP_PAGER
_NET_WM_ALLOWED_ACTIONS: disable all actions */
"_NET_WM_STATE_SKIP_TASKBAR", True);
"_NET_WM_STATE_SKIP_PAGER", True);
}
PropModeReplace, (unsigned char *) atom_list, 0);
}
}
void
/* this will be used in case of emergency thread exit on xlib error */
if (splash) {
}
}
void *
// pthread_key_t key;
// pthread_key_create(&key, SplashPThreadDestructor);
// pthread_setspecific(key, splash);
}
return 0;
}
void
int rc;
}
void
}
void
}
void
}
void
}
void
}