mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-27 02:30:06 +00:00
7103610: _NET_WM_PID and WM_CLIENT_MACHINE are not set
Set the properties to all top-level windows Reviewed-by: anthony
This commit is contained in:
parent
6a9b345420
commit
ca86a52a6c
@ -322,6 +322,8 @@ SUNWprivate_1.1 {
|
||||
Java_sun_awt_X11_XlibWrapper_XSynchronize;
|
||||
Java_java_awt_FileDialog_initIDs;
|
||||
Java_sun_awt_X11_XWindow_initIDs;
|
||||
Java_sun_awt_X11_XWindowPeer_getLocalHostname;
|
||||
Java_sun_awt_X11_XWindowPeer_getJvmPID;
|
||||
|
||||
Java_sun_java2d_opengl_OGLContext_getOGLIdString;
|
||||
Java_sun_java2d_opengl_OGLMaskFill_maskFill;
|
||||
|
||||
@ -208,12 +208,19 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
return name;
|
||||
}
|
||||
|
||||
private static native String getLocalHostname();
|
||||
private static native int getJvmPID();
|
||||
|
||||
void postInit(XCreateWindowParams params) {
|
||||
super.postInit(params);
|
||||
|
||||
// Init WM_PROTOCOLS atom
|
||||
initWMProtocols();
|
||||
|
||||
// Set _NET_WM_PID and WM_CLIENT_MACHINE using this JVM
|
||||
XAtom.get("WM_CLIENT_MACHINE").setProperty(getWindow(), getLocalHostname());
|
||||
XAtom.get("_NET_WM_PID").setCard32Property(getWindow(), getJvmPID());
|
||||
|
||||
// Set WM_TRANSIENT_FOR and group_leader
|
||||
Window t_window = (Window)target;
|
||||
Window owner = t_window.getOwner();
|
||||
|
||||
@ -47,6 +47,8 @@
|
||||
#include "java_awt_TrayIcon.h"
|
||||
#include <X11/extensions/XTest.h>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
uint32_t awt_NumLockMask = 0;
|
||||
Boolean awt_ModLockIsShiftLock = False;
|
||||
|
||||
@ -1087,3 +1089,38 @@ int32_t getNumButtons() {
|
||||
|
||||
return local_num_buttons;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XWindowPeer
|
||||
* Method: getJvmPID
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_sun_awt_X11_XWindowPeer_getJvmPID
|
||||
(JNIEnv *env, jclass cls)
|
||||
{
|
||||
/* Return the JVM's PID. */
|
||||
return getpid();
|
||||
}
|
||||
|
||||
#ifndef HOST_NAME_MAX
|
||||
#define HOST_NAME_MAX 1024 /* Overestimated */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XWindowPeer
|
||||
* Method: getLocalHostname
|
||||
* Signature: ()Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_sun_awt_X11_XWindowPeer_getLocalHostname
|
||||
(JNIEnv *env, jclass cls)
|
||||
{
|
||||
/* Return the machine's FQDN. */
|
||||
char hostname[HOST_NAME_MAX + 1];
|
||||
if (gethostname(hostname, HOST_NAME_MAX + 1) == 0) {
|
||||
hostname[HOST_NAME_MAX] = '\0';
|
||||
jstring res = (*env)->NewStringUTF(env, hostname);
|
||||
return res;
|
||||
}
|
||||
|
||||
return (jstring)NULL;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user