Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
Automatic merge of client:master into master
Browse files Browse the repository at this point in the history
  • Loading branch information
duke committed Apr 15, 2020
2 parents 63f81c9 + 74b556d commit 616100a
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 42 deletions.
Expand Up @@ -405,15 +405,8 @@ getAllConfigs (JNIEnv *env, int screen, AwtScreenDataPtr screenDataPtr) {
DTRACE_PRINTLN("RENDER extension available");
xrenderLibHandle = dlopen("libXrender.so.1", RTLD_LAZY | RTLD_GLOBAL);

#ifdef MACOSX
#define XRENDER_LIB "/usr/X11/lib/libXrender.dylib"
#else
#define XRENDER_LIB "libXrender.so"
#endif

if (xrenderLibHandle == NULL) {
xrenderLibHandle = dlopen(XRENDER_LIB,
RTLD_LAZY | RTLD_GLOBAL);
xrenderLibHandle = dlopen("libXrender.so", RTLD_LAZY | RTLD_GLOBAL);
}

#if defined(__solaris__)
Expand Down
62 changes: 31 additions & 31 deletions src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -52,7 +52,7 @@ static void PreeditDrawCallback(XIC, XPointer,
XIMPreeditDrawCallbackStruct *);
static void PreeditCaretCallback(XIC, XPointer,
XIMPreeditCaretCallbackStruct *);
#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
static void StatusStartCallback(XIC, XPointer, XPointer);
static void StatusDoneCallback(XIC, XPointer, XPointer);
static void StatusDrawCallback(XIC, XPointer,
Expand All @@ -66,7 +66,7 @@ static void StatusDrawCallback(XIC, XPointer,
#define PreeditDoneIndex 1
#define PreeditDrawIndex 2
#define PreeditCaretIndex 3
#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
#define StatusStartIndex 4
#define StatusDoneIndex 5
#define StatusDrawIndex 6
Expand All @@ -84,14 +84,14 @@ static XIMProc callback_funcs[NCALLBACKS] = {
(XIMProc)PreeditDoneCallback,
(XIMProc)PreeditDrawCallback,
(XIMProc)PreeditCaretCallback,
#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
(XIMProc)StatusStartCallback,
(XIMProc)StatusDoneCallback,
(XIMProc)StatusDrawCallback,
#endif
};

#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
#define MAX_STATUS_LEN 100
typedef struct {
Window w; /*status window id */
Expand Down Expand Up @@ -124,7 +124,7 @@ typedef struct _X11InputMethodData {
XIMCallback *callbacks; /* callback parameters */
jobject x11inputmethod; /* global ref to X11InputMethod instance */
/* associated with the XIC */
#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
StatusWindow *statusWindow; /* our own status window */
#endif
char *lookup_buf; /* buffer used for XmbLookupString */
Expand Down Expand Up @@ -175,7 +175,7 @@ static X11InputMethodData * getX11InputMethodData(JNIEnv *, jobject);
static void setX11InputMethodData(JNIEnv *, jobject, X11InputMethodData *);
static void destroyX11InputMethodData(JNIEnv *, X11InputMethodData *);
static void freeX11InputMethodData(JNIEnv *, X11InputMethodData *);
#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
static Window getParentWindow(Window);
#endif

Expand Down Expand Up @@ -375,7 +375,7 @@ destroyX11InputMethodData(JNIEnv *env, X11InputMethodData *pX11IMData)
static void
freeX11InputMethodData(JNIEnv *env, X11InputMethodData *pX11IMData)
{
#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
if (pX11IMData->statusWindow != NULL){
StatusWindow *sw = pX11IMData->statusWindow;
XFreeGC(awt_display, sw->lightGC);
Expand Down Expand Up @@ -478,15 +478,15 @@ awt_x11inputmethod_lookupString(XKeyPressedEvent *event, KeySym *keysymp)
pX11IMData = getX11InputMethodData(env, currentX11InputMethodInstance);

if (pX11IMData == NULL) {
#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
return False;
#else
return result;
#endif
}

if ((ic = pX11IMData->current_ic) == (XIC)0){
#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
return False;
#else
return result;
Expand Down Expand Up @@ -578,7 +578,7 @@ awt_x11inputmethod_lookupString(XKeyPressedEvent *event, KeySym *keysymp)
return result;
}

#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
static StatusWindow *createStatusWindow(Window parent) {
StatusWindow *statusWindow;
XSetWindowAttributes attrib;
Expand Down Expand Up @@ -852,7 +852,7 @@ static void adjustStatusWindow(Window shell) {
}
}
}
#endif /* __linux__ || MACOSX */
#endif /* __linux__ */

/*
* Creates two XICs, one for active clients and the other for passive
Expand Down Expand Up @@ -898,7 +898,7 @@ createXIC(JNIEnv * env, X11InputMethodData *pX11IMData, Window w)

on_the_spot_styles |= XIMStatusNothing;

#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
/*kinput does not support XIMPreeditCallbacks and XIMStatusArea
at the same time, so use StatusCallback to draw the status
ourself
Expand All @@ -909,7 +909,7 @@ createXIC(JNIEnv * env, X11InputMethodData *pX11IMData, Window w)
break;
}
}
#endif /* __linux__ || MACOSX */
#endif /* __linux__ */

for (i = 0; i < im_styles->count_styles; i++) {
active_styles |= im_styles->supported_styles[i] & on_the_spot_styles;
Expand Down Expand Up @@ -963,7 +963,7 @@ createXIC(JNIEnv * env, X11InputMethodData *pX11IMData, Window w)
NULL);
if (preedit == (XVaNestedList)NULL)
goto err;
#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
/*always try XIMStatusCallbacks for active client...*/
{
status = (XVaNestedList)XVaCreateNestedList(0,
Expand All @@ -985,15 +985,15 @@ createXIC(JNIEnv * env, X11InputMethodData *pX11IMData, Window w)
XFree((void *)status);
XFree((void *)preedit);
}
#else /* !__linux__ && !MACOSX */
#else /* !__linux__ */
pX11IMData->ic_active = XCreateIC(X11im,
XNClientWindow, w,
XNFocusWindow, w,
XNInputStyle, active_styles,
XNPreeditAttributes, preedit,
NULL);
XFree((void *)preedit);
#endif /* __linux__ || MACOSX */
#endif /* __linux__ */
} else {
pX11IMData->ic_active = XCreateIC(X11im,
XNClientWindow, w,
Expand Down Expand Up @@ -1173,7 +1173,7 @@ PreeditCaretCallback(XIC ic, XPointer client_data,
/* printf("Native: PreeditCaretCallback\n"); */
}

#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
static void
StatusStartCallback(XIC ic, XPointer client_data, XPointer call_data)
{
Expand Down Expand Up @@ -1262,7 +1262,7 @@ StatusDrawCallback(XIC ic, XPointer client_data,
finally:
AWT_UNLOCK();
}
#endif /* __linux__ || MACOSX */
#endif /* __linux__ */

static void CommitStringCallback(XIC ic, XPointer client_data, XPointer call_data) {
JNIEnv *env = GetJNIEnv();
Expand Down Expand Up @@ -1356,14 +1356,14 @@ Java_sun_awt_X11_XInputMethod_openXIMNative(JNIEnv *env,
/* Use IMInstantiate call back only on Linux, as there is a bug in Solaris
(4768335)
*/
#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
registered = XRegisterIMInstantiateCallback(dpy, NULL, NULL,
NULL, (XIDProc)OpenXIMCallback, NULL);
if (!registered) {
/* directly call openXIM callback */
#endif
OpenXIMCallback(dpy, NULL, NULL);
#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
}
#endif

Expand Down Expand Up @@ -1398,9 +1398,9 @@ Java_sun_awt_X11_XInputMethod_createXICNative(JNIEnv *env,

globalRef = (*env)->NewGlobalRef(env, this);
pX11IMData->x11inputmethod = globalRef;
#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
pX11IMData->statusWindow = NULL;
#endif /* __linux__ || MACOSX */
#endif /* __linux__ */

pX11IMData->lookup_buf = 0;
pX11IMData->lookup_buf_len = 0;
Expand Down Expand Up @@ -1450,14 +1450,14 @@ Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env,
setXICFocus(pX11IMData->current_ic, req);
currentX11InputMethodInstance = pX11IMData->x11inputmethod;
currentFocusWindow = w;
#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
if (active && pX11IMData->statusWindow && pX11IMData->statusWindow->on)
onoffStatusWindow(pX11IMData, w, True);
#endif
} else {
currentX11InputMethodInstance = NULL;
currentFocusWindow = 0;
#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
onoffStatusWindow(pX11IMData, 0, False);
if (pX11IMData->current_ic != NULL)
#endif
Expand Down Expand Up @@ -1492,7 +1492,7 @@ JNIEXPORT void JNICALL Java_sun_awt_X11InputMethodBase_initIDs
JNIEXPORT void JNICALL Java_sun_awt_X11InputMethodBase_turnoffStatusWindow
(JNIEnv *env, jobject this)
{
#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
X11InputMethodData *pX11IMData;
StatusWindow *statusWindow;

Expand Down Expand Up @@ -1607,7 +1607,7 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11InputMethodBase_setCompositionEnabled
X11InputMethodData *pX11IMData;
char * ret = NULL;
XVaNestedList pr_atrb;
#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
Boolean calledXSetICFocus = False;
#endif

Expand All @@ -1619,7 +1619,7 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11InputMethodBase_setCompositionEnabled
return JNI_FALSE;
}

#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
if (NULL != pX11IMData->statusWindow) {
Window focus = 0;
int revert_to;
Expand Down Expand Up @@ -1647,7 +1647,7 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11InputMethodBase_setCompositionEnabled
NULL);
ret = XSetICValues(pX11IMData->current_ic, XNPreeditAttributes, pr_atrb, NULL);
XFree((void *)pr_atrb);
#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
if (calledXSetICFocus) {
XSetICFocus(pX11IMData->ic_active);
}
Expand Down Expand Up @@ -1714,14 +1714,14 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11InputMethodBase_isCompositionEnabledN
JNIEXPORT void JNICALL Java_sun_awt_X11_XInputMethod_adjustStatusWindow
(JNIEnv *env, jobject this, jlong window)
{
#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
AWT_LOCK();
adjustStatusWindow(window);
AWT_UNLOCK();
#endif
}

#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
static Window getParentWindow(Window w)
{
Window root=None, parent=None, *ignore_children=NULL;
Expand Down
4 changes: 2 additions & 2 deletions src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -50,7 +50,7 @@

#include "java_awt_event_InputEvent.h"

#if defined(__linux__) || defined(MACOSX)
#if defined(__linux__)
#include <sys/socket.h>
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c
Expand Up @@ -906,7 +906,7 @@ handleKeyEventWithNumLockMask(XEvent *event, KeySym *keysym)
{
KeySym originalKeysym = *keysym;

#if !defined(__linux__) && !defined(MACOSX)
#if !defined(__linux__)
/* The following code on Linux will cause the keypad keys
* not to echo on JTextField when the NumLock is on. The
* keysyms will be 0, because the last parameter 2 is not defined.
Expand Down

0 comments on commit 616100a

Please sign in to comment.