提交 f5d58309 编写于 作者: A art

6989721: awt native code compiler warnings

Reviewed-by: yan, uta
上级 c4c88263
...@@ -29,9 +29,11 @@ import java.awt.Event; ...@@ -29,9 +29,11 @@ import java.awt.Event;
import java.awt.Component; import java.awt.Component;
import java.awt.GraphicsEnvironment; import java.awt.GraphicsEnvironment;
import java.awt.Toolkit; import java.awt.Toolkit;
import sun.util.logging.PlatformLogger;
import java.util.Arrays; import java.util.Arrays;
import sun.awt.AWTAccessor;
import sun.util.logging.PlatformLogger;
/** /**
* The root event class for all component-level input events. * The root event class for all component-level input events.
* *
...@@ -54,6 +56,7 @@ import java.util.Arrays; ...@@ -54,6 +56,7 @@ import java.util.Arrays;
* @since 1.1 * @since 1.1
*/ */
public abstract class InputEvent extends ComponentEvent { public abstract class InputEvent extends ComponentEvent {
private static final PlatformLogger logger = PlatformLogger.getLogger("java.awt.event.InputEvent"); private static final PlatformLogger logger = PlatformLogger.getLogger("java.awt.event.InputEvent");
/** /**
...@@ -288,6 +291,12 @@ public abstract class InputEvent extends ComponentEvent { ...@@ -288,6 +291,12 @@ public abstract class InputEvent extends ComponentEvent {
if (!GraphicsEnvironment.isHeadless()) { if (!GraphicsEnvironment.isHeadless()) {
initIDs(); initIDs();
} }
AWTAccessor.setInputEventAccessor(
new AWTAccessor.InputEventAccessor() {
public int[] getButtonDownMasks() {
return getButtonDownMasks();
}
});
} }
/** /**
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
package sun.awt; package sun.awt;
import java.awt.*; import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
...@@ -303,6 +304,13 @@ public final class AWTAccessor { ...@@ -303,6 +304,13 @@ public final class AWTAccessor {
void setPosted(AWTEvent ev); void setPosted(AWTEvent ev);
} }
public interface InputEventAccessor {
/*
* Accessor for InputEvent.getButtonDownMasks()
*/
int[] getButtonDownMasks();
}
/* /*
* An accessor for the java.awt.Frame class. * An accessor for the java.awt.Frame class.
*/ */
...@@ -435,6 +443,11 @@ public final class AWTAccessor { ...@@ -435,6 +443,11 @@ public final class AWTAccessor {
*/ */
private static AWTEventAccessor awtEventAccessor; private static AWTEventAccessor awtEventAccessor;
/*
* The java.awt.event.InputEvent class accessor object.
*/
private static InputEventAccessor inputEventAccessor;
/* /*
* The java.awt.Frame class accessor object. * The java.awt.Frame class accessor object.
*/ */
...@@ -517,6 +530,23 @@ public final class AWTAccessor { ...@@ -517,6 +530,23 @@ public final class AWTAccessor {
return awtEventAccessor; return awtEventAccessor;
} }
/*
* Set an accessor object for the java.awt.event.InputEvent class.
*/
public static void setInputEventAccessor(InputEventAccessor iea) {
inputEventAccessor = iea;
}
/*
* Retrieve the accessor object for the java.awt.event.InputEvent class.
*/
public static InputEventAccessor getInputEventAccessor() {
if (inputEventAccessor == null) {
unsafe.ensureClassInitialized(InputEvent.class);
}
return inputEventAccessor;
}
/* /*
* Set an accessor object for the java.awt.Frame class. * Set an accessor object for the java.awt.Frame class.
*/ */
......
...@@ -3993,7 +3993,7 @@ png_do_dither(png_row_infop row_info, png_bytep row, ...@@ -3993,7 +3993,7 @@ png_do_dither(png_row_infop row_info, png_bytep row,
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
#if defined(PNG_READ_GAMMA_SUPPORTED) #if defined(PNG_READ_GAMMA_SUPPORTED)
const static int png_gamma_shift[] = static PNG_CONST int png_gamma_shift[] =
{0x10, 0x21, 0x42, 0x84, 0x110, 0x248, 0x550, 0xff0, 0x00}; {0x10, 0x21, 0x42, 0x84, 0x110, 0x248, 0x550, 0xff0, 0x00};
/* We build the 8- or 16-bit gamma tables here. Note that for 16-bit /* We build the 8- or 16-bit gamma tables here. Note that for 16-bit
......
...@@ -209,7 +209,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type, ...@@ -209,7 +209,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
png_charp chunkdata, png_size_t chunklength, png_charp chunkdata, png_size_t chunklength,
png_size_t prefix_size, png_size_t *newlength) png_size_t prefix_size, png_size_t *newlength)
{ {
const static char msg[] = "Error decoding compressed text"; static PNG_CONST char msg[] = "Error decoding compressed text";
png_charp text; png_charp text;
png_size_t text_size; png_size_t text_size;
......
...@@ -51,7 +51,7 @@ static const char szNetscape20ext[11] = "NETSCAPE2.0"; ...@@ -51,7 +51,7 @@ static const char szNetscape20ext[11] = "NETSCAPE2.0";
#define NSEXT_LOOP 0x01 // Loop Count field code #define NSEXT_LOOP 0x01 // Loop Count field code
// convert libungif samples to our ones // convert libungif samples to our ones
#define MAKE_QUAD_GIF(c,a) MAKE_QUAD((c).Red, (c).Green, (c).Blue, (a)) #define MAKE_QUAD_GIF(c,a) MAKE_QUAD((c).Red, (c).Green, (c).Blue, (unsigned)(a))
/* stdio FILE* and memory input functions for libungif */ /* stdio FILE* and memory input functions for libungif */
int int
...@@ -165,7 +165,7 @@ SplashDecodeGif(Splash * splash, GifFileType * gif) ...@@ -165,7 +165,7 @@ SplashDecodeGif(Splash * splash, GifFileType * gif)
{ {
int flag = pExtension[0]; int flag = pExtension[0];
frameDelay = (pExtension[2] << 8) | pExtension[1]; frameDelay = (((int)pExtension[2]) << 8) | pExtension[1];
if (frameDelay < 10) if (frameDelay < 10)
frameDelay = 10; frameDelay = 10;
if (flag & GIF_TRANSPARENT) { if (flag & GIF_TRANSPARENT) {
...@@ -191,7 +191,7 @@ SplashDecodeGif(Splash * splash, GifFileType * gif) ...@@ -191,7 +191,7 @@ SplashDecodeGif(Splash * splash, GifFileType * gif)
iSubCode = pExtension[0] & 0x07; iSubCode = pExtension[0] & 0x07;
if (iSubCode == NSEXT_LOOP) { if (iSubCode == NSEXT_LOOP) {
splash->loopCount = splash->loopCount =
(pExtension[1] | (pExtension[2] << 8)) - 1; (pExtension[1] | (((int)pExtension[2]) << 8)) - 1;
} }
} }
break; break;
......
...@@ -25,11 +25,15 @@ ...@@ -25,11 +25,15 @@
package sun.awt.X11; package sun.awt.X11;
import java.awt.*; import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.peer.*; import java.awt.peer.*;
import sun.awt.X11GraphicsConfig;
import sun.awt.AWTAccessor;
import sun.awt.SunToolkit; import sun.awt.SunToolkit;
import sun.awt.X11GraphicsConfig;
class XRobotPeer implements RobotPeer { class XRobotPeer implements RobotPeer {
private X11GraphicsConfig xgc = null; private X11GraphicsConfig xgc = null;
/* /*
* native implementation uses some static shared data (pipes, processes) * native implementation uses some static shared data (pipes, processes)
...@@ -40,7 +44,7 @@ class XRobotPeer implements RobotPeer { ...@@ -40,7 +44,7 @@ class XRobotPeer implements RobotPeer {
XRobotPeer(GraphicsConfiguration gc) { XRobotPeer(GraphicsConfiguration gc) {
this.xgc = (X11GraphicsConfig)gc; this.xgc = (X11GraphicsConfig)gc;
SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit(); SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit();
setup(tk.getNumberOfButtons()); setup(tk.getNumberOfButtons(), AWTAccessor.getInputEventAccessor().getButtonDownMasks());
} }
public void dispose() { public void dispose() {
...@@ -83,7 +87,7 @@ class XRobotPeer implements RobotPeer { ...@@ -83,7 +87,7 @@ class XRobotPeer implements RobotPeer {
return pixelArray; return pixelArray;
} }
private static native synchronized void setup(int numberOfButtons); private static native synchronized void setup(int numberOfButtons, int[] buttonDownMasks);
private static native synchronized void mouseMoveImpl(X11GraphicsConfig xgc, int x, int y); private static native synchronized void mouseMoveImpl(X11GraphicsConfig xgc, int x, int y);
private static native synchronized void mousePressImpl(int buttons); private static native synchronized void mousePressImpl(int buttons);
......
...@@ -160,19 +160,7 @@ extern int lastL; ...@@ -160,19 +160,7 @@ extern int lastL;
#ifndef HEADLESS #ifndef HEADLESS
extern Display *awt_display; /* awt_GraphicsEnv.c */ extern Display *awt_display; /* awt_GraphicsEnv.c */
extern XtAppContext awt_appContext; /* awt_MToolkit.c */ extern Boolean awt_ModLockIsShiftLock; /* XToolkit.c */
extern Widget awt_root_shell;
extern Pixel awt_defaultBg;
extern Pixel awt_defaultFg;
extern int awt_multiclick_time; /* awt_MToolkit.c */
extern int awt_multiclick_smudge; /* canvas.c */
extern unsigned int awt_MetaMask; /* awt_MToolkit.c */
extern unsigned int awt_AltMask;
extern unsigned int awt_NumLockMask;
extern unsigned int awt_ModeSwitchMask;
extern Cursor awt_scrollCursor; /* awt_MToolkit.c */
extern Boolean awt_ModLockIsShiftLock;
#endif /* !HEADLESS */ #endif /* !HEADLESS */
#endif /* ! _AWT_ */ #endif /* ! _AWT_ */
...@@ -264,7 +264,7 @@ awt_DrawingSurface_GetDrawingSurfaceInfo(JAWT_DrawingSurface* ds) ...@@ -264,7 +264,7 @@ awt_DrawingSurface_GetDrawingSurfaceInfo(JAWT_DrawingSurface* ds)
#ifndef XAWT #ifndef XAWT
px->drawable = XtWindow(cdata->widget); px->drawable = XtWindow(cdata->widget);
#else #else
px->drawable = JNU_GetLongFieldAsPtr(env, peer, windowID); px->drawable = (*env)->GetLongField(env, peer, windowID);
#endif #endif
px->display = awt_display; px->display = awt_display;
......
...@@ -46,8 +46,6 @@ ...@@ -46,8 +46,6 @@
#ifdef XAWT #ifdef XAWT
#include <sun_awt_X11_XComponentPeer.h> #include <sun_awt_X11_XComponentPeer.h>
#include <sun_awt_X11_XInputMethod.h> #include <sun_awt_X11_XInputMethod.h>
#define XtWindow(w) (w)
#else /* !XAWT */ #else /* !XAWT */
#include <sun_awt_motif_MComponentPeer.h> #include <sun_awt_motif_MComponentPeer.h>
#include <sun_awt_motif_MInputMethod.h> #include <sun_awt_motif_MInputMethod.h>
...@@ -670,7 +668,8 @@ static StatusWindow *createStatusWindow( ...@@ -670,7 +668,8 @@ static StatusWindow *createStatusWindow(
int mccr = 0; int mccr = 0;
char *dsr; char *dsr;
Pixel bg, fg, light, dim; Pixel bg, fg, light, dim;
int x, y, w, h, bw, depth, off_x, off_y, xx, yy; int x, y, off_x, off_y, xx, yy;
unsigned int w, h, bw, depth;
XGCValues values; XGCValues values;
unsigned long valuemask = 0; /*ignore XGCvalue and use defaults*/ unsigned long valuemask = 0; /*ignore XGCvalue and use defaults*/
int screen = 0; int screen = 0;
...@@ -709,7 +708,7 @@ static StatusWindow *createStatusWindow( ...@@ -709,7 +708,7 @@ static StatusWindow *createStatusWindow(
light = adata->AwtColorMatch(195, 195, 195, adata); light = adata->AwtColorMatch(195, 195, 195, adata);
dim = adata->AwtColorMatch(128, 128, 128, adata); dim = adata->AwtColorMatch(128, 128, 128, adata);
XGetWindowAttributes(dpy, XtWindow(parent), &xwa); XGetWindowAttributes(dpy, parent, &xwa);
bw = 2; /*xwa.border_width does not have the correct value*/ bw = 2; /*xwa.border_width does not have the correct value*/
/*compare the size difference between parent container /*compare the size difference between parent container
...@@ -717,7 +716,7 @@ static StatusWindow *createStatusWindow( ...@@ -717,7 +716,7 @@ static StatusWindow *createStatusWindow(
and title bar height (?)*/ and title bar height (?)*/
XQueryTree( dpy, XQueryTree( dpy,
XtWindow(parent), parent,
&rootWindow, &rootWindow,
&containerWindow, &containerWindow,
&ignoreWindowPtr, &ignoreWindowPtr,
...@@ -731,7 +730,7 @@ static StatusWindow *createStatusWindow( ...@@ -731,7 +730,7 @@ static StatusWindow *createStatusWindow(
XGetWindowAttributes(dpy, rootWindow, &xxwa); XGetWindowAttributes(dpy, rootWindow, &xxwa);
XTranslateCoordinates(dpy, XTranslateCoordinates(dpy,
XtWindow(parent), xwa.root, parent, xwa.root,
xwa.x, xwa.y, xwa.x, xwa.y,
&x, &y, &x, &y,
&child); &child);
...@@ -833,9 +832,9 @@ static void onoffStatusWindow(X11InputMethodData* pX11IMData, ...@@ -833,9 +832,9 @@ static void onoffStatusWindow(X11InputMethodData* pX11IMData,
if (statusWindow->parent != parent){ if (statusWindow->parent != parent){
statusWindow->parent = parent; statusWindow->parent = parent;
} }
XGetWindowAttributes(dpy, XtWindow(parent), &xwa); XGetWindowAttributes(dpy, parent, &xwa);
XTranslateCoordinates(dpy, XTranslateCoordinates(dpy,
XtWindow(parent), xwa.root, parent, xwa.root,
xwa.x, xwa.y, xwa.x, xwa.y,
&x, &y, &x, &y,
&child); &child);
...@@ -966,9 +965,9 @@ void adjustStatusWindow(Widget shell){ ...@@ -966,9 +965,9 @@ void adjustStatusWindow(Widget shell){
XWindowAttributes xwa; XWindowAttributes xwa;
int x, y; int x, y;
Window child; Window child;
XGetWindowAttributes(dpy, XtWindow(shell), &xwa); XGetWindowAttributes(dpy, shell, &xwa);
XTranslateCoordinates(dpy, XTranslateCoordinates(dpy,
XtWindow(shell), xwa.root, shell, xwa.root,
xwa.x, xwa.y, xwa.x, xwa.y,
&x, &y, &x, &y,
&child); &child);
...@@ -1033,7 +1032,7 @@ createXIC(Widget w, X11InputMethodData *pX11IMData, ...@@ -1033,7 +1032,7 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
return False; return False;
} }
#ifdef XAWT #ifdef XAWT
if (w == NULL) { if (!w) {
return False; return False;
} }
#else /* !XAWT */ #else /* !XAWT */
...@@ -1148,8 +1147,8 @@ createXIC(Widget w, X11InputMethodData *pX11IMData, ...@@ -1148,8 +1147,8 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
goto err; goto err;
pX11IMData->statusWindow = createStatusWindow(w); pX11IMData->statusWindow = createStatusWindow(w);
pX11IMData->ic_active = XCreateIC(X11im, pX11IMData->ic_active = XCreateIC(X11im,
XNClientWindow, XtWindow(w), XNClientWindow, w,
XNFocusWindow, XtWindow(w), XNFocusWindow, w,
XNInputStyle, active_styles, XNInputStyle, active_styles,
XNPreeditAttributes, preedit, XNPreeditAttributes, preedit,
XNStatusAttributes, status, XNStatusAttributes, status,
...@@ -1166,8 +1165,8 @@ createXIC(Widget w, X11InputMethodData *pX11IMData, ...@@ -1166,8 +1165,8 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
goto err; goto err;
pX11IMData->statusWidget = awt_util_getXICStatusAreaWindow(w); pX11IMData->statusWidget = awt_util_getXICStatusAreaWindow(w);
pX11IMData->ic_active = XCreateIC(X11im, pX11IMData->ic_active = XCreateIC(X11im,
XNClientWindow, XtWindow(pX11IMData->statusWidget), XNClientWindow, pX11IMData->statusWidget,
XNFocusWindow, XtWindow(w), XNFocusWindow, w,
XNInputStyle, active_styles, XNInputStyle, active_styles,
XNPreeditAttributes, preedit, XNPreeditAttributes, preedit,
XNStatusAttributes, status, XNStatusAttributes, status,
...@@ -1176,8 +1175,8 @@ createXIC(Widget w, X11InputMethodData *pX11IMData, ...@@ -1176,8 +1175,8 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
} else { } else {
#endif /* XAWT */ #endif /* XAWT */
pX11IMData->ic_active = XCreateIC(X11im, pX11IMData->ic_active = XCreateIC(X11im,
XNClientWindow, XtWindow(w), XNClientWindow, w,
XNFocusWindow, XtWindow(w), XNFocusWindow, w,
XNInputStyle, active_styles, XNInputStyle, active_styles,
XNPreeditAttributes, preedit, XNPreeditAttributes, preedit,
NULL); NULL);
...@@ -1187,15 +1186,15 @@ createXIC(Widget w, X11InputMethodData *pX11IMData, ...@@ -1187,15 +1186,15 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
XFree((void *)preedit); XFree((void *)preedit);
#endif /* __linux__ */ #endif /* __linux__ */
pX11IMData->ic_passive = XCreateIC(X11im, pX11IMData->ic_passive = XCreateIC(X11im,
XNClientWindow, XtWindow(w), XNClientWindow, w,
XNFocusWindow, XtWindow(w), XNFocusWindow, w,
XNInputStyle, passive_styles, XNInputStyle, passive_styles,
NULL); NULL);
} else { } else {
pX11IMData->ic_active = XCreateIC(X11im, pX11IMData->ic_active = XCreateIC(X11im,
XNClientWindow, XtWindow(w), XNClientWindow, w,
XNFocusWindow, XtWindow(w), XNFocusWindow, w,
XNInputStyle, active_styles, XNInputStyle, active_styles,
NULL); NULL);
pX11IMData->ic_passive = pX11IMData->ic_active; pX11IMData->ic_passive = pX11IMData->ic_active;
...@@ -1213,7 +1212,7 @@ createXIC(Widget w, X11InputMethodData *pX11IMData, ...@@ -1213,7 +1212,7 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
{ {
XIMCallback cb; XIMCallback cb;
cb.client_data = (XPointer) pX11IMData->x11inputmethod; cb.client_data = (XPointer) pX11IMData->x11inputmethod;
cb.callback = CommitStringCallback; cb.callback = (XIMProc) CommitStringCallback;
XSetICValues (pX11IMData->ic_active, XNCommitStringCallback, &cb, NULL); XSetICValues (pX11IMData->ic_active, XNCommitStringCallback, &cb, NULL);
if (pX11IMData->ic_active != pX11IMData->ic_passive) { if (pX11IMData->ic_active != pX11IMData->ic_passive) {
XSetICValues (pX11IMData->ic_passive, XNCommitStringCallback, &cb, NULL); XSetICValues (pX11IMData->ic_passive, XNCommitStringCallback, &cb, NULL);
...@@ -1506,7 +1505,7 @@ Java_sun_awt_motif_MInputMethod_openXIMNative(JNIEnv *env, ...@@ -1506,7 +1505,7 @@ Java_sun_awt_motif_MInputMethod_openXIMNative(JNIEnv *env,
AWT_LOCK(); AWT_LOCK();
#ifdef XAWT #ifdef XAWT
dpy = (Display *)display; dpy = (Display *)jlong_to_ptr(display);
#else #else
dpy = awt_display; dpy = awt_display;
#endif #endif
...@@ -1516,7 +1515,7 @@ Java_sun_awt_motif_MInputMethod_openXIMNative(JNIEnv *env, ...@@ -1516,7 +1515,7 @@ Java_sun_awt_motif_MInputMethod_openXIMNative(JNIEnv *env,
*/ */
#ifdef __linux__ #ifdef __linux__
registered = XRegisterIMInstantiateCallback(dpy, NULL, NULL, registered = XRegisterIMInstantiateCallback(dpy, NULL, NULL,
NULL, (XIMProc)OpenXIMCallback, NULL); NULL, (XIDProc)OpenXIMCallback, NULL);
if (!registered) { if (!registered) {
/* directly call openXIM callback */ /* directly call openXIM callback */
#endif #endif
...@@ -1551,7 +1550,7 @@ Java_sun_awt_motif_MInputMethod_createXICNative(JNIEnv *env, ...@@ -1551,7 +1550,7 @@ Java_sun_awt_motif_MInputMethod_createXICNative(JNIEnv *env,
AWT_LOCK(); AWT_LOCK();
#ifdef XAWT #ifdef XAWT
if (window == NULL) { if (!window) {
#else /* !XAWT */ #else /* !XAWT */
if (JNU_IsNull(env, comp)) { if (JNU_IsNull(env, comp)) {
#endif /* XAWT */ #endif /* XAWT */
...@@ -1660,7 +1659,7 @@ Java_sun_awt_motif_MInputMethod_reconfigureXICNative(JNIEnv *env, ...@@ -1660,7 +1659,7 @@ Java_sun_awt_motif_MInputMethod_reconfigureXICNative(JNIEnv *env,
* On Solaris2.6, setXICWindowFocus() has to be invoked * On Solaris2.6, setXICWindowFocus() has to be invoked
* before setting focus. * before setting focus.
*/ */
setXICWindowFocus(pX11IMData->current_ic, XtWindow(cdata->widget)); setXICWindowFocus(pX11IMData->current_ic, cdata->widget);
setXICFocus(pX11IMData->current_ic, True); setXICFocus(pX11IMData->current_ic, True);
} else { } else {
destroyX11InputMethodData((JNIEnv *) NULL, pX11IMData); destroyX11InputMethodData((JNIEnv *) NULL, pX11IMData);
...@@ -1701,7 +1700,7 @@ Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env, ...@@ -1701,7 +1700,7 @@ Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env,
if (req) { if (req) {
#ifdef XAWT #ifdef XAWT
if (w == NULL) { if (!w) {
AWT_UNLOCK(); AWT_UNLOCK();
return; return;
} }
...@@ -1734,10 +1733,10 @@ Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env, ...@@ -1734,10 +1733,10 @@ Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env,
#ifndef XAWT #ifndef XAWT
w = cdata->widget; w = cdata->widget;
#endif /* XAWT */ #endif /* XAWT */
setXICWindowFocus(pX11IMData->current_ic, XtWindow(w)); setXICWindowFocus(pX11IMData->current_ic, w);
setXICFocus(pX11IMData->current_ic, req); setXICFocus(pX11IMData->current_ic, req);
currentX11InputMethodInstance = pX11IMData->x11inputmethod; currentX11InputMethodInstance = pX11IMData->x11inputmethod;
currentFocusWindow = XtWindow(w); currentFocusWindow = w;
#ifdef __linux__ #ifdef __linux__
if (active && pX11IMData->statusWindow && pX11IMData->statusWindow->on) if (active && pX11IMData->statusWindow && pX11IMData->statusWindow->on)
onoffStatusWindow(pX11IMData, w, True); onoffStatusWindow(pX11IMData, w, True);
......
...@@ -165,41 +165,34 @@ static XImage *getWindowImage(Display * display, Window window, ...@@ -165,41 +165,34 @@ static XImage *getWindowImage(Display * display, Window window,
// this should be called from XRobotPeer constructor // this should be called from XRobotPeer constructor
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_sun_awt_X11_XRobotPeer_setup (JNIEnv * env, jclass cls, jint numberOfButtons) { Java_sun_awt_X11_XRobotPeer_setup (JNIEnv * env, jclass cls, jint numberOfButtons, jintArray buttonDownMasks)
{
int32_t xtestAvailable; int32_t xtestAvailable;
jint *tmp;
int i;
DTRACE_PRINTLN("RobotPeer: setup()"); DTRACE_PRINTLN("RobotPeer: setup()");
num_buttons = numberOfButtons; num_buttons = numberOfButtons;
tmp = (*env)->GetIntArrayElements(env, buttonDownMasks, JNI_FALSE);
jclass inputEventClazz = (*env)->FindClass(env, "java/awt/event/InputEvent");
jmethodID getButtonDownMasksID = (*env)->GetStaticMethodID(env, inputEventClazz, "getButtonDownMasks", "()[I");
jintArray obj = (jintArray)(*env)->CallStaticObjectMethod(env, inputEventClazz, getButtonDownMasksID);
jint * tmp = (*env)->GetIntArrayElements(env, obj, JNI_FALSE);
masks = (jint *)malloc(sizeof(jint) * num_buttons); masks = (jint *)malloc(sizeof(jint) * num_buttons);
if (masks == (jint *) NULL) { if (masks == (jint *) NULL) {
JNU_ThrowOutOfMemoryError((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2), NULL); JNU_ThrowOutOfMemoryError((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2), NULL);
goto finally; (*env)->ReleaseIntArrayElements(env, buttonDownMasks, tmp, 0);
return;
} }
int i;
for (i = 0; i < num_buttons; i++) { for (i = 0; i < num_buttons; i++) {
masks[i] = tmp[i]; masks[i] = tmp[i];
} }
(*env)->ReleaseIntArrayElements(env, obj, tmp, 0); (*env)->ReleaseIntArrayElements(env, buttonDownMasks, tmp, 0);
(*env)->DeleteLocalRef(env, obj);
AWT_LOCK(); AWT_LOCK();
xtestAvailable = isXTestAvailable(); xtestAvailable = isXTestAvailable();
DTRACE_PRINTLN1("RobotPeer: XTest available = %d", xtestAvailable); DTRACE_PRINTLN1("RobotPeer: XTest available = %d", xtestAvailable);
if (!xtestAvailable) { if (!xtestAvailable) {
JNU_ThrowByName(env, "java/awt/AWTException", "java.awt.Robot requires your X server support the XTEST extension version 2.2"); JNU_ThrowByName(env, "java/awt/AWTException", "java.awt.Robot requires your X server support the XTEST extension version 2.2");
AWT_UNLOCK();
return;
} }
finally:
AWT_UNLOCK(); AWT_UNLOCK();
} }
......
...@@ -112,7 +112,7 @@ jboolean _icon_upcall(JNIEnv *env, jobject this, GdkPixbuf *pixbuf) ...@@ -112,7 +112,7 @@ jboolean _icon_upcall(JNIEnv *env, jobject this, GdkPixbuf *pixbuf)
/* Copy the data array into a Java structure so we can pass it back. */ /* Copy the data array into a Java structure so we can pass it back. */
jbyteArray data = (*env)->NewByteArray(env, (row_stride * height)); jbyteArray data = (*env)->NewByteArray(env, (row_stride * height));
(*env)->SetByteArrayRegion(env, data, 0, (row_stride * height), (*env)->SetByteArrayRegion(env, data, 0, (row_stride * height),
pixbuf_data); (jbyte *)pixbuf_data);
/* Release the pixbuf. */ /* Release the pixbuf. */
(*fp_g_object_unref)(pixbuf); (*fp_g_object_unref)(pixbuf);
......
...@@ -484,8 +484,8 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XkbLibraryVersion ...@@ -484,8 +484,8 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XkbLibraryVersion
(JNIEnv *env, jclass clazz, jlong lib_major_in_out, jlong lib_minor_in_out) (JNIEnv *env, jclass clazz, jlong lib_major_in_out, jlong lib_minor_in_out)
{ {
AWT_CHECK_HAVE_LOCK(); AWT_CHECK_HAVE_LOCK();
*((int *)lib_major_in_out) = XkbMajorVersion; *((int *)jlong_to_ptr(lib_major_in_out)) = XkbMajorVersion;
*((int *)lib_minor_in_out) = XkbMinorVersion; *((int *)jlong_to_ptr(lib_minor_in_out)) = XkbMinorVersion;
return XkbLibraryVersion((int *)jlong_to_ptr(lib_major_in_out), (int *)jlong_to_ptr(lib_minor_in_out)); return XkbLibraryVersion((int *)jlong_to_ptr(lib_major_in_out), (int *)jlong_to_ptr(lib_minor_in_out));
} }
...@@ -1229,7 +1229,6 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_IsKanaKeyboard ...@@ -1229,7 +1229,6 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_IsKanaKeyboard
(JNIEnv *env, jclass clazz, jlong display) (JNIEnv *env, jclass clazz, jlong display)
{ {
int xx; int xx;
AWT_CHECK_HAVE_LOCK();
static jboolean result = JNI_FALSE; static jboolean result = JNI_FALSE;
int32_t minKeyCode, maxKeyCode, keySymsPerKeyCode; int32_t minKeyCode, maxKeyCode, keySymsPerKeyCode;
...@@ -1237,6 +1236,8 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_IsKanaKeyboard ...@@ -1237,6 +1236,8 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_IsKanaKeyboard
int32_t i; int32_t i;
int32_t kanaCount = 0; int32_t kanaCount = 0;
AWT_CHECK_HAVE_LOCK();
// There's no direct way to determine whether the keyboard has // There's no direct way to determine whether the keyboard has
// a kana lock key. From available keyboard mapping tables, it looks // a kana lock key. From available keyboard mapping tables, it looks
// like only keyboards with the kana lock key can produce keysyms // like only keyboards with the kana lock key can produce keysyms
...@@ -1337,12 +1338,14 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_PrintXErrorEvent ...@@ -1337,12 +1338,14 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_PrintXErrorEvent
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XInternAtoms JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XInternAtoms
(JNIEnv *env, jclass clazz, jlong display, jobjectArray names_arr, jboolean only_if_exists, jlong atoms) (JNIEnv *env, jclass clazz, jlong display, jobjectArray names_arr, jboolean only_if_exists, jlong atoms)
{ {
int length = (*env)->GetArrayLength(env, names_arr); int length = (*env)->GetArrayLength(env, names_arr);
char ** names = (char**)malloc(length*sizeof(char*)); char ** names = (char**)malloc(length*sizeof(char*));
jboolean copy; jboolean copy;
int index, name_index = 0; int index, name_index = 0;
int status; int status;
AWT_CHECK_HAVE_LOCK();
for (index = 0; index < length; index++) { for (index = 0; index < length; index++) {
jstring str = (*env)->GetObjectArrayElement(env, names_arr, index); jstring str = (*env)->GetObjectArrayElement(env, names_arr, index);
if (!JNU_IsNull(env, str)) { if (!JNU_IsNull(env, str)) {
...@@ -1352,7 +1355,6 @@ JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XInternAtoms ...@@ -1352,7 +1355,6 @@ JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XInternAtoms
(*env)->DeleteLocalRef(env, str); (*env)->DeleteLocalRef(env, str);
} }
} }
AWT_CHECK_HAVE_LOCK();
status = XInternAtoms((Display*)jlong_to_ptr(display), names, name_index, only_if_exists, (Atom*) jlong_to_ptr(atoms)); status = XInternAtoms((Display*)jlong_to_ptr(display), names, name_index, only_if_exists, (Atom*) jlong_to_ptr(atoms));
for (index = 0; index < length; index++) { for (index = 0; index < length; index++) {
free(names[index]); free(names[index]);
...@@ -2186,12 +2188,12 @@ JNIEXPORT void JNICALL ...@@ -2186,12 +2188,12 @@ JNIEXPORT void JNICALL
Java_sun_awt_X11_XlibWrapper_SetZOrder Java_sun_awt_X11_XlibWrapper_SetZOrder
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong above) (JNIEnv *env, jclass clazz, jlong display, jlong window, jlong above)
{ {
AWT_CHECK_HAVE_LOCK(); unsigned int value_mask = CWStackMode;
XWindowChanges wc; XWindowChanges wc;
wc.sibling = (Window)jlong_to_ptr(above); wc.sibling = (Window)jlong_to_ptr(above);
unsigned int value_mask = CWStackMode; AWT_CHECK_HAVE_LOCK();
if (above == 0) { if (above == 0) {
wc.stack_mode = Above; wc.stack_mode = Above;
...@@ -2219,6 +2221,7 @@ Java_sun_awt_X11_XlibWrapper_SetBitmapShape ...@@ -2219,6 +2221,7 @@ Java_sun_awt_X11_XlibWrapper_SetBitmapShape
jboolean isCopy = JNI_FALSE; jboolean isCopy = JNI_FALSE;
size_t worstBufferSize = (size_t)((width / 2 + 1) * height); size_t worstBufferSize = (size_t)((width / 2 + 1) * height);
RECT_T * pRect; RECT_T * pRect;
int numrects;
AWT_CHECK_HAVE_LOCK(); AWT_CHECK_HAVE_LOCK();
...@@ -2237,7 +2240,7 @@ Java_sun_awt_X11_XlibWrapper_SetBitmapShape ...@@ -2237,7 +2240,7 @@ Java_sun_awt_X11_XlibWrapper_SetBitmapShape
/* Note: the values[0] and values[1] are supposed to contain the width /* Note: the values[0] and values[1] are supposed to contain the width
* and height (see XIconInfo.getIntData() for details). So, we do +2. * and height (see XIconInfo.getIntData() for details). So, we do +2.
*/ */
int numrects = BitmapToYXBandedRectangles(32, (int)width, (int)height, numrects = BitmapToYXBandedRectangles(32, (int)width, (int)height,
(unsigned char *)(values + 2), pRect); (unsigned char *)(values + 2), pRect);
XShapeCombineRectangles((Display *)jlong_to_ptr(display), (Window)jlong_to_ptr(window), XShapeCombineRectangles((Display *)jlong_to_ptr(display), (Window)jlong_to_ptr(window),
......
...@@ -28,12 +28,15 @@ ...@@ -28,12 +28,15 @@
typedef int gboolean; typedef int gboolean;
gboolean (*gnome_url_show) (const char *url, void **error); typedef gboolean (GNOME_URL_SHOW_TYPE)(const char *, void **);
typedef gboolean (GNOME_VFS_INIT_TYPE)(void);
GNOME_URL_SHOW_TYPE *gnome_url_show;
GNOME_VFS_INIT_TYPE *gnome_vfs_init;
int init(){ int init(){
void *vfs_handle; void *vfs_handle;
void *gnome_handle; void *gnome_handle;
gboolean (*gnome_vfs_init) (void);
const char *errmsg; const char *errmsg;
vfs_handle = dlopen("libgnomevfs-2.so.0", RTLD_LAZY); vfs_handle = dlopen("libgnomevfs-2.so.0", RTLD_LAZY);
...@@ -44,7 +47,7 @@ int init(){ ...@@ -44,7 +47,7 @@ int init(){
return 0; return 0;
} }
dlerror(); /* Clear errors */ dlerror(); /* Clear errors */
gnome_vfs_init = dlsym(vfs_handle, "gnome_vfs_init"); gnome_vfs_init = (GNOME_VFS_INIT_TYPE*)dlsym(vfs_handle, "gnome_vfs_init");
if ((errmsg = dlerror()) != NULL) { if ((errmsg = dlerror()) != NULL) {
#ifdef INTERNAL_BUILD #ifdef INTERNAL_BUILD
fprintf(stderr, "can not find symble gnome_vfs_init\n"); fprintf(stderr, "can not find symble gnome_vfs_init\n");
...@@ -62,7 +65,7 @@ int init(){ ...@@ -62,7 +65,7 @@ int init(){
return 0; return 0;
} }
dlerror(); /* Clear errors */ dlerror(); /* Clear errors */
gnome_url_show = dlsym(gnome_handle, "gnome_url_show"); gnome_url_show = (GNOME_URL_SHOW_TYPE*)dlsym(gnome_handle, "gnome_url_show");
if ((errmsg = dlerror()) != NULL) { if ((errmsg = dlerror()) != NULL) {
#ifdef INTERNAL_BUILD #ifdef INTERNAL_BUILD
fprintf(stderr, "can not find symble gnome_url_show\n"); fprintf(stderr, "can not find symble gnome_url_show\n");
...@@ -94,14 +97,15 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XDesktopPeer_gnome_1url_1show ...@@ -94,14 +97,15 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XDesktopPeer_gnome_1url_1show
(JNIEnv *env, jobject obj, jbyteArray url_j) (JNIEnv *env, jobject obj, jbyteArray url_j)
{ {
gboolean success; gboolean success;
const char* url_c;
const char* url_c = (*env)->GetByteArrayElements(env, url_j, NULL); if (gnome_url_show == NULL) {
return JNI_FALSE;
if (gnome_url_show == NULL) return JNI_FALSE; }
url_c = (char*)(*env)->GetByteArrayElements(env, url_j, NULL);
// call gnome_url_show(const char* , GError**) // call gnome_url_show(const char* , GError**)
success = (*gnome_url_show)(url_c, NULL); success = (*gnome_url_show)(url_c, NULL);
(*env)->ReleaseByteArrayElements(env, url_j, (signed char*)url_c, 0); (*env)->ReleaseByteArrayElements(env, url_j, (signed char*)url_c, 0);
return success ? JNI_TRUE : JNI_FALSE; return success ? JNI_TRUE : JNI_FALSE;
......
...@@ -639,7 +639,7 @@ static BOOL IsDCPostscript( HDC hDC ) ...@@ -639,7 +639,7 @@ static BOOL IsDCPostscript( HDC hDC )
if( ::ExtEscape( hDC, GETTECHNOLOGY, 0, NULL, MAX_PATH, if( ::ExtEscape( hDC, GETTECHNOLOGY, 0, NULL, MAX_PATH,
(LPSTR)szTechnology ) <= 0 ) (LPSTR)szTechnology ) <= 0 )
return FALSE; return FALSE;
strupr( szTechnology ); _strupr_s(szTechnology, MAX_PATH);
if(!strstr( szTechnology, "POSTSCRIPT" ) == NULL ) if(!strstr( szTechnology, "POSTSCRIPT" ) == NULL )
return TRUE; return TRUE;
......
...@@ -246,7 +246,7 @@ HRGN BitmapUtil::BitmapToRgn(HBITMAP hBitmap) ...@@ -246,7 +246,7 @@ HRGN BitmapUtil::BitmapToRgn(HBITMAP hBitmap)
UINT height = abs(bi.bmiHeader.biHeight); UINT height = abs(bi.bmiHeader.biHeight);
BYTE * buf = (BYTE*)safe_Malloc(bi.bmiHeader.biSizeImage); BYTE * buf = (BYTE*)safe_Malloc(bi.bmiHeader.biSizeImage);
bi.bmiHeader.biHeight = -height; bi.bmiHeader.biHeight = -(INT)height;
::GetDIBits(hdc, hBitmap, 0, height, buf, ::GetDIBits(hdc, hBitmap, 0, height, buf,
reinterpret_cast<BITMAPINFO*>(&bi), DIB_RGB_COLORS); reinterpret_cast<BITMAPINFO*>(&bi), DIB_RGB_COLORS);
...@@ -305,7 +305,7 @@ HBITMAP BitmapUtil::BlendCopy(HBITMAP hSrcBitmap, COLORREF blendColor, ...@@ -305,7 +305,7 @@ HBITMAP BitmapUtil::BlendCopy(HBITMAP hSrcBitmap, COLORREF blendColor,
UINT height = abs(bi.bmiHeader.biHeight); UINT height = abs(bi.bmiHeader.biHeight);
BYTE * buf = (BYTE*)safe_Malloc(bi.bmiHeader.biSizeImage); BYTE * buf = (BYTE*)safe_Malloc(bi.bmiHeader.biSizeImage);
bi.bmiHeader.biHeight = -height; bi.bmiHeader.biHeight = -(INT)height;
::GetDIBits(hdc, hSrcBitmap, 0, height, buf, ::GetDIBits(hdc, hSrcBitmap, 0, height, buf,
reinterpret_cast<BITMAPINFO*>(&bi), DIB_RGB_COLORS); reinterpret_cast<BITMAPINFO*>(&bi), DIB_RGB_COLORS);
......
...@@ -238,7 +238,7 @@ void AwtDesktopProperties::GetNonClientParameters() { ...@@ -238,7 +238,7 @@ void AwtDesktopProperties::GetNonClientParameters() {
// when running on XP. However this can't be referenced at compile time // when running on XP. However this can't be referenced at compile time
// with the older SDK, so there use 'lfMessageFont' plus its size. // with the older SDK, so there use 'lfMessageFont' plus its size.
if (!IS_WINVISTA) { if (!IS_WINVISTA) {
#if defined(_MSC_VER) && (_MSC_VER >= 1600) { #if defined(_MSC_VER) && (_MSC_VER >= 1600)
ncmetrics.cbSize = offsetof(NONCLIENTMETRICS, iPaddedBorderWidth); ncmetrics.cbSize = offsetof(NONCLIENTMETRICS, iPaddedBorderWidth);
#else #else
ncmetrics.cbSize = offsetof(NONCLIENTMETRICS,lfMessageFont) + sizeof(LOGFONT); ncmetrics.cbSize = offsetof(NONCLIENTMETRICS,lfMessageFont) + sizeof(LOGFONT);
......
...@@ -159,7 +159,8 @@ extern "C" { ...@@ -159,7 +159,8 @@ extern "C" {
void JNICALL DSUnlockAWT(JNIEnv* env); void JNICALL DSUnlockAWT(JNIEnv* env);
_JNI_IMPORT_OR_EXPORT_ _JNI_IMPORT_OR_EXPORT_
jobject JNICALL DSGetComponent(JNIEnv* env, void* platformInfo); jobject JNICALL DSGetComponent(
JNIEnv* env, void* platformInfo);
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
......
...@@ -1189,7 +1189,7 @@ LONG AwtFontCache::DecRefCount(Item* item){ ...@@ -1189,7 +1189,7 @@ LONG AwtFontCache::DecRefCount(Item* item){
AwtFontCache::Item::Item(const WCHAR* s, HFONT f, AwtFontCache::Item* n ) AwtFontCache::Item::Item(const WCHAR* s, HFONT f, AwtFontCache::Item* n )
{ {
name = wcsdup(s); name = _wcsdup(s);
font = f; font = f;
next = n; next = n;
refCount = 1; refCount = 1;
...@@ -1237,7 +1237,7 @@ void CSegTableComponent::Create(LPCWSTR name) ...@@ -1237,7 +1237,7 @@ void CSegTableComponent::Create(LPCWSTR name)
free(m_lpszFontName); free(m_lpszFontName);
m_lpszFontName = NULL; m_lpszFontName = NULL;
} }
m_lpszFontName = wcsdup(name); m_lpszFontName = _wcsdup(name);
DASSERT(m_lpszFontName); DASSERT(m_lpszFontName);
} }
......
...@@ -1050,7 +1050,7 @@ static LPTSTR GetPrinterPort(JNIEnv *env, LPTSTR printer) { ...@@ -1050,7 +1050,7 @@ static LPTSTR GetPrinterPort(JNIEnv *env, LPTSTR printer) {
return NULL; return NULL;
} }
LPTSTR port = wcsdup(info2->pPortName); LPTSTR port = _wcsdup(info2->pPortName);
::GlobalFree(info2); ::GlobalFree(info2);
return port; return port;
} }
......
...@@ -23,16 +23,12 @@ ...@@ -23,16 +23,12 @@
* questions. * questions.
*/ */
#define _JNI_IMPLEMENTATION_
#include "awt.h" #include "awt.h"
#include <signal.h> #include <signal.h>
#include <windowsx.h> #include <windowsx.h>
//#if defined(_DEBUG) && defined(_MSC_VER) && _MSC_VER >= 1000
//#include <crtdbg.h>
//#endif
#define _JNI_IMPLEMENTATION_
#include "awt_DrawingSurface.h" #include "awt_DrawingSurface.h"
#include "awt_AWTEvent.h" #include "awt_AWTEvent.h"
#include "awt_Component.h" #include "awt_Component.h"
...@@ -2224,21 +2220,21 @@ Java_sun_awt_windows_WToolkit_getWindowsVersion(JNIEnv *env, jclass cls) ...@@ -2224,21 +2220,21 @@ Java_sun_awt_windows_WToolkit_getWindowsVersion(JNIEnv *env, jclass cls)
WCHAR szVer[128]; WCHAR szVer[128];
DWORD version = ::GetVersion(); DWORD version = ::GetVersion();
swprintf(szVer, L"0x%x = %ld", version, version); swprintf(szVer, 128, L"0x%x = %ld", version, version);
int l = lstrlen(szVer); int l = lstrlen(szVer);
if (IS_WIN2000) { if (IS_WIN2000) {
if (IS_WINXP) { if (IS_WINXP) {
if (IS_WINVISTA) { if (IS_WINVISTA) {
swprintf(szVer + l, L" (Windows Vista)"); swprintf(szVer + l, 128, L" (Windows Vista)");
} else { } else {
swprintf(szVer + l, L" (Windows XP)"); swprintf(szVer + l, 128, L" (Windows XP)");
} }
} else { } else {
swprintf(szVer + l, L" (Windows 2000)"); swprintf(szVer + l, 128, L" (Windows 2000)");
} }
} else { } else {
swprintf(szVer + l, L" (Unknown)"); swprintf(szVer + l, 128, L" (Unknown)");
} }
return JNU_NewStringPlatform(env, szVer); return JNU_NewStringPlatform(env, szVer);
......
...@@ -269,7 +269,7 @@ Java_sun_awt_Win32FontManager_getEUDCFontFile(JNIEnv *env, jclass cl) { ...@@ -269,7 +269,7 @@ Java_sun_awt_Win32FontManager_getEUDCFontFile(JNIEnv *env, jclass cl) {
//if the fontPath includes %SystemRoot% //if the fontPath includes %SystemRoot%
LPWSTR systemRoot = _wgetenv(L"SystemRoot"); LPWSTR systemRoot = _wgetenv(L"SystemRoot");
if (systemRoot != NULL if (systemRoot != NULL
&& swprintf(tmpPath, L"%s%s", systemRoot, fontPath + 12) != -1) { && swprintf(tmpPath, MAX_PATH, L"%s%s", systemRoot, fontPath + 12) != -1) {
fontPath = tmpPath; fontPath = tmpPath;
} }
else { else {
...@@ -279,7 +279,7 @@ Java_sun_awt_Win32FontManager_getEUDCFontFile(JNIEnv *env, jclass cl) { ...@@ -279,7 +279,7 @@ Java_sun_awt_Win32FontManager_getEUDCFontFile(JNIEnv *env, jclass cl) {
//else to see if it only inludes "EUDC.TTE" //else to see if it only inludes "EUDC.TTE"
WCHAR systemRoot[MAX_PATH + 1]; WCHAR systemRoot[MAX_PATH + 1];
if (GetWindowsDirectory(systemRoot, MAX_PATH + 1) != 0) { if (GetWindowsDirectory(systemRoot, MAX_PATH + 1) != 0) {
swprintf(tmpPath, L"%s\\FONTS\\EUDC.TTE", systemRoot); swprintf(tmpPath, MAX_PATH, L"%s\\FONTS\\EUDC.TTE", systemRoot);
fontPath = tmpPath; fontPath = tmpPath;
} }
else { else {
......
...@@ -219,7 +219,7 @@ AwtWindow::AwtWindow() { ...@@ -219,7 +219,7 @@ AwtWindow::AwtWindow() {
::InitializeCriticalSection(&contentBitmapCS); ::InitializeCriticalSection(&contentBitmapCS);
m_windowType = Type::NORMAL; m_windowType = NORMAL;
m_alwaysOnTop = false; m_alwaysOnTop = false;
} }
...@@ -1016,9 +1016,9 @@ void AwtWindow::InitType(JNIEnv *env, jobject peer) ...@@ -1016,9 +1016,9 @@ void AwtWindow::InitType(JNIEnv *env, jobject peer)
} }
if (strcmp(valueNative, "UTILITY") == 0) { if (strcmp(valueNative, "UTILITY") == 0) {
m_windowType = Type::UTILITY; m_windowType = UTILITY;
} else if (strcmp(valueNative, "POPUP") == 0) { } else if (strcmp(valueNative, "POPUP") == 0) {
m_windowType = Type::POPUP; m_windowType = POPUP;
} }
env->ReleaseStringUTFChars(value, valueNative); env->ReleaseStringUTFChars(value, valueNative);
...@@ -1029,10 +1029,10 @@ void AwtWindow::InitType(JNIEnv *env, jobject peer) ...@@ -1029,10 +1029,10 @@ void AwtWindow::InitType(JNIEnv *env, jobject peer)
void AwtWindow::TweakStyle(DWORD & style, DWORD & exStyle) void AwtWindow::TweakStyle(DWORD & style, DWORD & exStyle)
{ {
switch (GetType()) { switch (GetType()) {
case Type::UTILITY: case UTILITY:
exStyle |= WS_EX_TOOLWINDOW; exStyle |= WS_EX_TOOLWINDOW;
break; break;
case Type::POPUP: case POPUP:
style &= ~WS_OVERLAPPED; style &= ~WS_OVERLAPPED;
style |= WS_POPUP; style |= WS_POPUP;
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册