Skip to content

8360647: [XWayland] [OL10] NumPad keys are not triggered #26170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions src/java.desktop/unix/native/libawt_xawt/awt/screencast_pipewire.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#ifndef _AIX
#include "screencast_pipewire.h"
#include "java_awt_event_KeyEvent.h"

struct pw_buffer *(*fp_pw_stream_dequeue_buffer)(struct pw_stream *stream);
const char * (*fp_pw_stream_state_as_string)(enum pw_stream_state state);
Expand Down Expand Up @@ -1197,6 +1198,24 @@ JNIEXPORT jint JNICALL Java_sun_awt_screencast_ScreencastHelper_remoteDesktopMou
return result ? RESULT_OK : pw.pwFd;
}

static int getNumpadKey(jint jkey) {
switch (jkey) {
case java_awt_event_KeyEvent_VK_NUMPAD0: return XK_KP_Insert;
case java_awt_event_KeyEvent_VK_NUMPAD1: return XK_KP_End;
case java_awt_event_KeyEvent_VK_NUMPAD2: return XK_KP_Down;
case java_awt_event_KeyEvent_VK_NUMPAD3: return XK_KP_Page_Down;
case java_awt_event_KeyEvent_VK_NUMPAD4: return XK_KP_Left;
case java_awt_event_KeyEvent_VK_NUMPAD5: return XK_KP_Begin;
case java_awt_event_KeyEvent_VK_NUMPAD6: return XK_KP_Right;
case java_awt_event_KeyEvent_VK_NUMPAD7: return XK_KP_Home;
case java_awt_event_KeyEvent_VK_NUMPAD8: return XK_KP_Up;
case java_awt_event_KeyEvent_VK_NUMPAD9: return XK_KP_Prior;
case java_awt_event_KeyEvent_VK_DECIMAL:
case java_awt_event_KeyEvent_VK_SEPARATOR: return XK_KP_Delete;
default: return 0;
}
}

/*
* Class: sun_awt_screencast_ScreencastHelper
* Method: remoteDesktopKeyImpl
Expand All @@ -1205,9 +1224,12 @@ JNIEXPORT jint JNICALL Java_sun_awt_screencast_ScreencastHelper_remoteDesktopMou
JNIEXPORT jint JNICALL Java_sun_awt_screencast_ScreencastHelper_remoteDesktopKeyImpl
(JNIEnv *env, jclass cls, jboolean isPress, jint jkey, jstring jtoken) {

AWT_LOCK();
int key = awt_getX11KeySym(jkey);
AWT_UNLOCK();
int key = getNumpadKey(jkey);
if (!key) {
AWT_LOCK();
key = awt_getX11KeySym(jkey);
AWT_UNLOCK();
}

if (key == NoSymbol || (*env)->ExceptionCheck(env)) {
return RESULT_ERROR;
Expand Down