mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2026-01-03 15:11:41 +01:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b65d2d228 | ||
|
|
474629f98a | ||
|
|
76c483eec1 | ||
|
|
7685c6b5f9 | ||
|
|
6a1c5bd43a | ||
|
|
5e738482b1 | ||
|
|
17556b0ea3 | ||
|
|
7dda83bf0b | ||
|
|
ca1889e682 | ||
|
|
258cf006bc | ||
|
|
a240282285 | ||
|
|
edfe753192 | ||
|
|
7d8ca546f4 | ||
|
|
b9d1c0e801 | ||
|
|
d47223ddd9 | ||
|
|
862b0d9195 | ||
|
|
0457603fb6 | ||
|
|
12c88c770d | ||
|
|
ac57aef98b | ||
|
|
40da69a5fb | ||
|
|
e4596e18e9 |
@@ -8,15 +8,36 @@
|
||||
FROM arm64v8/alpine:3.12
|
||||
|
||||
# Install the necessary build tools
|
||||
RUN apk --no-cache add --update bash grep tar zip bzip2 rsync fontconfig build-base \
|
||||
git libx11-dev libxext-dev libxrandr-dev libxrender-dev libxt-dev \
|
||||
libxtst-dev autoconf freetype-dev cups-dev alsa-lib-dev file \
|
||||
fontconfig fontconfig-dev linux-headers
|
||||
RUN apk --no-cache add --update \
|
||||
alsa-lib-dev=1.2.2-r0 \
|
||||
autoconf=2.69-r2 \
|
||||
bash=5.0.17-r0 \
|
||||
build-base=0.5-r2 \
|
||||
bzip2=1.0.8-r1 \
|
||||
cups-dev=2.3.3-r0 \
|
||||
file=5.38-r0 \
|
||||
fontconfig=2.13.1-r2 \
|
||||
fontconfig-dev=2.13.1-r2 \
|
||||
freetype-dev=2.10.4-r2 \
|
||||
git=2.26.3-r1 \
|
||||
grep=3.4-r0 \
|
||||
libx11-dev=1.6.12-r1 \
|
||||
libxext-dev=1.3.4-r0 \
|
||||
libxrandr-dev=1.5.2-r0 \
|
||||
libxrender-dev=0.9.10-r3 \
|
||||
libxt-dev=1.2.0-r0 \
|
||||
libxtst-dev=1.2.3-r3 \
|
||||
linux-headers=5.4.5-r1 \
|
||||
rsync=3.1.3-r3 \
|
||||
tar=1.32-r2 \
|
||||
wayland-dev=1.18.0-r4 \
|
||||
zip=3.0-r8
|
||||
|
||||
|
||||
# Set up boot JDK for building
|
||||
COPY boot_jdk_musl_aarch64.tar.gz /jdk17/
|
||||
RUN cd /jdk17 && tar --strip-components=1 -xzf boot_jdk_musl_aarch64.tar.gz && rm /jdk17/boot_jdk_musl_aarch64.tar.gz
|
||||
ENV BOOT_JDK=/jdk17
|
||||
COPY boot_jdk_musl_aarch64.tar.gz /jdk20/
|
||||
RUN cd /jdk20 && tar --strip-components=1 -xzf boot_jdk_musl_aarch64.tar.gz && rm /jdk20/boot_jdk_musl_aarch64.tar.gz
|
||||
ENV BOOT_JDK=/jdk20
|
||||
|
||||
RUN git config --global user.email "teamcity@jetbrains.com" && \
|
||||
git config --global user.name "builduser"
|
||||
|
||||
@@ -8,15 +8,35 @@
|
||||
FROM alpine:3.14
|
||||
|
||||
# Install the necessary build tools
|
||||
RUN apk --no-cache add --update bash grep tar zip bzip2 rsync fontconfig build-base \
|
||||
git libx11-dev libxext-dev libxrandr-dev libxrender-dev libxt-dev \
|
||||
libxtst-dev autoconf freetype-dev cups-dev alsa-lib-dev file \
|
||||
fontconfig fontconfig-dev linux-headers
|
||||
RUN apk --no-cache add --update \
|
||||
alsa-lib-dev=1.2.5-r2 \
|
||||
autoconf=2.71-r0 \
|
||||
bash=5.1.16-r0 \
|
||||
build-base=0.5-r3 \
|
||||
bzip2=1.0.8-r1 \
|
||||
cups-dev=2.3.3-r3 \
|
||||
file=5.40-r1 \
|
||||
fontconfig=2.13.1-r4 \
|
||||
fontconfig-dev=2.13.1-r4 \
|
||||
freetype-dev=2.10.4-r3 \
|
||||
git=2.32.7-r0 \
|
||||
grep=3.7-r0 \
|
||||
libx11-dev=1.7.3.1-r0 \
|
||||
libxext-dev=1.3.4-r0 \
|
||||
libxrandr-dev=1.5.2-r1 \
|
||||
libxrender-dev=0.9.10-r3 \
|
||||
libxt-dev=1.2.1-r0 \
|
||||
libxtst-dev=1.2.3-r3 \
|
||||
linux-headers=5.10.41-r0 \
|
||||
rsync=3.2.5-r0 \
|
||||
tar=1.34-r1 \
|
||||
wayland-dev=1.19.0-r0 \
|
||||
zip=3.0-r9
|
||||
|
||||
# Set up boot JDK for building
|
||||
COPY boot_jdk_musl_amd64.tar.gz /jdk17/
|
||||
RUN cd /jdk17 && tar --strip-components=1 -xzf boot_jdk_musl_amd64.tar.gz && rm /jdk17/boot_jdk_musl_amd64.tar.gz
|
||||
ENV BOOT_JDK=/jdk17
|
||||
COPY boot_jdk_musl_amd64.tar.gz /jdk20/
|
||||
RUN cd /jdk20 && tar --strip-components=1 -xzf boot_jdk_musl_amd64.tar.gz && rm /jdk20/boot_jdk_musl_amd64.tar.gz
|
||||
ENV BOOT_JDK=/jdk20
|
||||
|
||||
RUN git config --global user.email "teamcity@jetbrains.com" && \
|
||||
git config --global user.name "builduser"
|
||||
|
||||
@@ -25,7 +25,8 @@ RUN yum -y install centos-release-scl; \
|
||||
wayland-devel-1.15.0-1.el7 \
|
||||
wget-1.14-18.el7_6.1 \
|
||||
which-2.20-7.el7 \
|
||||
zip-3.0-11.el7
|
||||
zip-3.0-11.el7 \
|
||||
python3-3.6.8-17.el7
|
||||
|
||||
RUN mkdir .git && \
|
||||
git config user.email "teamcity@jetbrains.com" && \
|
||||
@@ -33,4 +34,40 @@ RUN mkdir .git && \
|
||||
|
||||
ENV LD_LIBRARY_PATH="/opt/rh/devtoolset-10/root/usr/lib64:/opt/rh/devtoolset-10/root/usr/lib:/opt/rh/devtoolset-10/root/usr/lib64/dyninst:/opt/rh/devtoolset-10/root/usr/lib/dyninst:/opt/rh/devtoolset-10/root/usr/lib64:/opt/rh/devtoolset-10/root/usr/lib"
|
||||
ENV PATH="/opt/rh/devtoolset-10/root/usr/bin::${PATH}"
|
||||
ENV PKG_CONFIG_PATH="/opt/rh/devtoolset-10/root/usr/lib64/pkgconfig"
|
||||
ENV PKG_CONFIG_PATH="/opt/rh/devtoolset-10/root/usr/lib64/pkgconfig"
|
||||
|
||||
# Build GLSLC
|
||||
RUN curl -OL https://github.com/Kitware/CMake/releases/download/v3.27.5/cmake-3.27.5-linux-x86_64.tar.gz \
|
||||
&& echo 138c68addae825b16ed78d792dafef5e0960194833f48bd77e7e0429c6bc081c *cmake-3.27.5-linux-x86_64.tar.gz | sha256sum -c - \
|
||||
&& tar -xzf cmake-3.27.5-linux-x86_64.tar.gz \
|
||||
&& rm cmake-3.27.5-linux-x86_64.tar.gz \
|
||||
&& git clone https://github.com/google/shaderc --branch v2023.6 \
|
||||
&& cd shaderc \
|
||||
&& ./utils/git-sync-deps \
|
||||
&& mkdir build \
|
||||
&& cd build \
|
||||
&& /cmake-3.27.5-linux-x86_64/bin/cmake \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr/local \
|
||||
-DSHADERC_SKIP_TESTS=ON \
|
||||
-DSHADERC_SKIP_EXAMPLES=ON \
|
||||
-DSHADERC_SKIP_COPYRIGHT_CHECK=ON \
|
||||
.. \
|
||||
&& make install
|
||||
ENV PATH="/cmake-3.27.5-linux-x86_64/bin::${PATH}"
|
||||
|
||||
# Checkout Vulkan headers
|
||||
RUN mkdir /vulkan \
|
||||
&& cd /vulkan \
|
||||
&& git init \
|
||||
&& git remote add -f origin https://github.com/KhronosGroup/Vulkan-Headers.git \
|
||||
&& git fetch origin \
|
||||
&& git checkout v1.3.265 -- include \
|
||||
&& rm -r .git \
|
||||
&& mkdir /vulkan_hpp \
|
||||
&& cd /vulkan_hpp \
|
||||
&& git init \
|
||||
&& git remote add -f origin https://github.com/KhronosGroup/Vulkan-Hpp.git \
|
||||
&& git fetch origin \
|
||||
&& git checkout v1.3.265 -- vulkan \
|
||||
&& rm -r .git
|
||||
|
||||
@@ -4,10 +4,10 @@ set -euo pipefail
|
||||
set -x
|
||||
|
||||
# This script creates a Docker image suitable for building musl AArch64 variant
|
||||
# of the JetBrains Runtime version 17.
|
||||
# of the JetBrains Runtime version 21.
|
||||
|
||||
BOOT_JDK_REMOTE_FILE=zulu17.32.13-ca-jdk17.0.2-linux_musl_aarch64.tar.gz
|
||||
BOOT_JDK_SHA=6b920559abafbe9bdef386a20ecf3a2f318bc1f0d8359eb1f95aee26606bbc70
|
||||
BOOT_JDK_REMOTE_FILE=zulu20.32.11-ca-jdk20.0.2-linux_musl_aarch64.tar.gz
|
||||
BOOT_JDK_SHA=eec57cf744c2438f695221f041d4804de3033ad33b6dba769d3359813ba3f90d
|
||||
BOOT_JDK_LOCAL_FILE=boot_jdk_musl_aarch64.tar.gz
|
||||
|
||||
if [ ! -f $BOOT_JDK_LOCAL_FILE ]; then
|
||||
@@ -22,7 +22,7 @@ sha256sum -c - <<EOF
|
||||
$BOOT_JDK_SHA *$BOOT_JDK_LOCAL_FILE
|
||||
EOF
|
||||
|
||||
docker build -t jbr17buildenv -f Dockerfile.musl_aarch64 .
|
||||
docker build -t jetbrains/runtime:jbr21env_musl_aarch64 -f Dockerfile.musl_aarch64 .
|
||||
|
||||
# NB: the resulting container can (and should) be used without the network
|
||||
# connection (--network none) during build in order to reduce the chance
|
||||
|
||||
@@ -4,10 +4,10 @@ set -euo pipefail
|
||||
set -x
|
||||
|
||||
# This script creates a Docker image suitable for building musl-x64 variant
|
||||
# of the JetBrains Runtime version 17.
|
||||
# of the JetBrains Runtime version 21.
|
||||
|
||||
BOOT_JDK_REMOTE_FILE=zulu17.32.13-ca-jdk17.0.2-linux_musl_x64.tar.gz
|
||||
BOOT_JDK_SHA=bcc5342011bd9f3643372aadbdfa68d47463ff0d8621668a0bdf2910614d95c6
|
||||
BOOT_JDK_REMOTE_FILE=zulu20.32.11-ca-jdk20.0.2-linux_musl_x64.tar.gz
|
||||
BOOT_JDK_SHA=fca5081dd6da847fcd06f5b755e58edae22d6784f21b81bf73da2b538f842c07
|
||||
BOOT_JDK_LOCAL_FILE=boot_jdk_musl_amd64.tar.gz
|
||||
|
||||
if [ ! -f $BOOT_JDK_LOCAL_FILE ]; then
|
||||
@@ -22,7 +22,7 @@ sha256sum -c - <<EOF
|
||||
$BOOT_JDK_SHA *$BOOT_JDK_LOCAL_FILE
|
||||
EOF
|
||||
|
||||
docker build -t jbr17buildenv -f Dockerfile.musl_x64 .
|
||||
docker build -t jetbrains/runtime:jbr21env_musl_x64 -f Dockerfile.musl_x64 .
|
||||
|
||||
# NB: the resulting container can (and should) be used without the network
|
||||
# connection (--network none) during build in order to reduce the chance
|
||||
|
||||
@@ -34,6 +34,9 @@ AC_DEFUN_ONCE([LIB_SETUP_WAYLAND],
|
||||
(expecting the headers under PATH/include)])])
|
||||
AC_ARG_WITH(wayland-include, [AS_HELP_STRING([--with-wayland-include],
|
||||
[specify directory for the wayland include files])])
|
||||
AC_ARG_WITH(wayland-lib, [AS_HELP_STRING([--with-wayland-lib],
|
||||
[specify directory for the wayland library files])])
|
||||
|
||||
|
||||
if test "x$NEEDS_LIB_WAYLAND" = xfalse; then
|
||||
if (test "x${with_wayland}" != x && test "x${with_wayland}" != xno) || \
|
||||
@@ -73,6 +76,10 @@ AC_DEFUN_ONCE([LIB_SETUP_WAYLAND],
|
||||
AC_MSG_ERROR([Can't find 'wayland-client.h' and 'wayland-cursor.h' under ${with_wayland_include} given with the --with-wayland-include option.])
|
||||
fi
|
||||
fi
|
||||
if test "x${with_wayland_lib}" != x; then
|
||||
WAYLAND_LIBS="-L${with_wayland_lib} -lwayland-client -lwayland-cursor"
|
||||
fi
|
||||
|
||||
if test "x$WAYLAND_FOUND" = xno; then
|
||||
# Are the wayland headers installed in the default /usr/include location?
|
||||
AC_CHECK_HEADERS([wayland-client.h wayland-cursor.h],
|
||||
@@ -97,7 +104,10 @@ AC_DEFUN_ONCE([LIB_SETUP_WAYLAND],
|
||||
[specify whether we use vulkan])])
|
||||
|
||||
AC_ARG_WITH(vulkan-include, [AS_HELP_STRING([--with-vulkan-include],
|
||||
[specify directory for the vulkan include files])])
|
||||
[specify directory for the vulkan include files ({with-vulkan-include}/vulkan/vulkan.h)])])
|
||||
|
||||
AC_ARG_WITH(vulkan-hpp, [AS_HELP_STRING([--with-vulkan-hpp],
|
||||
[specify directory for the vulkan-hpp include files ({with-vulkan-hpp}/vulkan/vulkan_raii.hpp)])])
|
||||
|
||||
AC_ARG_WITH(vulkan-shader-compiler, [AS_HELP_STRING([--with-vulkan-shader-compiler],
|
||||
[specify which shader compiler to use: glslc/glslangValidator])])
|
||||
@@ -120,17 +130,36 @@ AC_DEFUN_ONCE([LIB_SETUP_WAYLAND],
|
||||
VULKAN_FOUND=no
|
||||
|
||||
if test "x${with_vulkan_include}" != x; then
|
||||
AC_CHECK_HEADERS([${with_vulkan_include}/include/vulkan/vulkan.h],
|
||||
[ VULKAN_FOUND=yes
|
||||
VULKAN_FLAGS="-DVK_USE_PLATFORM_WAYLAND_KHR -I${with_vulkan_include}/include -DVULKAN_ENABLED"
|
||||
],
|
||||
[ AC_MSG_ERROR([Can't find 'vulkan/vulkan.h' under '${with_vulkan_include}']) ]
|
||||
)
|
||||
AC_MSG_CHECKING([for vulkan.h])
|
||||
if test -s "${with_vulkan_include}/vulkan/vulkan.h"; then
|
||||
VULKAN_FOUND=yes
|
||||
VULKAN_FLAGS="-DVK_USE_PLATFORM_WAYLAND_KHR -I${with_vulkan_include} -DVULKAN_ENABLED"
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([Can't find 'vulkan/vulkan.h' under '${with_vulkan_include}'])
|
||||
fi
|
||||
AC_MSG_CHECKING([for vulkan_raii.hpp])
|
||||
if test "x${with_vulkan_hpp}" != x; then
|
||||
VULKAN_FLAGS="-I${with_vulkan_hpp} ${VULKAN_FLAGS}"
|
||||
VULKAN_HPP_DIR=${with_vulkan_hpp}
|
||||
else
|
||||
VULKAN_HPP_DIR=${with_vulkan_include}
|
||||
fi
|
||||
if test -s "$VULKAN_HPP_DIR/vulkan/vulkan_raii.hpp"; then
|
||||
VULKAN_FOUND=yes
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
VULKAN_FOUND=no
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([Can't find 'vulkan/vulkan_raii.hpp' under '$VULKAN_HPP_DIR'])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
if test "x$VULKAN_FOUND" = xno; then
|
||||
# Check vulkan sdk location
|
||||
AC_CHECK_HEADERS([$VULKAN_SDK/include/vulkan/vulkan.h],
|
||||
AC_CHECK_HEADERS([$VULKAN_SDK/include/vulkan/vulkan.h $VULKAN_SDK/include/vulkan/vulkan_raii.hpp],
|
||||
[ VULKAN_FOUND=yes
|
||||
VULKAN_FLAGS="-DVK_USE_PLATFORM_WAYLAND_KHR -I${VULKAN_SDK}/include -DVULKAN_ENABLED"
|
||||
],
|
||||
@@ -140,13 +169,14 @@ AC_DEFUN_ONCE([LIB_SETUP_WAYLAND],
|
||||
|
||||
if test "x$VULKAN_FOUND" = xno; then
|
||||
# Check default /usr/include location
|
||||
AC_CHECK_HEADERS([vulkan/vulkan.h],
|
||||
AC_CHECK_HEADERS([vulkan/vulkan.h vulkan/vulkan_raii.hpp],
|
||||
[ VULKAN_FOUND=yes
|
||||
VULKAN_FLAGS="-DVK_USE_PLATFORM_WAYLAND_KHR -DVULKAN_ENABLED"
|
||||
],
|
||||
[ VULKAN_FOUND=no; break ]
|
||||
)
|
||||
fi
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
if test "x$VULKAN_FOUND" = xno; then
|
||||
HELP_MSG_MISSING_DEPENDENCY([vulkan])
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#import "JNIUtilities.h"
|
||||
#import "jni_util.h"
|
||||
#import "PropertiesUtilities.h"
|
||||
#import "sun_lwawt_macosx_CPlatformWindow.h"
|
||||
|
||||
#import <Carbon/Carbon.h>
|
||||
|
||||
@@ -850,7 +851,7 @@ static void debugPrintNSEvent(NSEvent* event, const char* comment) {
|
||||
- (BOOL)replaceAccessibleTextSelection:(NSString *)text
|
||||
{
|
||||
id focused = [self accessibilityFocusedUIElement];
|
||||
if (![focused respondsToSelector:@selector(setAccessibilitySelectedText)]) return NO;
|
||||
if (![focused respondsToSelector:@selector(setAccessibilitySelectedText:)]) return NO;
|
||||
[focused setAccessibilitySelectedText:text];
|
||||
return YES;
|
||||
}
|
||||
@@ -1096,6 +1097,43 @@ static jclass jc_CInputMethod = NULL;
|
||||
#define GET_CIM_CLASS_RETURN(ret) \
|
||||
GET_CLASS_RETURN(jc_CInputMethod, "sun/lwawt/macosx/CInputMethod", ret);
|
||||
|
||||
- (NSInteger) windowLevel
|
||||
{
|
||||
#ifdef IM_DEBUG
|
||||
fprintf(stderr, "AWTView InputMethod Selector Called : [windowLevel]\n");
|
||||
#endif // IM_DEBUG
|
||||
|
||||
NSWindow* const ownerWindow = [self window];
|
||||
if (ownerWindow == nil) {
|
||||
return NSNormalWindowLevel;
|
||||
}
|
||||
|
||||
const NSWindowLevel ownerWindowLevel = [ownerWindow level];
|
||||
if ( (ownerWindowLevel != NSNormalWindowLevel) && (ownerWindowLevel != NSFloatingWindowLevel) ) {
|
||||
// the window level has been overridden, let's believe it
|
||||
return ownerWindowLevel;
|
||||
}
|
||||
|
||||
AWTWindow* const delegate = (AWTWindow*)[ownerWindow delegate];
|
||||
if (delegate == nil) {
|
||||
return ownerWindowLevel;
|
||||
}
|
||||
|
||||
const jint styleBits = [delegate styleBits];
|
||||
|
||||
const BOOL isPopup = ( (styleBits & sun_lwawt_macosx_CPlatformWindow_IS_POPUP) != 0 );
|
||||
if (isPopup) {
|
||||
return NSPopUpMenuWindowLevel;
|
||||
}
|
||||
|
||||
const BOOL isModal = ( (styleBits & sun_lwawt_macosx_CPlatformWindow_IS_MODAL) != 0 );
|
||||
if (isModal) {
|
||||
return NSFloatingWindowLevel;
|
||||
}
|
||||
|
||||
return ownerWindowLevel;
|
||||
}
|
||||
|
||||
- (void) insertText:(id)aString replacementRange:(NSRange)replacementRange
|
||||
{
|
||||
#ifdef IM_DEBUG
|
||||
|
||||
@@ -87,7 +87,11 @@ BOOL isColorMatchingEnabled() {
|
||||
[actions release];
|
||||
self.topInset = 0;
|
||||
self.leftInset = 0;
|
||||
self.framebufferOnly = YES;
|
||||
|
||||
// Validation with MTL_DEBUG_LAYER=1 environment variable
|
||||
// prohibits blit operations on to the drawable texture
|
||||
// obtained from a MTLLayer with framebufferOnly=YES
|
||||
self.framebufferOnly = NO;
|
||||
self.nextDrawableCount = 0;
|
||||
self.opaque = YES;
|
||||
self.redrawCount = 0;
|
||||
|
||||
418
src/java.desktop/unix/classes/sun/awt/wl/WLClipboard.java
Normal file
418
src/java.desktop/unix/classes/sun/awt/wl/WLClipboard.java
Normal file
@@ -0,0 +1,418 @@
|
||||
/*
|
||||
* Copyright 2023 JetBrains s.r.o.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* 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.
|
||||
*/
|
||||
package sun.awt.wl;
|
||||
|
||||
import jdk.internal.misc.InnocuousThread;
|
||||
import sun.awt.datatransfer.DataTransferer;
|
||||
import sun.awt.datatransfer.SunClipboard;
|
||||
import sun.util.logging.PlatformLogger;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
import java.awt.datatransfer.DataFlavor;
|
||||
import java.awt.datatransfer.FlavorTable;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.SortedMap;
|
||||
|
||||
public final class WLClipboard extends SunClipboard {
|
||||
private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.wl.WLClipboard");
|
||||
|
||||
public static final int INITIAL_MIME_FORMATS_COUNT = 10;
|
||||
private static final int DEFAULT_BUFFER_SIZE = 4096;
|
||||
private static final int MAX_BUFFER_SIZE = Integer.MAX_VALUE - 8;
|
||||
|
||||
// A native handle of a Wayland queue dedicated to handling
|
||||
// data offer-related events
|
||||
private static final long dataOfferQueuePtr;
|
||||
|
||||
private final long ID;
|
||||
|
||||
// true if this is the "primary selection" clipboard,
|
||||
// false otherwise (the regular clipboard).
|
||||
private final boolean isPrimary; // used by native
|
||||
|
||||
// A handle to the native clipboard representation, 0 if not available.
|
||||
private long clipboardNativePtr; // guarded by 'this'
|
||||
|
||||
// The list of numeric format IDs the current clipboard is available in;
|
||||
// could be null or empty.
|
||||
private List<Long> clipboardFormats; // guarded by 'this'
|
||||
|
||||
// The "current" list formats for the new clipboard contents that is about
|
||||
// to be received from Wayland. Could be empty, but never null.
|
||||
private List<Long> newClipboardFormats = new ArrayList<>(INITIAL_MIME_FORMATS_COUNT); // guarded by 'this'
|
||||
|
||||
static {
|
||||
initIDs();
|
||||
dataOfferQueuePtr = createDataOfferQueue();
|
||||
flavorTable = DataTransferer.adaptFlavorMap(getDefaultFlavorTable());
|
||||
|
||||
final Thread toolkitSystemThread = InnocuousThread.newThread(
|
||||
"AWT-Wayland-clipboard-dispatcher",
|
||||
WLClipboard::dispatchDataOfferQueue);
|
||||
toolkitSystemThread.setDaemon(true);
|
||||
toolkitSystemThread.start();
|
||||
}
|
||||
|
||||
private final static FlavorTable flavorTable;
|
||||
|
||||
public WLClipboard(String name, boolean isPrimary) {
|
||||
super(name);
|
||||
this.ID = initNative(isPrimary);
|
||||
this.isPrimary = isPrimary;
|
||||
|
||||
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
log.fine("Clipboard: Created " + this);
|
||||
}
|
||||
}
|
||||
|
||||
private static void dispatchDataOfferQueue() {
|
||||
dispatchDataOfferQueueImpl(dataOfferQueuePtr); // does not return until error or server disconnect
|
||||
if (log.isLoggable(PlatformLogger.Level.INFO)) {
|
||||
log.info("Clipboard: data offer dispatcher exited");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("Clipboard: Wayland %s (%x)", (isPrimary ? "selection clipboard" : "clipboard"), ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getID() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when we loose ownership of the clipboard.
|
||||
*/
|
||||
@Override
|
||||
protected void clearNativeContext() {
|
||||
// Unused in the Wayland clipboard as we don't (and can't) keep
|
||||
// any references to the native clipboard once we have lost keyboard focus.
|
||||
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
log.fine("Clipboard: Lost ownership of our clipboard");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to make the new clipboard contents known to Wayland.
|
||||
*
|
||||
* @param contents clipboard's contents.
|
||||
*/
|
||||
@Override
|
||||
protected void setContentsNative(Transferable contents) {
|
||||
// The server requires "serial number of the event that triggered this request"
|
||||
// as a proof of the right to copy data.
|
||||
WLPointerEvent wlPointerEvent = WLToolkit.getInputState().eventWithSerial();
|
||||
long eventSerial = wlPointerEvent == null ? 0 : wlPointerEvent.getSerial();
|
||||
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
log.fine("Clipboard: About to offer new contents using Wayland event serial " + eventSerial);
|
||||
}
|
||||
if (eventSerial != 0) {
|
||||
WLDataTransferer wlDataTransferer = (WLDataTransferer) DataTransferer.getInstance();
|
||||
long[] formats = wlDataTransferer.getFormatsForTransferableAsArray(contents, flavorTable);
|
||||
|
||||
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
log.fine("Clipboard: New one is available in these integer formats: " + Arrays.toString(formats));
|
||||
}
|
||||
notifyOfNewFormats(formats);
|
||||
|
||||
if (formats.length > 0) {
|
||||
String[] mime = new String[formats.length];
|
||||
for (int i = 0; i < formats.length; i++) {
|
||||
mime[i] = wlDataTransferer.getNativeForFormat(formats[i]);
|
||||
}
|
||||
|
||||
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
log.fine("Clipboard: Offering new contents (" + contents + ") in these MIME formats: " + Arrays.toString(mime));
|
||||
}
|
||||
|
||||
offerData(eventSerial, mime, contents, dataOfferQueuePtr);
|
||||
|
||||
// Once we have offered the data, someone may come back and ask to provide them.
|
||||
// In that event, the transferContentsWithType() will be called from native on EDT.
|
||||
// A reference to contents is retained until we are notified of the new contents
|
||||
// by the Wayland server.
|
||||
}
|
||||
} else {
|
||||
this.owner = null;
|
||||
this.contents = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from native on EDT when a client has asked to provide the actual data for
|
||||
* the clipboard that we own in the given format to the given file.
|
||||
* NB: that client could be us, but we aren't necessarily aware of that once we
|
||||
* lost keyboard focus at least once after Ctrl-C.
|
||||
*
|
||||
* @param contents a reference to the clipboard's contents to be transferred
|
||||
* @param mime transfer the contents in this MIME format
|
||||
* @param destFD transfer the contents to this file descriptor and close it afterward
|
||||
*
|
||||
* @throws IOException in case writing to the given file descriptor failed
|
||||
*/
|
||||
private void transferContentsWithType(Transferable contents, String mime, int destFD) throws IOException {
|
||||
assert SwingUtilities.isEventDispatchThread();
|
||||
Objects.requireNonNull(contents);
|
||||
Objects.requireNonNull(mime);
|
||||
|
||||
WLDataTransferer wlDataTransferer = (WLDataTransferer) DataTransferer.getInstance();
|
||||
SortedMap<Long,DataFlavor> formatMap =
|
||||
wlDataTransferer.getFormatsForTransferable(contents, flavorTable);
|
||||
|
||||
long targetFormat = wlDataTransferer.getFormatForNativeAsLong(mime);
|
||||
DataFlavor flavor = formatMap.get(targetFormat);
|
||||
|
||||
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
log.fine("Clipboard: will write contents (" + contents + ") in format " + mime + " to fd=" + destFD);
|
||||
log.fine("Clipboard: data flavor: " + flavor);
|
||||
}
|
||||
|
||||
if (flavor != null) {
|
||||
FileDescriptor javaDestFD = new FileDescriptor();
|
||||
jdk.internal.access.SharedSecrets.getJavaIOFileDescriptorAccess().set(javaDestFD, destFD);
|
||||
|
||||
try (var out = new FileOutputStream(javaDestFD)) {
|
||||
byte[] bytes = wlDataTransferer.translateTransferable(contents, flavor, targetFormat);
|
||||
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
log.fine("Clipboard: about to write " + (bytes != null ? bytes.length : 0) + " bytes to " + out);
|
||||
}
|
||||
// TODO: large data transfer will block EDT for a long time.
|
||||
// Implement an option to do the writing on a dedicated thread.
|
||||
// Alternatively, arrange for this event to arrive on a dedicated queue and
|
||||
// only work with this queue on a dedicated thread.
|
||||
out.write(bytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return formats the current clipboard is available in; could be null
|
||||
*/
|
||||
@Override
|
||||
protected long[] getClipboardFormats() {
|
||||
synchronized (this) {
|
||||
if (clipboardFormats != null && !clipboardFormats.isEmpty()) {
|
||||
long[] res = new long[clipboardFormats.size()];
|
||||
for (int i = 0; i < res.length; i++) {
|
||||
res[i] = clipboardFormats.get(i);
|
||||
}
|
||||
return res;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The clipboard contents in the given numeric format ID.
|
||||
*
|
||||
* @param format the numeric ID of the format to provide clipboard contents in
|
||||
* @return contents in the given numeric format ID
|
||||
* @throws IOException when reading from the clipboard file fails
|
||||
*/
|
||||
@Override
|
||||
protected byte[] getClipboardData(long format) throws IOException {
|
||||
synchronized (this) {
|
||||
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
log.fine("Clipboard: requested content of clipboard with handle "
|
||||
+ clipboardNativePtr + " in format " + format);
|
||||
}
|
||||
if (clipboardNativePtr != 0) {
|
||||
WLDataTransferer wlDataTransferer = (WLDataTransferer) DataTransferer.getInstance();
|
||||
String mime = wlDataTransferer.getNativeForFormat(format);
|
||||
int fd = requestDataInFormat(clipboardNativePtr, mime);
|
||||
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
log.fine("Clipboard: will read data from " + fd + " in format " + mime);
|
||||
}
|
||||
if (fd >= 0) {
|
||||
FileDescriptor javaFD = new FileDescriptor();
|
||||
jdk.internal.access.SharedSecrets.getJavaIOFileDescriptorAccess().set(javaFD, fd);
|
||||
try (var in = new FileInputStream(javaFD)) {
|
||||
byte[] bytes = readAllBytesFrom(in);
|
||||
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
log.fine("Clipboard: read data from " + fd + ": "
|
||||
+ (bytes != null ? bytes.length : 0) + " bytes");
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from native to notify us of the availability of a new clipboard
|
||||
* denoted by the native handle in a specific MIME format.
|
||||
* This method is usually called repeatedly with the same nativePtr and
|
||||
* different formats. When all formats are announces in this way,
|
||||
* handleNewClipboard() is called.
|
||||
*
|
||||
* @param nativePtr a native handle to the clipboard
|
||||
* @param mime the MIME format in which this clipboard is available.
|
||||
*/
|
||||
private void handleClipboardFormat(long nativePtr, String mime) {
|
||||
WLDataTransferer wlDataTransferer = (WLDataTransferer) DataTransferer.getInstance();
|
||||
Long format = wlDataTransferer.getFormatForNativeAsLong(mime);
|
||||
|
||||
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
log.fine("Clipboard: new format is available for " + nativePtr + ": " + mime);
|
||||
}
|
||||
|
||||
synchronized (this) {
|
||||
newClipboardFormats.add(format);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from native to notify us that a new clipboard content
|
||||
* has been made available. The list of supported formats
|
||||
* should have already been received and saved in newClipboardFormats.
|
||||
*
|
||||
* @param nativePtr a native handle to the clipboard
|
||||
*/
|
||||
private void handleNewClipboard(long nativePtr) {
|
||||
// Since we have a new clipboard, the existing one is no longer valid.
|
||||
// We have now way of knowing whether this "new" one is the same as the "old" one.
|
||||
lostOwnershipNow(null);
|
||||
|
||||
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
log.fine("Clipboard: new clipboard is available: " + nativePtr);
|
||||
}
|
||||
|
||||
synchronized (this) {
|
||||
long oldClipboardNativePtr = clipboardNativePtr;
|
||||
if (oldClipboardNativePtr != 0) {
|
||||
destroyClipboard(oldClipboardNativePtr);
|
||||
}
|
||||
clipboardFormats = newClipboardFormats;
|
||||
clipboardNativePtr = nativePtr; // Could be NULL
|
||||
|
||||
newClipboardFormats = new ArrayList<>(INITIAL_MIME_FORMATS_COUNT);
|
||||
|
||||
notifyOfNewFormats(getClipboardFormats());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerClipboardViewerChecked() {
|
||||
// TODO: is there any need to do more here?
|
||||
log.info("Unimplemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void unregisterClipboardViewerChecked() {
|
||||
log.info("Unimplemented");
|
||||
}
|
||||
|
||||
private void notifyOfNewFormats(long[] formats) {
|
||||
if (areFlavorListenersRegistered()) {
|
||||
checkChange(formats);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the given input stream until EOF and returns its contents as an array of bytes.
|
||||
*/
|
||||
private byte[] readAllBytesFrom(FileInputStream inputStream) throws IOException {
|
||||
int len = Integer.MAX_VALUE;
|
||||
List<byte[]> bufs = null;
|
||||
byte[] result = null;
|
||||
int total = 0;
|
||||
int remaining = len;
|
||||
int n;
|
||||
do {
|
||||
byte[] buf = new byte[Math.min(remaining, DEFAULT_BUFFER_SIZE)];
|
||||
int nread = 0;
|
||||
|
||||
while ((n = inputStream.read(buf, nread,
|
||||
Math.min(buf.length - nread, remaining))) > 0) {
|
||||
nread += n;
|
||||
remaining -= n;
|
||||
}
|
||||
|
||||
if (nread > 0) {
|
||||
if (MAX_BUFFER_SIZE - total < nread) {
|
||||
throw new OutOfMemoryError("Required array size too large");
|
||||
}
|
||||
if (nread < buf.length) {
|
||||
buf = Arrays.copyOfRange(buf, 0, nread);
|
||||
}
|
||||
total += nread;
|
||||
if (result == null) {
|
||||
result = buf;
|
||||
} else {
|
||||
if (bufs == null) {
|
||||
bufs = new ArrayList<>();
|
||||
bufs.add(result);
|
||||
}
|
||||
bufs.add(buf);
|
||||
}
|
||||
}
|
||||
// if the last call to read returned -1 or the number of bytes
|
||||
// requested have been read then break
|
||||
} while (n >= 0 && remaining > 0);
|
||||
|
||||
if (bufs == null) {
|
||||
if (result == null) {
|
||||
return new byte[0];
|
||||
}
|
||||
return result.length == total ?
|
||||
result : Arrays.copyOf(result, total);
|
||||
}
|
||||
|
||||
result = new byte[total];
|
||||
int offset = 0;
|
||||
remaining = total;
|
||||
for (byte[] b : bufs) {
|
||||
int count = Math.min(b.length, remaining);
|
||||
System.arraycopy(b, 0, result, offset, count);
|
||||
offset += count;
|
||||
remaining -= count;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static native void initIDs();
|
||||
private static native long createDataOfferQueue();
|
||||
private static native void dispatchDataOfferQueueImpl(long dataOfferQueuePtr);
|
||||
private native long initNative(boolean isPrimary);
|
||||
private native void offerData(long eventSerial, String[] mime, Object data, long dataOfferQueuePtr);
|
||||
private native void cancelOffer(long eventSerial); // TODO: this is unused, delete, maybe?
|
||||
|
||||
private native int requestDataInFormat(long clipboardNativePtr, String mime);
|
||||
private native void destroyClipboard(long clipboardNativePtr);
|
||||
}
|
||||
@@ -147,15 +147,12 @@ public class WLComponentPeer implements ComponentPeer {
|
||||
}
|
||||
|
||||
public void postPaintEvent(int x, int y, int w, int h) {
|
||||
if (!hasSurface()) {
|
||||
log.warning("WLComponentPeer: No surface. Skipping paint request x=" + x + " y=" + y +
|
||||
" width=" + w + " height=" + h);
|
||||
return;
|
||||
}
|
||||
PaintEvent event = PaintEventDispatcher.getPaintEventDispatcher().
|
||||
createPaintEvent(target, x, y, w, h);
|
||||
if (event != null) {
|
||||
WLToolkit.postEvent(event);
|
||||
if (isVisible()) {
|
||||
PaintEvent event = PaintEventDispatcher.getPaintEventDispatcher().
|
||||
createPaintEvent(target, x, y, w, h);
|
||||
if (event != null) {
|
||||
WLToolkit.postEvent(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,7 +165,7 @@ public class WLComponentPeer implements ComponentPeer {
|
||||
}
|
||||
|
||||
boolean isVisible() {
|
||||
return visible;
|
||||
return visible && hasSurface();
|
||||
}
|
||||
|
||||
boolean hasSurface() {
|
||||
@@ -209,20 +206,17 @@ public class WLComponentPeer implements ComponentPeer {
|
||||
public boolean requestFocus(Component lightweightChild, boolean temporary,
|
||||
boolean focusedWindowChangeAllowed, long time,
|
||||
FocusEvent.Cause cause) {
|
||||
final Component currentlyFocused = WLKeyboardFocusManagerPeer.getInstance().getCurrentFocusOwner();
|
||||
if (currentlyFocused == null)
|
||||
final Window currentlyFocusedWindow = WLKeyboardFocusManagerPeer.getInstance().getCurrentFocusedWindow();
|
||||
if (currentlyFocusedWindow == null)
|
||||
return false;
|
||||
|
||||
WLComponentPeer peer = AWTAccessor.getComponentAccessor().getPeer(currentlyFocused);
|
||||
if (peer == null)
|
||||
return false;
|
||||
|
||||
if (this == peer) {
|
||||
Window targetDecoratedWindow = getNativelyFocusableOwnerOrSelf(target);
|
||||
if (currentlyFocusedWindow == targetDecoratedWindow) {
|
||||
WLKeyboardFocusManagerPeer.deliverFocus(lightweightChild,
|
||||
target,
|
||||
null,
|
||||
true,
|
||||
cause,
|
||||
WLKeyboardFocusManagerPeer.getInstance().getCurrentFocusOwner());
|
||||
null);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -232,11 +226,12 @@ public class WLComponentPeer implements ComponentPeer {
|
||||
|
||||
protected void wlSetVisible(boolean v) {
|
||||
this.visible = v;
|
||||
if (this.visible) {
|
||||
if (v) {
|
||||
final String title = getTitle();
|
||||
final boolean isWlPopup = targetIsWlPopup();
|
||||
final int thisWidth = getWidth();
|
||||
final int thisHeight = getHeight();
|
||||
final boolean isModal = targetIsModal();
|
||||
performLocked(() -> {
|
||||
if (isWlPopup) {
|
||||
Window popup = (Window) target;
|
||||
@@ -262,7 +257,10 @@ public class WLComponentPeer implements ComponentPeer {
|
||||
offsetX, offsetY);
|
||||
} else {
|
||||
nativeCreateWLSurface(nativePtr,
|
||||
getParentNativePtr(target), target.getX(), target.getY(), title, appID);
|
||||
getParentNativePtr(target),
|
||||
target.getX(), target.getY(),
|
||||
isModal,
|
||||
title, appID);
|
||||
}
|
||||
final long wlSurfacePtr = getWLSurface(nativePtr);
|
||||
WLToolkit.registerWLSurface(wlSurfacePtr, this);
|
||||
@@ -285,12 +283,21 @@ public class WLComponentPeer implements ComponentPeer {
|
||||
* Returns true if our target should be treated as a popup in Wayland's sense,
|
||||
* i.e. it has to have a parent to position relative to.
|
||||
*/
|
||||
private boolean targetIsWlPopup() {
|
||||
return target instanceof Window window
|
||||
&& window.getType() == Window.Type.POPUP
|
||||
protected boolean targetIsWlPopup() {
|
||||
return target instanceof Window window && isWlPopup(window);
|
||||
}
|
||||
|
||||
static boolean isWlPopup(Window window) {
|
||||
return window.getType() == Window.Type.POPUP
|
||||
&& AWTAccessor.getWindowAccessor().getPopupParent(window) != null;
|
||||
}
|
||||
|
||||
private boolean targetIsModal() {
|
||||
return target instanceof Dialog dialog
|
||||
&& (dialog.getModalityType() == Dialog.ModalityType.APPLICATION_MODAL
|
||||
|| dialog.getModalityType() == Dialog.ModalityType.TOOLKIT_MODAL);
|
||||
}
|
||||
|
||||
void configureWLSurface() {
|
||||
synchronized (sizeLock) {
|
||||
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
@@ -373,7 +380,7 @@ public class WLComponentPeer implements ComponentPeer {
|
||||
|
||||
public void setBounds(int x, int y, int width, int height, int op) {
|
||||
final boolean positionChanged = this.x != x || this.y != y;
|
||||
if (positionChanged) {
|
||||
if (positionChanged && isVisible()) {
|
||||
performLocked(() -> WLRobotPeer.setLocationOfWLSurface(getWLSurface(nativePtr), x, y));
|
||||
}
|
||||
this.x = x;
|
||||
@@ -400,6 +407,7 @@ public class WLComponentPeer implements ComponentPeer {
|
||||
|
||||
WLToolkit.postEvent(new ComponentEvent(getTarget(), ComponentEvent.COMPONENT_RESIZED));
|
||||
}
|
||||
|
||||
postPaintEvent();
|
||||
}
|
||||
|
||||
@@ -653,6 +661,12 @@ public class WLComponentPeer implements ComponentPeer {
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
SurfaceData oldData = surfaceData;
|
||||
surfaceData = null;
|
||||
if (oldData != null) {
|
||||
oldData.invalidate();
|
||||
}
|
||||
WLToolkit.targetDisposedPeer(target, this);
|
||||
performLocked(() -> {
|
||||
assert(!isVisible());
|
||||
nativeDisposeFrame(nativePtr);
|
||||
@@ -839,7 +853,7 @@ public class WLComponentPeer implements ComponentPeer {
|
||||
protected native long nativeCreateFrame();
|
||||
|
||||
protected native void nativeCreateWLSurface(long ptr, long parentPtr,
|
||||
int x, int y,
|
||||
int x, int y, boolean isModal,
|
||||
String title, String appID);
|
||||
|
||||
protected native void nativeCreateWLPopup(long ptr, long parentPtr,
|
||||
@@ -1170,4 +1184,12 @@ public class WLComponentPeer implements ComponentPeer {
|
||||
throw new IllegalArgumentException("AWT window must have WLComponentPeer as its peer");
|
||||
}
|
||||
}
|
||||
|
||||
static Window getNativelyFocusableOwnerOrSelf(Component component) {
|
||||
Window result = component instanceof Window window ? window : SwingUtilities.getWindowAncestor(component);
|
||||
while (result != null && isWlPopup(result)) {
|
||||
result = result.getOwner();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
357
src/java.desktop/unix/classes/sun/awt/wl/WLDataTransferer.java
Normal file
357
src/java.desktop/unix/classes/sun/awt/wl/WLDataTransferer.java
Normal file
@@ -0,0 +1,357 @@
|
||||
/*
|
||||
* Copyright 2023 JetBrains s.r.o.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* 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.
|
||||
*/
|
||||
package sun.awt.wl;
|
||||
|
||||
import sun.awt.datatransfer.DataTransferer;
|
||||
import sun.awt.datatransfer.ToolkitThreadBlockedHandler;
|
||||
import sun.datatransfer.DataFlavorUtil;
|
||||
import sun.util.logging.PlatformLogger;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.imageio.ImageReadParam;
|
||||
import javax.imageio.ImageReader;
|
||||
import javax.imageio.ImageTypeSpecifier;
|
||||
import javax.imageio.ImageWriter;
|
||||
import javax.imageio.spi.ImageWriterSpi;
|
||||
import javax.imageio.stream.ImageInputStream;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.datatransfer.DataFlavor;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.ColorModel;
|
||||
import java.awt.image.WritableRaster;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Facilitates data conversion between formats for the use with the clipboard.
|
||||
* Some terminology:
|
||||
* "native" format - the format understood by Wayland; MIME with some deviations
|
||||
* "long" format - an arbintrary number assigned to some native format;
|
||||
* once established, this mapping never changes
|
||||
*/
|
||||
public class WLDataTransferer extends DataTransferer {
|
||||
private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.wl.WLDataTransferer");
|
||||
|
||||
private static ImageTypeSpecifier defaultImageSpec = null;
|
||||
|
||||
// Maps the "native" format (MIME) to its numeric ID
|
||||
private final Map<String, Long> nameToLong = new HashMap<>();
|
||||
|
||||
// Maps the numeric ID of a format to its native (MIME) representation
|
||||
private final Map<Long, String> longToName = new HashMap<>();
|
||||
|
||||
private final Map<Long, Boolean> imageFormats = new HashMap<>();
|
||||
private final Map<Long, Boolean> textFormats = new HashMap<>();
|
||||
|
||||
private static class HOLDER {
|
||||
static WLDataTransferer instance = new WLDataTransferer();
|
||||
}
|
||||
|
||||
static WLDataTransferer getInstanceImpl() {
|
||||
return HOLDER.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultUnicodeEncoding() {
|
||||
return "UTF-8";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLocaleDependentTextFormat(long format) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFileFormat(long format) {
|
||||
String nat = getNativeForFormat(format);
|
||||
return "FILE_NAME".equals(nat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isImageFormat(long format) {
|
||||
synchronized (this) {
|
||||
return imageFormats.computeIfAbsent(format, f -> isMimeFormat(f, "image"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTextFormat(long format) {
|
||||
synchronized (this) {
|
||||
return textFormats.computeIfAbsent(
|
||||
format,
|
||||
f -> super.isTextFormat(format)
|
||||
|| isMimeFormat(format, "text"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the given format ID corresponds to a MIME format
|
||||
* with the given primary type
|
||||
*/
|
||||
private boolean isMimeFormat(long format, String primaryType) {
|
||||
String nat = getNativeForFormat(format);
|
||||
if (nat != null) {
|
||||
try {
|
||||
DataFlavor df = new DataFlavor(nat);
|
||||
if (primaryType.equals(df.getPrimaryType())) {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception ignored) { /* Not MIME */ }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Long getFormatForNativeAsLong(String formatName) {
|
||||
Objects.requireNonNull(formatName);
|
||||
synchronized (this) {
|
||||
Long thisID = nameToLong.get(formatName);
|
||||
if (thisID == null) {
|
||||
// Some apps request data in a format that only differs from
|
||||
// the advertised in the case of some of the letters.
|
||||
// IMO we can ignore the case and find an equivalent.
|
||||
var matchingKey = nameToLong.keySet().stream()
|
||||
.filter(formatName::equalsIgnoreCase).findAny()
|
||||
.orElse(null);
|
||||
if (matchingKey != null) {
|
||||
thisID = nameToLong.get(matchingKey);
|
||||
} else {
|
||||
long nextID = nameToLong.size();
|
||||
thisID = nextID;
|
||||
longToName.put(thisID, formatName);
|
||||
}
|
||||
nameToLong.put(formatName, thisID);
|
||||
}
|
||||
|
||||
return thisID;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getNativeForFormat(long format) {
|
||||
synchronized (this) {
|
||||
return longToName.get(format);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ByteArrayOutputStream convertFileListToBytes(ArrayList<String> fileList) {
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
for (int i = 0; i < fileList.size(); i++) {
|
||||
byte[] bytes = fileList.get(i).getBytes();
|
||||
if (i != 0) bos.write(0);
|
||||
bos.write(bytes, 0, bytes.length);
|
||||
}
|
||||
return bos;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] dragQueryFile(byte[] bytes) {
|
||||
// TODO
|
||||
log.info("Unimplemented");
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Image platformImageBytesToImage(byte[] bytes, long format) throws IOException {
|
||||
DataFlavor df = getImageDataFlavorForFormat(format);
|
||||
final String baseType = df.getPrimaryType() + "/" + df.getSubType();
|
||||
Iterator<ImageReader> readers = ImageIO.getImageReadersByMIMEType(baseType);
|
||||
BufferedImage bi = null;
|
||||
if (readers.hasNext()) {
|
||||
ImageReader reader = readers.next();
|
||||
ImageReadParam param = reader.getDefaultReadParam();
|
||||
ByteArrayInputStream byteStream = new ByteArrayInputStream(bytes);
|
||||
ImageInputStream stream = ImageIO.createImageInputStream(byteStream);
|
||||
reader.setInput(stream, true, true);
|
||||
try (stream) {
|
||||
bi = reader.read(0, param);
|
||||
} finally {
|
||||
reader.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
return bi;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected byte[] imageToPlatformBytes(Image image, long format) throws IOException {
|
||||
int width = image.getWidth(null);
|
||||
int height = image.getHeight(null);
|
||||
BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
|
||||
Graphics2D g2d = bufferedImage.createGraphics();
|
||||
g2d.drawImage(image, 0, 0, null);
|
||||
g2d.dispose();
|
||||
|
||||
int numBytes = (int)(width * height * bufferedImage.getColorModel().getPixelSize() / 8.0);
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream(numBytes);
|
||||
DataFlavor df = getImageDataFlavorForFormat(format);
|
||||
ImageIO.write(bufferedImage, df.getSubType(), out);
|
||||
|
||||
return out.toByteArray();
|
||||
}
|
||||
|
||||
private DataFlavor getImageDataFlavorForFormat(long format) {
|
||||
String nat = getNativeForFormat(format);
|
||||
DataFlavor df = null;
|
||||
try {
|
||||
df = new DataFlavor(nat);
|
||||
} catch (Exception ignored) { }
|
||||
|
||||
if (df == null) {
|
||||
throw new InternalError("Native image format " + nat + " corresponding to ID "
|
||||
+ format + " not recognized as DataFlavor");
|
||||
}
|
||||
return df;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToolkitThreadBlockedHandler getToolkitThreadBlockedHandler() {
|
||||
return WLToolkitThreadBlockedHandler.getToolkitThreadBlockedHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkedHashSet<DataFlavor> getPlatformMappingsForNative(String nat) {
|
||||
// TODO: much of this has been taken verbatim from XDataTransferer.
|
||||
// Worth refactoring the common stuff out?
|
||||
LinkedHashSet<DataFlavor> flavors = new LinkedHashSet<>();
|
||||
|
||||
if (nat == null) {
|
||||
return flavors;
|
||||
}
|
||||
|
||||
DataFlavor df;
|
||||
try {
|
||||
df = new DataFlavor(nat);
|
||||
} catch (Exception e) {
|
||||
// The string doesn't constitute a valid MIME type.
|
||||
return flavors;
|
||||
}
|
||||
|
||||
DataFlavor value = df;
|
||||
final String primaryType = df.getPrimaryType();
|
||||
|
||||
// For text formats we map natives to MIME strings instead of data
|
||||
// flavors to enable dynamic text native-to-flavor mapping generation.
|
||||
// See SystemFlavorMap.getFlavorsForNative() for details.
|
||||
if ("image".equals(primaryType)) {
|
||||
final String baseType = primaryType + "/" + df.getSubType();
|
||||
Iterator<ImageReader> readers = ImageIO.getImageReadersByMIMEType(baseType);
|
||||
if (readers.hasNext()) {
|
||||
flavors.add(DataFlavor.imageFlavor);
|
||||
}
|
||||
}
|
||||
|
||||
flavors.add(value);
|
||||
|
||||
return flavors;
|
||||
}
|
||||
|
||||
private ImageTypeSpecifier getDefaultImageTypeSpecifier() {
|
||||
if (defaultImageSpec == null) {
|
||||
ColorModel model = ColorModel.getRGBdefault();
|
||||
WritableRaster raster =
|
||||
model.createCompatibleWritableRaster(10, 10);
|
||||
|
||||
BufferedImage bufferedImage =
|
||||
new BufferedImage(model, raster, model.isAlphaPremultiplied(),
|
||||
null);
|
||||
|
||||
defaultImageSpec = new ImageTypeSpecifier(bufferedImage);
|
||||
}
|
||||
|
||||
return defaultImageSpec;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkedHashSet<String> getPlatformMappingsForFlavor(DataFlavor df) {
|
||||
LinkedHashSet<String> natives = new LinkedHashSet<>(1);
|
||||
|
||||
if (df == null) {
|
||||
return natives;
|
||||
}
|
||||
|
||||
String charset = df.getParameter("charset");
|
||||
String baseType = df.getPrimaryType() + "/" + df.getSubType();
|
||||
String mimeType = baseType;
|
||||
|
||||
if (charset != null && DataFlavorUtil.isFlavorCharsetTextType(df)) {
|
||||
mimeType += ";charset=" + charset;
|
||||
}
|
||||
|
||||
// Add a mapping to the MIME native whenever the representation class
|
||||
// doesn't require translation.
|
||||
if (df.getRepresentationClass() != null &&
|
||||
(df.isRepresentationClassInputStream() ||
|
||||
df.isRepresentationClassByteBuffer() ||
|
||||
byte[].class.equals(df.getRepresentationClass()))) {
|
||||
natives.add(mimeType);
|
||||
}
|
||||
|
||||
if (DataFlavor.imageFlavor.equals(df)) {
|
||||
String[] mimeTypes = ImageIO.getWriterMIMETypes();
|
||||
if (mimeTypes != null) {
|
||||
for (String mime : mimeTypes) {
|
||||
Iterator<ImageWriter> writers = ImageIO.getImageWritersByMIMEType(mime);
|
||||
while (writers.hasNext()) {
|
||||
ImageWriter imageWriter = writers.next();
|
||||
ImageWriterSpi writerSpi = imageWriter.getOriginatingProvider();
|
||||
|
||||
if (writerSpi != null &&
|
||||
writerSpi.canEncodeImage(getDefaultImageTypeSpecifier())) {
|
||||
natives.add(mime);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (DataFlavorUtil.isFlavorCharsetTextType(df)) {
|
||||
// stringFlavor is semantically equivalent to the standard
|
||||
// "text/plain" MIME type.
|
||||
if (DataFlavor.stringFlavor.equals(df)) {
|
||||
baseType = "text/plain";
|
||||
}
|
||||
|
||||
for (String encoding : DataFlavorUtil.standardEncodings()) {
|
||||
if (!encoding.equals(charset)) {
|
||||
natives.add(baseType + ";charset=" + encoding);
|
||||
}
|
||||
}
|
||||
|
||||
// Add a MIME format without specified charset.
|
||||
natives.add(baseType);
|
||||
}
|
||||
|
||||
return natives;
|
||||
}
|
||||
}
|
||||
@@ -134,9 +134,11 @@ public abstract class WLDecoratedPeer extends WLWindowPeer {
|
||||
}
|
||||
|
||||
void postPaintEvent() {
|
||||
// Full re-paint must include window decorations, if any
|
||||
notifyClientDecorationsChanged();
|
||||
super.postPaintEvent();
|
||||
if (isVisible()) {
|
||||
// Full re-paint must include window decorations, if any
|
||||
notifyClientDecorationsChanged();
|
||||
super.postPaintEvent();
|
||||
}
|
||||
}
|
||||
|
||||
final void paintClientDecorations(final Graphics g) {
|
||||
|
||||
@@ -35,7 +35,8 @@ public class WLKeyboardFocusManagerPeer extends KeyboardFocusManagerPeerImpl {
|
||||
|
||||
@Override
|
||||
public void setCurrentFocusOwner(Component comp) {
|
||||
if (comp != null && comp != currentFocusedWindow) {
|
||||
if (comp != null && (!(comp instanceof Window window) ||
|
||||
WLComponentPeer.getNativelyFocusableOwnerOrSelf(window) != currentFocusedWindow)) {
|
||||
// In Wayland, only Window can be focused, not any widget in it.
|
||||
focusLog.severe("Unexpected focus owner set in a Window: " + comp);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ package sun.awt.wl;
|
||||
|
||||
import jdk.internal.misc.InnocuousThread;
|
||||
import sun.awt.AWTAccessor;
|
||||
import sun.awt.AWTAutoShutdown;
|
||||
import sun.awt.AWTPermissions;
|
||||
import sun.awt.AppContext;
|
||||
import sun.awt.LightweightFrame;
|
||||
import sun.awt.PeerEvent;
|
||||
@@ -85,6 +87,7 @@ import java.security.PrivilegedAction;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Properties;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
@@ -137,6 +140,9 @@ public class WLToolkit extends UNIXToolkit implements Runnable {
|
||||
private static final int NUM_LOCK_MASK = 0x02;
|
||||
|
||||
private static boolean initialized = false;
|
||||
private static Thread toolkitThread;
|
||||
private final WLClipboard clipboard;
|
||||
private final WLClipboard selection;
|
||||
|
||||
private static native void initIDs();
|
||||
|
||||
@@ -158,7 +164,7 @@ public class WLToolkit extends UNIXToolkit implements Runnable {
|
||||
});
|
||||
|
||||
if (!GraphicsEnvironment.isHeadless()) {
|
||||
Thread toolkitThread = InnocuousThread.newThread("AWT-Wayland", this);
|
||||
toolkitThread = InnocuousThread.newThread("AWT-Wayland", this);
|
||||
toolkitThread.setDaemon(true);
|
||||
toolkitThread.start();
|
||||
|
||||
@@ -168,6 +174,19 @@ public class WLToolkit extends UNIXToolkit implements Runnable {
|
||||
|
||||
// Wait here for all display sync events to have been received?
|
||||
}
|
||||
|
||||
WLClipboard selectionClipboard = null;
|
||||
try {
|
||||
selectionClipboard = new WLClipboard("Selection", true);
|
||||
} catch (UnsupportedOperationException ignored) {
|
||||
}
|
||||
|
||||
clipboard = new WLClipboard("System", false);
|
||||
selection = selectionClipboard;
|
||||
}
|
||||
|
||||
public static boolean isToolkitThread() {
|
||||
return Thread.currentThread() == toolkitThread;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -204,12 +223,14 @@ public class WLToolkit extends UNIXToolkit implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
while(true) {
|
||||
AWTAutoShutdown.notifyToolkitThreadFree(); // will now wait for events
|
||||
int result = readEvents();
|
||||
if (result == READ_RESULT_ERROR) {
|
||||
log.severe("Wayland protocol I/O error");
|
||||
// TODO: display disconnect handling here?
|
||||
break;
|
||||
} else if (result == READ_RESULT_FINISHED_WITH_EVENTS) {
|
||||
AWTAutoShutdown.notifyToolkitThreadBusy(); // busy processing events
|
||||
SunToolkit.postEvent(AppContext.getAppContext(), new PeerEvent(this, () -> {
|
||||
WLToolkit.awtLock();
|
||||
try {
|
||||
@@ -748,8 +769,7 @@ public class WLToolkit extends UNIXToolkit implements Runnable {
|
||||
|
||||
@Override
|
||||
public DataTransferer getDataTransferer() {
|
||||
log.info("Not implemented: WLToolkit.getDataTransferer()");
|
||||
return null;
|
||||
return WLDataTransferer.getInstanceImpl();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -781,14 +801,23 @@ public class WLToolkit extends UNIXToolkit implements Runnable {
|
||||
|
||||
@Override
|
||||
public Clipboard getSystemClipboard() {
|
||||
log.info("Not implemented: WLToolkit.getSystemClipboard()");
|
||||
return null;
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkPermission(AWTPermissions.ACCESS_CLIPBOARD_PERMISSION);
|
||||
}
|
||||
|
||||
return clipboard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Clipboard getSystemSelection() {
|
||||
log.info("Not implemented: WLToolkit.getSystemSelection()");
|
||||
return null;
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkPermission(AWTPermissions.ACCESS_CLIPBOARD_PERMISSION);
|
||||
}
|
||||
return selection;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2004, 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
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package sun.awt.wl;
|
||||
|
||||
import sun.awt.datatransfer.ToolkitThreadBlockedHandler;
|
||||
|
||||
// TODO: this class is essentially unused; not sure if it even has to be here
|
||||
final class WLToolkitThreadBlockedHandler implements
|
||||
ToolkitThreadBlockedHandler {
|
||||
private static final ToolkitThreadBlockedHandler privilegedLock = new WLToolkitThreadBlockedHandler();
|
||||
private static final WLToolkit tk = (WLToolkit) java.awt.Toolkit.getDefaultToolkit();
|
||||
|
||||
private WLToolkitThreadBlockedHandler() {
|
||||
}
|
||||
|
||||
static ToolkitThreadBlockedHandler getToolkitThreadBlockedHandler() {
|
||||
return privilegedLock;
|
||||
}
|
||||
|
||||
public void lock() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void unlock() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void enter() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void exit() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
@@ -26,11 +26,13 @@ package sun.awt.wl;
|
||||
|
||||
import sun.awt.AWTAccessor;
|
||||
import java.awt.*;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.peer.ComponentPeer;
|
||||
import java.awt.peer.WindowPeer;
|
||||
|
||||
public class WLWindowPeer extends WLComponentPeer implements WindowPeer {
|
||||
private static Font defaultFont;
|
||||
private Dialog blocker;
|
||||
|
||||
static synchronized Font getDefaultFont() {
|
||||
if (null == defaultFont) {
|
||||
@@ -55,14 +57,29 @@ public class WLWindowPeer extends WLComponentPeer implements WindowPeer {
|
||||
|
||||
@Override
|
||||
protected void wlSetVisible(boolean v) {
|
||||
if (v && targetIsWlPopup() && shouldBeFocusedOnShowing()) {
|
||||
requestWindowFocus();
|
||||
}
|
||||
super.wlSetVisible(v);
|
||||
final AWTAccessor.ComponentAccessor acc = AWTAccessor.getComponentAccessor();
|
||||
for (Component c : ((Window)target).getComponents()) {
|
||||
for (Component c : getWindow().getComponents()) {
|
||||
ComponentPeer cPeer = acc.getPeer(c);
|
||||
if (cPeer instanceof WLComponentPeer) {
|
||||
((WLComponentPeer) cPeer).wlSetVisible(v);
|
||||
}
|
||||
}
|
||||
if (!v && targetIsWlPopup() && getWindow().isFocused()) {
|
||||
Window targetOwner = getWindow().getOwner();
|
||||
while (targetOwner != null && (targetOwner.getOwner() != null && !targetOwner.isFocusableWindow())) {
|
||||
targetOwner = targetOwner.getOwner();
|
||||
}
|
||||
if (targetOwner != null) {
|
||||
WLWindowPeer wndpeer = AWTAccessor.getComponentAccessor().getPeer(targetOwner);
|
||||
if (wndpeer != null) {
|
||||
wndpeer.requestWindowFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -109,7 +126,7 @@ public class WLWindowPeer extends WLComponentPeer implements WindowPeer {
|
||||
|
||||
@Override
|
||||
public void setModalBlocked(Dialog blocker, boolean blocked) {
|
||||
|
||||
this.blocker = blocked ? blocker : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -150,4 +167,25 @@ public class WLWindowPeer extends WLComponentPeer implements WindowPeer {
|
||||
public void repositionSecurityWarning() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
private Window getWindow() {
|
||||
return (Window) target;
|
||||
}
|
||||
|
||||
private boolean shouldBeFocusedOnShowing() {
|
||||
Window window = getWindow();
|
||||
return window.isFocusableWindow() &&
|
||||
window.isAutoRequestFocus() &&
|
||||
blocker == null;
|
||||
}
|
||||
|
||||
// supporting only 'synthetic' focus transfers for now (when natively focused window stays the same)
|
||||
private void requestWindowFocus() {
|
||||
Window window = getWindow();
|
||||
Window nativeFocusTarget = getNativelyFocusableOwnerOrSelf(window);
|
||||
if (nativeFocusTarget != null &&
|
||||
WLKeyboardFocusManagerPeer.getInstance().getCurrentFocusedWindow() == nativeFocusTarget) {
|
||||
WLToolkit.postEvent(new WindowEvent(window, WindowEvent.WINDOW_GAINED_FOCUS));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,8 +280,11 @@ JNI_OnUnload(JavaVM *vm, void *reserved) {
|
||||
#define TEXT_AA_LCD_VRGB 6
|
||||
#define TEXT_AA_LCD_VBGR 7
|
||||
|
||||
static void setRenderingFontHintsField(FcPattern* matchPattern, const char* property, int* value) {
|
||||
if (FcResultMatch != (*fcPatternGetBool)(matchPattern, property, 0, value)) {
|
||||
typedef FcResult (*FcPatternGetValueFuncType)(const FcPattern *p, const char *object, int n, void *b);
|
||||
|
||||
static void setRenderingFontHintsField(FcPatternGetValueFuncType fcPatternGetValue, FcPattern* matchPattern,
|
||||
const char* property, int* value) {
|
||||
if (FcResultMatch != (*fcPatternGetValue)(matchPattern, property, 0, value)) {
|
||||
*value = -1;
|
||||
}
|
||||
}
|
||||
@@ -292,10 +295,13 @@ JNIEXPORT int setupRenderingFontHints
|
||||
FcPattern *pattern, *matchPattern;
|
||||
FcResult result;
|
||||
|
||||
if (fcName == NULL) {
|
||||
if (usingFontConfig() == false) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (fcName == NULL) {
|
||||
return -1;
|
||||
}
|
||||
pattern = (*fcNameParse)((FcChar8 *)fcName);
|
||||
if (locale != NULL) {
|
||||
(*fcPatternAddString)(pattern, FC_LANG, (unsigned char*)locale);
|
||||
@@ -312,13 +318,19 @@ JNIEXPORT int setupRenderingFontHints
|
||||
*/
|
||||
if (matchPattern) {
|
||||
// Extract values from result
|
||||
setRenderingFontHintsField(matchPattern, FC_HINTING, &renderingFontHints->fcHinting);
|
||||
setRenderingFontHintsField(matchPattern, FC_HINT_STYLE, &renderingFontHints->fcHintStyle);
|
||||
setRenderingFontHintsField(matchPattern, FC_ANTIALIAS, &renderingFontHints->fcAntialias);
|
||||
setRenderingFontHintsField(matchPattern, FC_AUTOHINT, &renderingFontHints->fcAutohint);
|
||||
setRenderingFontHintsField(matchPattern, FC_LCD_FILTER, &renderingFontHints->fcRGBA);
|
||||
setRenderingFontHintsField(matchPattern, FC_RGBA, &renderingFontHints->fcLCDFilter);
|
||||
|
||||
setRenderingFontHintsField((FcPatternGetValueFuncType)(fcPatternGetBool), matchPattern, FC_HINTING,
|
||||
&renderingFontHints->fcHinting);
|
||||
setRenderingFontHintsField((FcPatternGetValueFuncType)(fcPatternGetInteger), matchPattern, FC_HINT_STYLE,
|
||||
&renderingFontHints->fcHintStyle);
|
||||
setRenderingFontHintsField((FcPatternGetValueFuncType)(fcPatternGetBool), matchPattern, FC_ANTIALIAS,
|
||||
&renderingFontHints->fcAntialias);
|
||||
setRenderingFontHintsField((FcPatternGetValueFuncType)(fcPatternGetBool), matchPattern, FC_AUTOHINT,
|
||||
&renderingFontHints->fcAutohint);
|
||||
setRenderingFontHintsField((FcPatternGetValueFuncType)(fcPatternGetInteger), matchPattern, FC_RGBA,
|
||||
&renderingFontHints->fcRGBA);
|
||||
setRenderingFontHintsField((FcPatternGetValueFuncType)(fcPatternGetInteger), matchPattern, FC_LCD_FILTER,
|
||||
&renderingFontHints->fcLCDFilter);
|
||||
|
||||
(*fcPatternDestroy)(matchPattern);
|
||||
}
|
||||
(*fcPatternDestroy)(pattern);
|
||||
|
||||
138
src/java.desktop/unix/native/libawt_wlawt/JNIUtilities.h
Normal file
138
src/java.desktop/unix/native/libawt_wlawt/JNIUtilities.h
Normal file
@@ -0,0 +1,138 @@
|
||||
#ifndef JNIUTILITIES_H_
|
||||
#define JNIUTILITIES_H_
|
||||
|
||||
#include "jni.h"
|
||||
#include "jni_util.h"
|
||||
|
||||
#define CHECK_NULL_THROW_OOME(env, x, msg) \
|
||||
do { \
|
||||
if ((x) == NULL) { \
|
||||
JNU_ThrowOutOfMemoryError((env), (msg));\
|
||||
return; \
|
||||
} \
|
||||
} while(0) \
|
||||
|
||||
#define CHECK_NULL_THROW_OOME_RETURN(env, x, msg, z)\
|
||||
do { \
|
||||
if ((x) == NULL) { \
|
||||
JNU_ThrowOutOfMemoryError((env), (msg));\
|
||||
return (z); \
|
||||
} \
|
||||
} while(0) \
|
||||
|
||||
#define CHECK_NULL_THROW_IE(env, x, msg) \
|
||||
do { \
|
||||
if ((x) == NULL) { \
|
||||
JNU_ThrowInternalError((env), (msg));\
|
||||
return; \
|
||||
} \
|
||||
} while(0) \
|
||||
|
||||
/******** GET CLASS SUPPORT *********/
|
||||
|
||||
#define GET_CLASS(dst_var, cls) \
|
||||
if (dst_var == NULL) { \
|
||||
dst_var = (*env)->FindClass(env, cls); \
|
||||
if (dst_var != NULL) dst_var = (*env)->NewGlobalRef(env, dst_var); \
|
||||
} \
|
||||
CHECK_NULL(dst_var);
|
||||
|
||||
#define DECLARE_CLASS(dst_var, cls) \
|
||||
static jclass dst_var = NULL; \
|
||||
GET_CLASS(dst_var, cls);
|
||||
|
||||
#define GET_CLASS_RETURN(dst_var, cls, ret) \
|
||||
if (dst_var == NULL) { \
|
||||
dst_var = (*env)->FindClass(env, cls); \
|
||||
if (dst_var != NULL) dst_var = (*env)->NewGlobalRef(env, dst_var); \
|
||||
} \
|
||||
CHECK_NULL_RETURN(dst_var, ret);
|
||||
|
||||
#define DECLARE_CLASS_RETURN(dst_var, cls, ret) \
|
||||
static jclass dst_var = NULL; \
|
||||
GET_CLASS_RETURN(dst_var, cls, ret);
|
||||
|
||||
|
||||
/******** GET METHOD SUPPORT *********/
|
||||
|
||||
#define GET_METHOD(dst_var, cls, name, signature) \
|
||||
if (dst_var == NULL) { \
|
||||
dst_var = (*env)->GetMethodID(env, cls, name, signature); \
|
||||
} \
|
||||
CHECK_NULL(dst_var);
|
||||
|
||||
#define DECLARE_METHOD(dst_var, cls, name, signature) \
|
||||
static jmethodID dst_var = NULL; \
|
||||
GET_METHOD(dst_var, cls, name, signature);
|
||||
|
||||
#define GET_METHOD_RETURN(dst_var, cls, name, signature, ret) \
|
||||
if (dst_var == NULL) { \
|
||||
dst_var = (*env)->GetMethodID(env, cls, name, signature); \
|
||||
} \
|
||||
CHECK_NULL_RETURN(dst_var, ret);
|
||||
|
||||
#define DECLARE_METHOD_RETURN(dst_var, cls, name, signature, ret) \
|
||||
static jmethodID dst_var = NULL; \
|
||||
GET_METHOD_RETURN(dst_var, cls, name, signature, ret);
|
||||
|
||||
#define GET_STATIC_METHOD(dst_var, cls, name, signature) \
|
||||
if (dst_var == NULL) { \
|
||||
dst_var = (*env)->GetStaticMethodID(env, cls, name, signature); \
|
||||
} \
|
||||
CHECK_NULL(dst_var);
|
||||
|
||||
#define DECLARE_STATIC_METHOD(dst_var, cls, name, signature) \
|
||||
static jmethodID dst_var = NULL; \
|
||||
GET_STATIC_METHOD(dst_var, cls, name, signature);
|
||||
|
||||
#define GET_STATIC_METHOD_RETURN(dst_var, cls, name, signature, ret) \
|
||||
if (dst_var == NULL) { \
|
||||
dst_var = (*env)->GetStaticMethodID(env, cls, name, signature); \
|
||||
} \
|
||||
CHECK_NULL_RETURN(dst_var, ret);
|
||||
|
||||
#define DECLARE_STATIC_METHOD_RETURN(dst_var, cls, name, signature, ret) \
|
||||
static jmethodID dst_var = NULL; \
|
||||
GET_STATIC_METHOD_RETURN(dst_var, cls, name, signature, ret);
|
||||
|
||||
/******** GET FIELD SUPPORT *********/
|
||||
|
||||
|
||||
#define GET_FIELD(dst_var, cls, name, signature) \
|
||||
if (dst_var == NULL) { \
|
||||
dst_var = (*env)->GetFieldID(env, cls, name, signature); \
|
||||
} \
|
||||
CHECK_NULL(dst_var);
|
||||
|
||||
#define DECLARE_FIELD(dst_var, cls, name, signature) \
|
||||
static jfieldID dst_var = NULL; \
|
||||
GET_FIELD(dst_var, cls, name, signature);
|
||||
|
||||
#define GET_FIELD_RETURN(dst_var, cls, name, signature, ret) \
|
||||
if (dst_var == NULL) { \
|
||||
dst_var = (*env)->GetFieldID(env, cls, name, signature); \
|
||||
} \
|
||||
CHECK_NULL_RETURN(dst_var, ret);
|
||||
|
||||
#define DECLARE_FIELD_RETURN(dst_var, cls, name, signature, ret) \
|
||||
static jfieldID dst_var = NULL; \
|
||||
GET_FIELD_RETURN(dst_var, cls, name, signature, ret);
|
||||
|
||||
#define GET_STATIC_FIELD_RETURN(dst_var, cls, name, signature, ret) \
|
||||
if (dst_var == NULL) { \
|
||||
dst_var = (*env)->GetStaticFieldID(env, cls, name, signature); \
|
||||
} \
|
||||
CHECK_NULL_RETURN(dst_var, ret);
|
||||
|
||||
#define DECLARE_STATIC_FIELD_RETURN(dst_var, cls, name, signature, ret) \
|
||||
static jfieldID dst_var = NULL; \
|
||||
GET_STATIC_FIELD_RETURN(dst_var, cls, name, signature, ret);
|
||||
|
||||
/******** EXCEPTIONS SUPPORT *********/
|
||||
|
||||
#define EXCEPTION_CLEAR(env) \
|
||||
if ((*env)->ExceptionCheck(env)) { \
|
||||
(*env)->ExceptionClear(env); \
|
||||
}
|
||||
|
||||
#endif // JNIUTILITIES_H_
|
||||
677
src/java.desktop/unix/native/libawt_wlawt/WLClipboard.c
Normal file
677
src/java.desktop/unix/native/libawt_wlawt/WLClipboard.c
Normal file
@@ -0,0 +1,677 @@
|
||||
/*
|
||||
* Copyright (c) 2023, JetBrains s.r.o.. 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
|
||||
* 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 <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "JNIUtilities.h"
|
||||
#include "sun_awt_wl_WLClipboard.h"
|
||||
#include "wayland-client-protocol.h"
|
||||
#include "WLToolkit.h"
|
||||
|
||||
// A type both zwp_primary_selection_source_v1* and wl_data_source*
|
||||
// are convertible to.
|
||||
typedef void* data_source_t;
|
||||
|
||||
static jmethodID transferContentsWithTypeMID; // WLCipboard.transferContentsWithType()
|
||||
static jmethodID handleClipboardFormatMID; // WLCipboard.handleClipboardFormat()
|
||||
static jmethodID handleNewClipboardMID; // WLCipboard.handleNewClipboard()
|
||||
static jfieldID isPrimaryFID; // WLClipboard.isPrimary
|
||||
|
||||
typedef struct DataSourcePayload {
|
||||
jobject clipboard; // a global reference to WLClipboard
|
||||
jobject content; // a global reference to Transferable
|
||||
} DataSourcePayload;
|
||||
|
||||
static DataSourcePayload *
|
||||
DataSourcePayload_Create(jobject clipboard, jobject content)
|
||||
{
|
||||
DataSourcePayload * payload = malloc(sizeof(struct DataSourcePayload));
|
||||
if (payload) {
|
||||
payload->clipboard = clipboard;
|
||||
payload->content = content;
|
||||
}
|
||||
return payload;
|
||||
}
|
||||
|
||||
static void
|
||||
DataSourcePayload_Destroy(DataSourcePayload* payload)
|
||||
{
|
||||
free(payload);
|
||||
}
|
||||
|
||||
typedef struct DataOfferPayload {
|
||||
jobject clipboard; // a global reference to WLClipboard
|
||||
} DataOfferPayload;
|
||||
|
||||
static DataOfferPayload *
|
||||
DataOfferPayload_Create(jobject clipboard)
|
||||
{
|
||||
// NB: this payload is associated with the clipboard and, once created,
|
||||
// is never destroyed, much like the clipboard itself.
|
||||
DataOfferPayload * payload = malloc(sizeof(struct DataOfferPayload));
|
||||
if (payload) {
|
||||
payload->clipboard = clipboard;
|
||||
}
|
||||
return payload;
|
||||
}
|
||||
|
||||
// Clipboard "devices", one for the actual clipboard and one for the selection clipboard.
|
||||
// Implicitly assumed that WLClipboard can only create once instance of each.
|
||||
static struct wl_data_device *wl_data_device;
|
||||
static struct zwp_primary_selection_device_v1 *zwp_selection_device;
|
||||
|
||||
static void data_device_handle_data_offer(
|
||||
void *data,
|
||||
struct wl_data_device *data_device,
|
||||
struct wl_data_offer *offer);
|
||||
|
||||
static void data_device_handle_selection(
|
||||
void *data,
|
||||
struct wl_data_device *data_device,
|
||||
struct wl_data_offer *offer);
|
||||
|
||||
static void
|
||||
data_device_handle_enter(
|
||||
void *data,
|
||||
struct wl_data_device *wl_data_device,
|
||||
uint32_t serial,
|
||||
struct wl_surface *surface,
|
||||
wl_fixed_t x,
|
||||
wl_fixed_t y,
|
||||
struct wl_data_offer *id)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
static void
|
||||
data_device_handle_leave(void *data, struct wl_data_device *wl_data_device)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
static void
|
||||
data_device_handle_motion(
|
||||
void *data,
|
||||
struct wl_data_device *wl_data_device,
|
||||
uint32_t time,
|
||||
wl_fixed_t x,
|
||||
wl_fixed_t y)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
static void
|
||||
data_device_handle_drop(void *data, struct wl_data_device *wl_data_device)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
static const struct wl_data_device_listener wl_data_device_listener = {
|
||||
.data_offer = data_device_handle_data_offer,
|
||||
.selection = data_device_handle_selection,
|
||||
.enter = data_device_handle_enter,
|
||||
.leave = data_device_handle_leave,
|
||||
.motion = data_device_handle_motion
|
||||
};
|
||||
|
||||
static void
|
||||
RegisterDataOfferWithMimeType(DataOfferPayload *payload, void *offer, const char *mime_type)
|
||||
{
|
||||
JNIEnv *env = getEnv();
|
||||
jstring mimeTypeString = (*env)->NewStringUTF(env, mime_type);
|
||||
EXCEPTION_CLEAR(env);
|
||||
if (mimeTypeString) {
|
||||
(*env)->CallVoidMethod(env, payload->clipboard, handleClipboardFormatMID, ptr_to_jlong(offer), mimeTypeString);
|
||||
EXCEPTION_CLEAR(env);
|
||||
(*env)->DeleteLocalRef(env, mimeTypeString);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
RegisterDataOffer(DataOfferPayload *payload, void *offer)
|
||||
{
|
||||
JNIEnv *env = getEnv();
|
||||
(*env)->CallVoidMethod(env, payload->clipboard, handleNewClipboardMID, ptr_to_jlong(offer));
|
||||
EXCEPTION_CLEAR(env);
|
||||
}
|
||||
|
||||
static void
|
||||
zwp_selection_offer(
|
||||
void *data,
|
||||
struct zwp_primary_selection_offer_v1 *offer,
|
||||
const char *mime_type)
|
||||
{
|
||||
assert (data != NULL);
|
||||
RegisterDataOfferWithMimeType(data, offer, mime_type);
|
||||
}
|
||||
|
||||
const struct zwp_primary_selection_offer_v1_listener zwp_selection_offer_listener = {
|
||||
.offer = zwp_selection_offer
|
||||
};
|
||||
|
||||
static void
|
||||
zwp_selection_device_handle_data_offer(
|
||||
void *data,
|
||||
struct zwp_primary_selection_device_v1 *device,
|
||||
struct zwp_primary_selection_offer_v1 *offer)
|
||||
{
|
||||
zwp_primary_selection_offer_v1_add_listener(offer, &zwp_selection_offer_listener, data);
|
||||
}
|
||||
|
||||
static void
|
||||
zwp_selection_device_handle_selection(
|
||||
void *data,
|
||||
struct zwp_primary_selection_device_v1 *device,
|
||||
struct zwp_primary_selection_offer_v1 *offer)
|
||||
{
|
||||
assert (data != NULL);
|
||||
RegisterDataOffer(data, offer);
|
||||
}
|
||||
|
||||
static const struct zwp_primary_selection_device_v1_listener zwp_selection_device_listener = {
|
||||
.data_offer = zwp_selection_device_handle_data_offer,
|
||||
.selection = zwp_selection_device_handle_selection
|
||||
};
|
||||
|
||||
static void
|
||||
wl_action(void *data, struct wl_data_offer *wl_data_offer, uint32_t dnd_action)
|
||||
{
|
||||
// TODO: this is for DnD
|
||||
}
|
||||
|
||||
static void
|
||||
wl_offer(void *data, struct wl_data_offer *offer, const char *mime_type)
|
||||
{
|
||||
assert (data != NULL);
|
||||
RegisterDataOfferWithMimeType(data, offer, mime_type);
|
||||
}
|
||||
|
||||
static void
|
||||
wl_source_actions(void *data, struct wl_data_offer *wl_data_offer, uint32_t source_actions)
|
||||
{
|
||||
// TODO: this is for DnD
|
||||
}
|
||||
|
||||
static const struct wl_data_offer_listener wl_data_offer_listener = {
|
||||
.action = wl_action,
|
||||
.offer = wl_offer,
|
||||
.source_actions = wl_source_actions
|
||||
};
|
||||
|
||||
static void
|
||||
data_device_handle_data_offer(
|
||||
void *data,
|
||||
struct wl_data_device *data_device,
|
||||
struct wl_data_offer *offer)
|
||||
{
|
||||
wl_data_offer_add_listener(offer, &wl_data_offer_listener, data);
|
||||
}
|
||||
|
||||
static void data_device_handle_selection(
|
||||
void *data,
|
||||
struct wl_data_device *data_device,
|
||||
struct wl_data_offer *offer)
|
||||
{
|
||||
assert (data != NULL);
|
||||
RegisterDataOffer(data, offer);
|
||||
}
|
||||
|
||||
static void
|
||||
SendClipboardToFD(DataSourcePayload *payload, const char *mime_type, int fd)
|
||||
{
|
||||
JNIEnv *env = getEnv();
|
||||
jstring mime_type_string = (*env)->NewStringUTF(env, mime_type);
|
||||
EXCEPTION_CLEAR(env);
|
||||
if (payload->clipboard != NULL && payload->content != NULL && mime_type_string != NULL && fd >= 0) {
|
||||
(*env)->CallVoidMethod(env,
|
||||
payload->clipboard,
|
||||
transferContentsWithTypeMID,
|
||||
payload->content,
|
||||
mime_type_string,
|
||||
fd);
|
||||
EXCEPTION_CLEAR(env);
|
||||
} else {
|
||||
// The file is normally closed on the Java side, so only close here
|
||||
// if the Java side wasn't involved.
|
||||
close(fd);
|
||||
}
|
||||
if (mime_type_string != NULL) {
|
||||
(*env)->DeleteLocalRef(env, mime_type_string);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
CleanupClipboard(DataSourcePayload *payload)
|
||||
{
|
||||
if (payload != NULL) {
|
||||
JNIEnv* env = getEnv();
|
||||
|
||||
if (payload->clipboard != NULL) (*env)->DeleteGlobalRef(env, payload->clipboard);
|
||||
if (payload->content != NULL) (*env)->DeleteGlobalRef(env, payload->content);
|
||||
|
||||
DataSourcePayload_Destroy(payload);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
wl_data_source_target(void *data,
|
||||
struct wl_data_source *wl_data_source,
|
||||
const char *mime_type)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
static void
|
||||
wl_data_source_handle_send(
|
||||
void *data,
|
||||
struct wl_data_source *source,
|
||||
const char *mime_type,
|
||||
int fd)
|
||||
{
|
||||
assert(data);
|
||||
SendClipboardToFD(data, mime_type, fd);
|
||||
}
|
||||
|
||||
static void
|
||||
wl_data_source_handle_cancelled(
|
||||
void *data,
|
||||
struct wl_data_source *source)
|
||||
{
|
||||
CleanupClipboard(data);
|
||||
wl_data_source_destroy(source);
|
||||
}
|
||||
|
||||
static const struct wl_data_source_listener wl_data_source_listener = {
|
||||
.target = wl_data_source_target,
|
||||
.send = wl_data_source_handle_send,
|
||||
.cancelled = wl_data_source_handle_cancelled
|
||||
};
|
||||
|
||||
static void
|
||||
zwp_selection_source_handle_send(
|
||||
void *data,
|
||||
struct zwp_primary_selection_source_v1 *source,
|
||||
const char *mime_type,
|
||||
int32_t fd)
|
||||
{
|
||||
DataSourcePayload * payload = data;
|
||||
assert(payload);
|
||||
|
||||
SendClipboardToFD(payload, mime_type, fd);
|
||||
}
|
||||
|
||||
static void
|
||||
zwp_selection_source_handle_cancelled(
|
||||
void *data,
|
||||
struct zwp_primary_selection_source_v1 *source)
|
||||
{
|
||||
CleanupClipboard(data);
|
||||
zwp_primary_selection_source_v1_destroy(source);
|
||||
}
|
||||
|
||||
static const struct zwp_primary_selection_source_v1_listener zwp_selection_source_listener = {
|
||||
.send = zwp_selection_source_handle_send,
|
||||
.cancelled = zwp_selection_source_handle_cancelled
|
||||
};
|
||||
|
||||
static jboolean
|
||||
initJavaRefs(JNIEnv* env, jclass wlClipboardClass)
|
||||
{
|
||||
GET_METHOD_RETURN(transferContentsWithTypeMID,
|
||||
wlClipboardClass,
|
||||
"transferContentsWithType",
|
||||
"(Ljava/awt/datatransfer/Transferable;Ljava/lang/String;I)V",
|
||||
JNI_FALSE);
|
||||
|
||||
GET_METHOD_RETURN(handleClipboardFormatMID,
|
||||
wlClipboardClass,
|
||||
"handleClipboardFormat",
|
||||
"(JLjava/lang/String;)V",
|
||||
JNI_FALSE);
|
||||
|
||||
GET_METHOD_RETURN(handleNewClipboardMID,
|
||||
wlClipboardClass,
|
||||
"handleNewClipboard",
|
||||
"(J)V",
|
||||
JNI_FALSE);
|
||||
|
||||
GET_FIELD_RETURN(isPrimaryFID,
|
||||
wlClipboardClass,
|
||||
"isPrimary",
|
||||
"Z",
|
||||
JNI_FALSE);
|
||||
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns JNI_TRUE if the WLClipboard referred to by wlClipboard
|
||||
* corresponds to the "primary selection" clipboard and JNI_FALSE
|
||||
* otherwise.
|
||||
* Depending on that, a different protocol must be used to communicate
|
||||
* with Wayland (zwp_primary_selection_device_manager_v1 and
|
||||
* wl_data_device_manager correspondingly).
|
||||
*/
|
||||
static jboolean
|
||||
isPrimarySelectionClipboard(JNIEnv* env, jobject wlClipboard)
|
||||
{
|
||||
return (*env)->GetBooleanField(env, wlClipboard, isPrimaryFID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes data common to all clipboard objects. Called once in
|
||||
* static initialization time of the WLClipboard class.
|
||||
*
|
||||
* Throws InternalError in case of any errors.
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_wl_WLClipboard_initIDs(
|
||||
JNIEnv *env,
|
||||
jclass wlClipboardClass)
|
||||
{
|
||||
if (!initJavaRefs(env, wlClipboardClass)) {
|
||||
JNU_ThrowInternalError(env, "Failed to find WLClipboard members");
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_sun_awt_wl_WLClipboard_createDataOfferQueue(
|
||||
JNIEnv *env,
|
||||
jclass wlClipboardClass)
|
||||
{
|
||||
struct wl_event_queue * queue = wl_display_create_queue(wl_display);
|
||||
if (queue == NULL) {
|
||||
JNU_ThrowInternalError(env, "Couldn't create an event queue for the clipboard");
|
||||
}
|
||||
|
||||
return ptr_to_jlong(queue);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_wl_WLClipboard_dispatchDataOfferQueueImpl(
|
||||
JNIEnv *env,
|
||||
jclass wlClipboardClass,
|
||||
jlong dataOfferQueuePtr)
|
||||
{
|
||||
struct wl_event_queue * queue = jlong_to_ptr(dataOfferQueuePtr);
|
||||
assert (queue != NULL);
|
||||
|
||||
while (wl_display_dispatch_queue(wl_display, queue) != -1) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes data for a specific clipboard object (the primary selection
|
||||
* or the regular one). Called once per clipboard type.
|
||||
*
|
||||
* Returns the native handle to the corresponding clipboard.
|
||||
*
|
||||
* Throws UnsupportedOperationException in case of the primary selection
|
||||
* clipboard is not available and isPrimary is true.
|
||||
* Throws IllegalStateException in case of double-initialization.
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_sun_awt_wl_WLClipboard_initNative(
|
||||
JNIEnv *env,
|
||||
jobject obj,
|
||||
jboolean isPrimary)
|
||||
{
|
||||
if (!isPrimary) {
|
||||
if (wl_data_device != NULL) {
|
||||
JNU_ThrowByName(env, "java/lang/IllegalStateException", "one data device has already been created");
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (zwp_selection_device != NULL) {
|
||||
JNU_ThrowByName(env,
|
||||
"java/lang/IllegalStateException",
|
||||
"one primary selection device has already been created");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
jobject clipboardGlobalRef = (*env)->NewGlobalRef(env, obj); // normally never deleted
|
||||
CHECK_NULL_RETURN(clipboardGlobalRef, 0);
|
||||
DataOfferPayload *payload = DataOfferPayload_Create(clipboardGlobalRef);
|
||||
if (payload == NULL) {
|
||||
(*env)->DeleteGlobalRef(env, clipboardGlobalRef);
|
||||
}
|
||||
CHECK_NULL_THROW_OOME_RETURN(env, payload, "failed to allocate memory for DataOfferPayload", 0);
|
||||
|
||||
if (!isPrimary) {
|
||||
// TODO: may be needed by DnD also, initialize in a common place
|
||||
wl_data_device = wl_data_device_manager_get_data_device(wl_ddm, wl_seat);
|
||||
wl_data_device_add_listener(wl_data_device, &wl_data_device_listener, payload);
|
||||
} else {
|
||||
if (zwp_selection_dm != NULL) {
|
||||
zwp_selection_device = zwp_primary_selection_device_manager_v1_get_device(zwp_selection_dm, wl_seat);
|
||||
zwp_primary_selection_device_v1_add_listener(zwp_selection_device, &zwp_selection_device_listener, payload);
|
||||
} else {
|
||||
(*env)->DeleteGlobalRef(env, clipboardGlobalRef);
|
||||
JNU_ThrowByName(env,
|
||||
"java/lang/UnsupportedOperationException",
|
||||
"zwp_primary_selection_device_manager_v1 not available");
|
||||
}
|
||||
}
|
||||
|
||||
return ptr_to_jlong(wl_data_device);
|
||||
}
|
||||
|
||||
static jboolean
|
||||
announceMimeTypesForSource(
|
||||
JNIEnv * env,
|
||||
jboolean isPrimary,
|
||||
jobjectArray mimeTypes,
|
||||
data_source_t source)
|
||||
{
|
||||
jint length = (*env)->GetArrayLength(env, mimeTypes);
|
||||
for (jint i = 0; i < length; i++) {
|
||||
jstring s = (*env)->GetObjectArrayElement(env, mimeTypes, i);
|
||||
JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
|
||||
const char *mimeType = (*env)->GetStringUTFChars(env, s, JNI_FALSE);
|
||||
CHECK_NULL_RETURN(mimeType, JNI_FALSE);
|
||||
|
||||
if (isPrimary) {
|
||||
zwp_primary_selection_source_v1_offer((struct zwp_primary_selection_source_v1 *)source, mimeType);
|
||||
} else {
|
||||
wl_data_source_offer((struct wl_data_source *)source, mimeType);
|
||||
}
|
||||
(*env)->ReleaseStringUTFChars(env, s, mimeType);
|
||||
(*env)->DeleteLocalRef(env, s);
|
||||
}
|
||||
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
static jboolean
|
||||
offerData(
|
||||
JNIEnv* env,
|
||||
DataSourcePayload * payload,
|
||||
jboolean isPrimary,
|
||||
jlong eventSerial,
|
||||
jobjectArray mimeTypes,
|
||||
jlong dataOfferQueuePtr)
|
||||
{
|
||||
data_source_t source = isPrimary
|
||||
? (data_source_t)zwp_primary_selection_device_manager_v1_create_source(zwp_selection_dm)
|
||||
: (data_source_t)wl_data_device_manager_create_data_source(wl_ddm);
|
||||
|
||||
if (source != NULL) {
|
||||
wl_proxy_set_queue((struct wl_proxy*)source, jlong_to_ptr(dataOfferQueuePtr));
|
||||
|
||||
if (isPrimary) {
|
||||
zwp_primary_selection_source_v1_add_listener(
|
||||
(struct zwp_primary_selection_source_v1 *)source,
|
||||
&zwp_selection_source_listener,
|
||||
payload);
|
||||
} else {
|
||||
wl_data_source_add_listener(
|
||||
(struct wl_data_source *)source,
|
||||
&wl_data_source_listener,
|
||||
payload);
|
||||
}
|
||||
|
||||
if (mimeTypes != NULL) {
|
||||
if (!announceMimeTypesForSource(env, isPrimary, mimeTypes, source)) {
|
||||
if (isPrimary) {
|
||||
zwp_primary_selection_source_v1_destroy(source);
|
||||
} else {
|
||||
wl_data_source_destroy(source);
|
||||
}
|
||||
return JNI_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (isPrimary) {
|
||||
zwp_primary_selection_device_v1_set_selection(
|
||||
zwp_selection_device,
|
||||
(struct zwp_primary_selection_source_v1 *)source,
|
||||
eventSerial);
|
||||
}
|
||||
else {
|
||||
wl_data_device_set_selection(
|
||||
wl_data_device,
|
||||
(struct wl_data_source *)source,
|
||||
eventSerial);
|
||||
}
|
||||
}
|
||||
|
||||
return source != NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes Wayland aware of the availability of new clipboard content in the
|
||||
* given MIME formats.
|
||||
* Retains the reference to clipboard content for the further use when the actual
|
||||
* clipboard data get requested.
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_wl_WLClipboard_offerData(
|
||||
JNIEnv *env,
|
||||
jobject obj,
|
||||
jlong eventSerial,
|
||||
jobjectArray mimeTypes,
|
||||
jobject content,
|
||||
jlong dataOfferQueuePtr)
|
||||
{
|
||||
jobject clipboardGlobalRef = (*env)->NewGlobalRef(env, obj); // deleted by ...source_handle_cancelled()
|
||||
CHECK_NULL(clipboardGlobalRef);
|
||||
jobject contentGlobalRef = (*env)->NewGlobalRef(env, content); // deleted by ...source_handle_cancelled()
|
||||
CHECK_NULL(contentGlobalRef);
|
||||
|
||||
DataSourcePayload * payload = DataSourcePayload_Create(clipboardGlobalRef, contentGlobalRef);
|
||||
if (payload == NULL) {
|
||||
(*env)->DeleteGlobalRef(env, clipboardGlobalRef);
|
||||
(*env)->DeleteGlobalRef(env, contentGlobalRef);
|
||||
}
|
||||
CHECK_NULL_THROW_OOME(env, payload, "failed to allocate memory for DataSourcePayload");
|
||||
|
||||
const jboolean isPrimary = isPrimarySelectionClipboard(env, obj);
|
||||
if (!offerData(env,payload, isPrimary, eventSerial, mimeTypes, dataOfferQueuePtr)) {
|
||||
// Failed to create a data source; give up and cleanup.
|
||||
CleanupClipboard(payload);
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_wl_WLClipboard_cancelOffer(
|
||||
JNIEnv *env,
|
||||
jobject obj,
|
||||
jlong eventSerial)
|
||||
{
|
||||
// This should automatically deliver the "cancelled" event where we clean up
|
||||
// both the previous source and the global reference to the transferable object.
|
||||
const jboolean isPrimary = isPrimarySelectionClipboard(env, obj);
|
||||
if (isPrimary) {
|
||||
zwp_primary_selection_device_v1_set_selection(zwp_selection_device, NULL, eventSerial);
|
||||
} else {
|
||||
wl_data_device_set_selection(wl_data_device, NULL, eventSerial);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Asks Wayland to provide the data for the clipboard in the given MIME
|
||||
* format.
|
||||
*
|
||||
* Returns the file desriptor from which the data must be read or -1
|
||||
* in case of an error.
|
||||
*
|
||||
* NB: the returned file descriptor must be closed by the caller.
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_sun_awt_wl_WLClipboard_requestDataInFormat(
|
||||
JNIEnv *env,
|
||||
jobject obj,
|
||||
jlong clipboardNativePtr,
|
||||
jstring mimeTypeJava)
|
||||
{
|
||||
assert (clipboardNativePtr != 0);
|
||||
const jboolean isPrimary = isPrimarySelectionClipboard(env, obj);
|
||||
|
||||
int fd = -1; // The file descriptor the clipboard data will be read from by Java
|
||||
|
||||
const char * mimeType = (*env)->GetStringUTFChars(env, mimeTypeJava, NULL);
|
||||
if (mimeType) {
|
||||
int fds[2];
|
||||
int rc = pipe(fds);
|
||||
if (rc == 0) {
|
||||
if (isPrimary) {
|
||||
struct zwp_primary_selection_offer_v1 * offer = jlong_to_ptr(clipboardNativePtr);
|
||||
zwp_primary_selection_offer_v1_receive(offer, mimeType, fds[1]);
|
||||
} else {
|
||||
struct wl_data_offer * offer = jlong_to_ptr(clipboardNativePtr);
|
||||
wl_data_offer_receive(offer, mimeType, fds[1]);
|
||||
}
|
||||
close(fds[1]); // close the "sender" end of the pipe
|
||||
fd = fds[0];
|
||||
}
|
||||
(*env)->ReleaseStringUTFChars(env, mimeTypeJava, mimeType);
|
||||
}
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroys the corresponding Wayland proxy objects pointed to by clipboardNativePtr.
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_wl_WLClipboard_destroyClipboard(
|
||||
JNIEnv *env,
|
||||
jobject obj,
|
||||
jlong clipboardNativePtr)
|
||||
{
|
||||
assert(clipboardNativePtr != 0);
|
||||
|
||||
if (isPrimarySelectionClipboard(env, obj)) {
|
||||
struct zwp_primary_selection_offer_v1 * offer = jlong_to_ptr(clipboardNativePtr);
|
||||
zwp_primary_selection_offer_v1_destroy(offer);
|
||||
} else {
|
||||
struct wl_data_offer * offer = jlong_to_ptr(clipboardNativePtr);
|
||||
wl_data_offer_destroy(offer);
|
||||
}
|
||||
}
|
||||
@@ -28,8 +28,9 @@
|
||||
#include <jni.h>
|
||||
#include <Trace.h>
|
||||
#include <assert.h>
|
||||
#include <gtk-shell1-client-protocol.h>
|
||||
|
||||
#include "jni_util.h"
|
||||
#include "JNIUtilities.h"
|
||||
#include "WLToolkit.h"
|
||||
#include "WLRobotPeer.h"
|
||||
#include "WLGraphicsEnvironment.h"
|
||||
@@ -88,6 +89,7 @@ struct WLFrame {
|
||||
jobject nativeFramePeer; // weak reference
|
||||
struct wl_surface *wl_surface;
|
||||
struct xdg_surface *xdg_surface;
|
||||
struct gtk_surface1 *gtk_surface;
|
||||
struct WLFrame *parent;
|
||||
struct xdg_positioner *xdg_positioner;
|
||||
struct activation_token_list_item *activation_token_list;
|
||||
@@ -409,7 +411,7 @@ Java_sun_awt_wl_WLComponentPeer_nativeRequestUnsetFullScreen
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_wl_WLComponentPeer_nativeCreateWLSurface
|
||||
(JNIEnv *env, jobject obj, jlong ptr, jlong parentPtr,
|
||||
jint x, jint y,
|
||||
jint x, jint y, jboolean isModal,
|
||||
jstring title, jstring appid)
|
||||
{
|
||||
struct WLFrame *frame = (struct WLFrame *) ptr;
|
||||
@@ -417,6 +419,9 @@ Java_sun_awt_wl_WLComponentPeer_nativeCreateWLSurface
|
||||
if (frame->wl_surface) return;
|
||||
frame->wl_surface = wl_compositor_create_surface(wl_compositor);
|
||||
frame->xdg_surface = xdg_wm_base_get_xdg_surface(xdg_wm_base, frame->wl_surface);
|
||||
if (gtk_shell1 != NULL) {
|
||||
frame->gtk_surface = gtk_shell1_get_gtk_surface(gtk_shell1, frame->wl_surface);
|
||||
}
|
||||
|
||||
wl_surface_add_listener(frame->wl_surface, &wl_surface_listener, frame);
|
||||
xdg_surface_add_listener(frame->xdg_surface, &xdg_surface_listener, frame);
|
||||
@@ -433,6 +438,10 @@ Java_sun_awt_wl_WLComponentPeer_nativeCreateWLSurface
|
||||
xdg_toplevel_set_parent(frame->xdg_toplevel, parentFrame->xdg_toplevel);
|
||||
}
|
||||
|
||||
if (isModal && frame->gtk_surface != NULL) {
|
||||
gtk_surface1_set_modal(frame->gtk_surface);
|
||||
}
|
||||
|
||||
#ifdef WAKEFIELD_ROBOT
|
||||
if (wakefield) {
|
||||
// TODO: this doesn't work quite as expected for some reason
|
||||
@@ -495,6 +504,12 @@ DoHide(struct WLFrame *frame)
|
||||
} else {
|
||||
xdg_popup_destroy(frame->xdg_popup);
|
||||
}
|
||||
if (wl_surface_in_focus == frame->wl_surface) {
|
||||
wl_surface_in_focus = NULL;
|
||||
}
|
||||
if (frame->gtk_surface != NULL) {
|
||||
gtk_surface1_destroy(frame->gtk_surface);
|
||||
}
|
||||
xdg_surface_destroy(frame->xdg_surface);
|
||||
wl_surface_destroy(frame->wl_surface);
|
||||
delete_all_tokens(frame->activation_token_list);
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <Trace.h>
|
||||
|
||||
#include "jni_util.h"
|
||||
#include "JNIUtilities.h"
|
||||
#include "WLToolkit.h"
|
||||
#include "VKBase.h"
|
||||
|
||||
|
||||
@@ -39,8 +39,10 @@
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "gtk-shell1-client-protocol.h"
|
||||
|
||||
#include "jvm_md.h"
|
||||
#include "jni_util.h"
|
||||
#include "JNIUtilities.h"
|
||||
#include "awt.h"
|
||||
#include "sun_awt_wl_WLToolkit.h"
|
||||
#include "WLToolkit.h"
|
||||
@@ -59,6 +61,7 @@ struct wl_shm *wl_shm = NULL;
|
||||
struct wl_compositor *wl_compositor = NULL;
|
||||
struct xdg_wm_base *xdg_wm_base = NULL;
|
||||
struct xdg_activation_v1 *xdg_activation_v1 = NULL;
|
||||
struct gtk_shell1* gtk_shell1 = NULL;
|
||||
struct wl_seat *wl_seat = NULL;
|
||||
|
||||
struct wl_keyboard *wl_keyboard;
|
||||
@@ -67,6 +70,8 @@ struct wl_pointer *wl_pointer;
|
||||
struct wl_cursor_theme *wl_cursor_theme = NULL;
|
||||
|
||||
struct wl_surface *wl_surface_in_focus = NULL;
|
||||
struct wl_data_device_manager *wl_ddm = NULL;
|
||||
struct zwp_primary_selection_device_manager_v1 *zwp_selection_dm = NULL;
|
||||
|
||||
uint32_t last_mouse_pressed_serial = 0;
|
||||
uint32_t last_pointer_enter_serial = 0;
|
||||
@@ -684,7 +689,14 @@ registry_global(void *data, struct wl_registry *wl_registry,
|
||||
process_new_listener_before_end_of_init();
|
||||
} else if (strcmp(interface, xdg_activation_v1_interface.name) == 0) {
|
||||
xdg_activation_v1 = wl_registry_bind(wl_registry, name, &xdg_activation_v1_interface, 1);
|
||||
} else if (strcmp(interface, gtk_shell1_interface.name) == 0) {
|
||||
gtk_shell1 = wl_registry_bind(wl_registry, name, >k_shell1_interface, 1);
|
||||
} else if (strcmp(interface, wl_data_device_manager_interface.name) == 0) {
|
||||
wl_ddm = wl_registry_bind(wl_registry, name,&wl_data_device_manager_interface, 3);
|
||||
} else if (strcmp(interface, zwp_primary_selection_device_manager_v1_interface.name) == 0) {
|
||||
zwp_selection_dm = wl_registry_bind(wl_registry, name,&zwp_primary_selection_device_manager_v1_interface, 1);
|
||||
}
|
||||
|
||||
#ifdef WAKEFIELD_ROBOT
|
||||
else if (strcmp(interface, wakefield_interface.name) == 0) {
|
||||
wakefield = wl_registry_bind(wl_registry, name, &wakefield_interface, 1);
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <wayland-cursor.h>
|
||||
#include "xdg-shell-client-protocol.h"
|
||||
#include "xdg-activation-v1-client-protocol.h"
|
||||
#include "primary-selection-client-protocol.h"
|
||||
|
||||
#define CHECK_NULL_THROW_OOME_RETURN(env, x, msg, z)\
|
||||
do { \
|
||||
@@ -44,13 +45,19 @@
|
||||
} \
|
||||
} while(0) \
|
||||
|
||||
struct gtk_shell1;
|
||||
|
||||
extern struct wl_seat *wl_seat;
|
||||
extern struct wl_display *wl_display;
|
||||
extern struct wl_pointer *wl_pointer;
|
||||
extern struct wl_compositor *wl_compositor;
|
||||
extern struct xdg_wm_base *xdg_wm_base;
|
||||
extern struct xdg_activation_v1 *xdg_activation_v1;
|
||||
extern struct gtk_shell1* gtk_shell1; // optional, check for NULL before use
|
||||
|
||||
extern struct wl_cursor_theme *wl_cursor_theme;
|
||||
extern struct wl_data_device_manager *wl_ddm;
|
||||
extern struct zwp_primary_selection_device_manager_v1 *zwp_selection_dm;
|
||||
|
||||
extern struct wl_surface *wl_surface_in_focus;
|
||||
|
||||
|
||||
@@ -0,0 +1,430 @@
|
||||
/* Generated by wayland-scanner 1.19.0 */
|
||||
|
||||
#ifndef GTK_CLIENT_PROTOCOL_H
|
||||
#define GTK_CLIENT_PROTOCOL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "wayland-client.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @page page_gtk The gtk protocol
|
||||
* @section page_ifaces_gtk Interfaces
|
||||
* - @subpage page_iface_gtk_shell1 - gtk specific extensions
|
||||
* - @subpage page_iface_gtk_surface1 -
|
||||
*/
|
||||
struct gtk_shell1;
|
||||
struct gtk_surface1;
|
||||
struct wl_seat;
|
||||
struct wl_surface;
|
||||
|
||||
#ifndef GTK_SHELL1_INTERFACE
|
||||
#define GTK_SHELL1_INTERFACE
|
||||
/**
|
||||
* @page page_iface_gtk_shell1 gtk_shell1
|
||||
* @section page_iface_gtk_shell1_desc Description
|
||||
*
|
||||
* gtk_shell is a protocol extension providing additional features for
|
||||
* clients implementing it.
|
||||
* @section page_iface_gtk_shell1_api API
|
||||
* See @ref iface_gtk_shell1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_gtk_shell1 The gtk_shell1 interface
|
||||
*
|
||||
* gtk_shell is a protocol extension providing additional features for
|
||||
* clients implementing it.
|
||||
*/
|
||||
extern const struct wl_interface gtk_shell1_interface;
|
||||
#endif
|
||||
#ifndef GTK_SURFACE1_INTERFACE
|
||||
#define GTK_SURFACE1_INTERFACE
|
||||
/**
|
||||
* @page page_iface_gtk_surface1 gtk_surface1
|
||||
* @section page_iface_gtk_surface1_api API
|
||||
* See @ref iface_gtk_surface1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_gtk_surface1 The gtk_surface1 interface
|
||||
*/
|
||||
extern const struct wl_interface gtk_surface1_interface;
|
||||
#endif
|
||||
|
||||
#ifndef GTK_SHELL1_CAPABILITY_ENUM
|
||||
#define GTK_SHELL1_CAPABILITY_ENUM
|
||||
enum gtk_shell1_capability {
|
||||
GTK_SHELL1_CAPABILITY_GLOBAL_APP_MENU = 1,
|
||||
GTK_SHELL1_CAPABILITY_GLOBAL_MENU_BAR = 2,
|
||||
GTK_SHELL1_CAPABILITY_DESKTOP_ICONS = 3,
|
||||
};
|
||||
#endif /* GTK_SHELL1_CAPABILITY_ENUM */
|
||||
|
||||
/**
|
||||
* @ingroup iface_gtk_shell1
|
||||
* @struct gtk_shell1_listener
|
||||
*/
|
||||
struct gtk_shell1_listener {
|
||||
/**
|
||||
*/
|
||||
void (*capabilities)(void *data,
|
||||
struct gtk_shell1 *gtk_shell1,
|
||||
uint32_t capabilities);
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup iface_gtk_shell1
|
||||
*/
|
||||
static inline int
|
||||
gtk_shell1_add_listener(struct gtk_shell1 *gtk_shell1,
|
||||
const struct gtk_shell1_listener *listener, void *data)
|
||||
{
|
||||
return wl_proxy_add_listener((struct wl_proxy *) gtk_shell1,
|
||||
(void (**)(void)) listener, data);
|
||||
}
|
||||
|
||||
#define GTK_SHELL1_GET_GTK_SURFACE 0
|
||||
#define GTK_SHELL1_SET_STARTUP_ID 1
|
||||
#define GTK_SHELL1_SYSTEM_BELL 2
|
||||
#define GTK_SHELL1_NOTIFY_LAUNCH 3
|
||||
|
||||
/**
|
||||
* @ingroup iface_gtk_shell1
|
||||
*/
|
||||
#define GTK_SHELL1_CAPABILITIES_SINCE_VERSION 1
|
||||
|
||||
/**
|
||||
* @ingroup iface_gtk_shell1
|
||||
*/
|
||||
#define GTK_SHELL1_GET_GTK_SURFACE_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_gtk_shell1
|
||||
*/
|
||||
#define GTK_SHELL1_SET_STARTUP_ID_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_gtk_shell1
|
||||
*/
|
||||
#define GTK_SHELL1_SYSTEM_BELL_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_gtk_shell1
|
||||
*/
|
||||
#define GTK_SHELL1_NOTIFY_LAUNCH_SINCE_VERSION 3
|
||||
|
||||
/** @ingroup iface_gtk_shell1 */
|
||||
static inline void
|
||||
gtk_shell1_set_user_data(struct gtk_shell1 *gtk_shell1, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) gtk_shell1, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_gtk_shell1 */
|
||||
static inline void *
|
||||
gtk_shell1_get_user_data(struct gtk_shell1 *gtk_shell1)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) gtk_shell1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
gtk_shell1_get_version(struct gtk_shell1 *gtk_shell1)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) gtk_shell1);
|
||||
}
|
||||
|
||||
/** @ingroup iface_gtk_shell1 */
|
||||
static inline void
|
||||
gtk_shell1_destroy(struct gtk_shell1 *gtk_shell1)
|
||||
{
|
||||
wl_proxy_destroy((struct wl_proxy *) gtk_shell1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_gtk_shell1
|
||||
*/
|
||||
static inline struct gtk_surface1 *
|
||||
gtk_shell1_get_gtk_surface(struct gtk_shell1 *gtk_shell1, struct wl_surface *surface)
|
||||
{
|
||||
struct wl_proxy *gtk_surface;
|
||||
|
||||
gtk_surface = wl_proxy_marshal_constructor((struct wl_proxy *) gtk_shell1,
|
||||
GTK_SHELL1_GET_GTK_SURFACE, >k_surface1_interface, NULL, surface);
|
||||
|
||||
return (struct gtk_surface1 *) gtk_surface;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_gtk_shell1
|
||||
*/
|
||||
static inline void
|
||||
gtk_shell1_set_startup_id(struct gtk_shell1 *gtk_shell1, const char *startup_id)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) gtk_shell1,
|
||||
GTK_SHELL1_SET_STARTUP_ID, startup_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_gtk_shell1
|
||||
*/
|
||||
static inline void
|
||||
gtk_shell1_system_bell(struct gtk_shell1 *gtk_shell1, struct gtk_surface1 *surface)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) gtk_shell1,
|
||||
GTK_SHELL1_SYSTEM_BELL, surface);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_gtk_shell1
|
||||
*/
|
||||
static inline void
|
||||
gtk_shell1_notify_launch(struct gtk_shell1 *gtk_shell1, const char *startup_id)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) gtk_shell1,
|
||||
GTK_SHELL1_NOTIFY_LAUNCH, startup_id);
|
||||
}
|
||||
|
||||
#ifndef GTK_SURFACE1_STATE_ENUM
|
||||
#define GTK_SURFACE1_STATE_ENUM
|
||||
enum gtk_surface1_state {
|
||||
GTK_SURFACE1_STATE_TILED = 1,
|
||||
/**
|
||||
* @since 2
|
||||
*/
|
||||
GTK_SURFACE1_STATE_TILED_TOP = 2,
|
||||
/**
|
||||
* @since 2
|
||||
*/
|
||||
GTK_SURFACE1_STATE_TILED_RIGHT = 3,
|
||||
/**
|
||||
* @since 2
|
||||
*/
|
||||
GTK_SURFACE1_STATE_TILED_BOTTOM = 4,
|
||||
/**
|
||||
* @since 2
|
||||
*/
|
||||
GTK_SURFACE1_STATE_TILED_LEFT = 5,
|
||||
};
|
||||
/**
|
||||
* @ingroup iface_gtk_surface1
|
||||
*/
|
||||
#define GTK_SURFACE1_STATE_TILED_TOP_SINCE_VERSION 2
|
||||
/**
|
||||
* @ingroup iface_gtk_surface1
|
||||
*/
|
||||
#define GTK_SURFACE1_STATE_TILED_RIGHT_SINCE_VERSION 2
|
||||
/**
|
||||
* @ingroup iface_gtk_surface1
|
||||
*/
|
||||
#define GTK_SURFACE1_STATE_TILED_BOTTOM_SINCE_VERSION 2
|
||||
/**
|
||||
* @ingroup iface_gtk_surface1
|
||||
*/
|
||||
#define GTK_SURFACE1_STATE_TILED_LEFT_SINCE_VERSION 2
|
||||
#endif /* GTK_SURFACE1_STATE_ENUM */
|
||||
|
||||
#ifndef GTK_SURFACE1_EDGE_CONSTRAINT_ENUM
|
||||
#define GTK_SURFACE1_EDGE_CONSTRAINT_ENUM
|
||||
enum gtk_surface1_edge_constraint {
|
||||
GTK_SURFACE1_EDGE_CONSTRAINT_RESIZABLE_TOP = 1,
|
||||
GTK_SURFACE1_EDGE_CONSTRAINT_RESIZABLE_RIGHT = 2,
|
||||
GTK_SURFACE1_EDGE_CONSTRAINT_RESIZABLE_BOTTOM = 3,
|
||||
GTK_SURFACE1_EDGE_CONSTRAINT_RESIZABLE_LEFT = 4,
|
||||
};
|
||||
#endif /* GTK_SURFACE1_EDGE_CONSTRAINT_ENUM */
|
||||
|
||||
#ifndef GTK_SURFACE1_GESTURE_ENUM
|
||||
#define GTK_SURFACE1_GESTURE_ENUM
|
||||
enum gtk_surface1_gesture {
|
||||
GTK_SURFACE1_GESTURE_DOUBLE_CLICK = 1,
|
||||
GTK_SURFACE1_GESTURE_RIGHT_CLICK = 2,
|
||||
GTK_SURFACE1_GESTURE_MIDDLE_CLICK = 3,
|
||||
};
|
||||
#endif /* GTK_SURFACE1_GESTURE_ENUM */
|
||||
|
||||
#ifndef GTK_SURFACE1_ERROR_ENUM
|
||||
#define GTK_SURFACE1_ERROR_ENUM
|
||||
enum gtk_surface1_error {
|
||||
GTK_SURFACE1_ERROR_INVALID_GESTURE = 0,
|
||||
};
|
||||
#endif /* GTK_SURFACE1_ERROR_ENUM */
|
||||
|
||||
/**
|
||||
* @ingroup iface_gtk_surface1
|
||||
* @struct gtk_surface1_listener
|
||||
*/
|
||||
struct gtk_surface1_listener {
|
||||
/**
|
||||
*/
|
||||
void (*configure)(void *data,
|
||||
struct gtk_surface1 *gtk_surface1,
|
||||
struct wl_array *states);
|
||||
/**
|
||||
* @since 2
|
||||
*/
|
||||
void (*configure_edges)(void *data,
|
||||
struct gtk_surface1 *gtk_surface1,
|
||||
struct wl_array *constraints);
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup iface_gtk_surface1
|
||||
*/
|
||||
static inline int
|
||||
gtk_surface1_add_listener(struct gtk_surface1 *gtk_surface1,
|
||||
const struct gtk_surface1_listener *listener, void *data)
|
||||
{
|
||||
return wl_proxy_add_listener((struct wl_proxy *) gtk_surface1,
|
||||
(void (**)(void)) listener, data);
|
||||
}
|
||||
|
||||
#define GTK_SURFACE1_SET_DBUS_PROPERTIES 0
|
||||
#define GTK_SURFACE1_SET_MODAL 1
|
||||
#define GTK_SURFACE1_UNSET_MODAL 2
|
||||
#define GTK_SURFACE1_PRESENT 3
|
||||
#define GTK_SURFACE1_REQUEST_FOCUS 4
|
||||
#define GTK_SURFACE1_RELEASE 5
|
||||
#define GTK_SURFACE1_TITLEBAR_GESTURE 6
|
||||
|
||||
/**
|
||||
* @ingroup iface_gtk_surface1
|
||||
*/
|
||||
#define GTK_SURFACE1_CONFIGURE_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_gtk_surface1
|
||||
*/
|
||||
#define GTK_SURFACE1_CONFIGURE_EDGES_SINCE_VERSION 2
|
||||
|
||||
/**
|
||||
* @ingroup iface_gtk_surface1
|
||||
*/
|
||||
#define GTK_SURFACE1_SET_DBUS_PROPERTIES_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_gtk_surface1
|
||||
*/
|
||||
#define GTK_SURFACE1_SET_MODAL_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_gtk_surface1
|
||||
*/
|
||||
#define GTK_SURFACE1_UNSET_MODAL_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_gtk_surface1
|
||||
*/
|
||||
#define GTK_SURFACE1_PRESENT_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_gtk_surface1
|
||||
*/
|
||||
#define GTK_SURFACE1_REQUEST_FOCUS_SINCE_VERSION 3
|
||||
/**
|
||||
* @ingroup iface_gtk_surface1
|
||||
*/
|
||||
#define GTK_SURFACE1_RELEASE_SINCE_VERSION 4
|
||||
/**
|
||||
* @ingroup iface_gtk_surface1
|
||||
*/
|
||||
#define GTK_SURFACE1_TITLEBAR_GESTURE_SINCE_VERSION 5
|
||||
|
||||
/** @ingroup iface_gtk_surface1 */
|
||||
static inline void
|
||||
gtk_surface1_set_user_data(struct gtk_surface1 *gtk_surface1, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) gtk_surface1, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_gtk_surface1 */
|
||||
static inline void *
|
||||
gtk_surface1_get_user_data(struct gtk_surface1 *gtk_surface1)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) gtk_surface1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
gtk_surface1_get_version(struct gtk_surface1 *gtk_surface1)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) gtk_surface1);
|
||||
}
|
||||
|
||||
/** @ingroup iface_gtk_surface1 */
|
||||
static inline void
|
||||
gtk_surface1_destroy(struct gtk_surface1 *gtk_surface1)
|
||||
{
|
||||
wl_proxy_destroy((struct wl_proxy *) gtk_surface1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_gtk_surface1
|
||||
*/
|
||||
static inline void
|
||||
gtk_surface1_set_dbus_properties(struct gtk_surface1 *gtk_surface1, const char *application_id, const char *app_menu_path, const char *menubar_path, const char *window_object_path, const char *application_object_path, const char *unique_bus_name)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) gtk_surface1,
|
||||
GTK_SURFACE1_SET_DBUS_PROPERTIES, application_id, app_menu_path, menubar_path, window_object_path, application_object_path, unique_bus_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_gtk_surface1
|
||||
*/
|
||||
static inline void
|
||||
gtk_surface1_set_modal(struct gtk_surface1 *gtk_surface1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) gtk_surface1,
|
||||
GTK_SURFACE1_SET_MODAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_gtk_surface1
|
||||
*/
|
||||
static inline void
|
||||
gtk_surface1_unset_modal(struct gtk_surface1 *gtk_surface1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) gtk_surface1,
|
||||
GTK_SURFACE1_UNSET_MODAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_gtk_surface1
|
||||
*/
|
||||
static inline void
|
||||
gtk_surface1_present(struct gtk_surface1 *gtk_surface1, uint32_t time)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) gtk_surface1,
|
||||
GTK_SURFACE1_PRESENT, time);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_gtk_surface1
|
||||
*/
|
||||
static inline void
|
||||
gtk_surface1_request_focus(struct gtk_surface1 *gtk_surface1, const char *startup_id)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) gtk_surface1,
|
||||
GTK_SURFACE1_REQUEST_FOCUS, startup_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_gtk_surface1
|
||||
*/
|
||||
static inline void
|
||||
gtk_surface1_release(struct gtk_surface1 *gtk_surface1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) gtk_surface1,
|
||||
GTK_SURFACE1_RELEASE);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) gtk_surface1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_gtk_surface1
|
||||
*/
|
||||
static inline void
|
||||
gtk_surface1_titlebar_gesture(struct gtk_surface1 *gtk_surface1, uint32_t serial, struct wl_seat *seat, uint32_t gesture)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) gtk_surface1,
|
||||
GTK_SURFACE1_TITLEBAR_GESTURE, serial, seat, gesture);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,73 @@
|
||||
/* Generated by wayland-scanner 1.19.0 */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "wayland-util.h"
|
||||
|
||||
#ifndef __has_attribute
|
||||
# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
|
||||
#endif
|
||||
|
||||
#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4)
|
||||
#define WL_PRIVATE __attribute__ ((visibility("hidden")))
|
||||
#else
|
||||
#define WL_PRIVATE
|
||||
#endif
|
||||
|
||||
extern const struct wl_interface gtk_surface1_interface;
|
||||
extern const struct wl_interface wl_seat_interface;
|
||||
extern const struct wl_interface wl_surface_interface;
|
||||
|
||||
static const struct wl_interface *gtk_types[] = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
>k_surface1_interface,
|
||||
&wl_surface_interface,
|
||||
>k_surface1_interface,
|
||||
NULL,
|
||||
&wl_seat_interface,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const struct wl_message gtk_shell1_requests[] = {
|
||||
{ "get_gtk_surface", "no", gtk_types + 6 },
|
||||
{ "set_startup_id", "?s", gtk_types + 0 },
|
||||
{ "system_bell", "?o", gtk_types + 8 },
|
||||
{ "notify_launch", "3s", gtk_types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message gtk_shell1_events[] = {
|
||||
{ "capabilities", "u", gtk_types + 0 },
|
||||
};
|
||||
|
||||
WL_PRIVATE const struct wl_interface gtk_shell1_interface = {
|
||||
"gtk_shell1", 5,
|
||||
4, gtk_shell1_requests,
|
||||
1, gtk_shell1_events,
|
||||
};
|
||||
|
||||
static const struct wl_message gtk_surface1_requests[] = {
|
||||
{ "set_dbus_properties", "?s?s?s?s?s?s", gtk_types + 0 },
|
||||
{ "set_modal", "", gtk_types + 0 },
|
||||
{ "unset_modal", "", gtk_types + 0 },
|
||||
{ "present", "u", gtk_types + 0 },
|
||||
{ "request_focus", "3?s", gtk_types + 0 },
|
||||
{ "release", "4", gtk_types + 0 },
|
||||
{ "titlebar_gesture", "5uou", gtk_types + 9 },
|
||||
};
|
||||
|
||||
static const struct wl_message gtk_surface1_events[] = {
|
||||
{ "configure", "a", gtk_types + 0 },
|
||||
{ "configure_edges", "2a", gtk_types + 0 },
|
||||
};
|
||||
|
||||
WL_PRIVATE const struct wl_interface gtk_surface1_interface = {
|
||||
"gtk_surface1", 5,
|
||||
7, gtk_surface1_requests,
|
||||
2, gtk_surface1_events,
|
||||
};
|
||||
|
||||
@@ -0,0 +1,590 @@
|
||||
/* Generated by wayland-scanner 1.19.0 */
|
||||
|
||||
#ifndef WP_PRIMARY_SELECTION_UNSTABLE_V1_CLIENT_PROTOCOL_H
|
||||
#define WP_PRIMARY_SELECTION_UNSTABLE_V1_CLIENT_PROTOCOL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "wayland-client.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @page page_wp_primary_selection_unstable_v1 The wp_primary_selection_unstable_v1 protocol
|
||||
* Primary selection protocol
|
||||
*
|
||||
* @section page_desc_wp_primary_selection_unstable_v1 Description
|
||||
*
|
||||
* This protocol provides the ability to have a primary selection device to
|
||||
* match that of the X server. This primary selection is a shortcut to the
|
||||
* common clipboard selection, where text just needs to be selected in order
|
||||
* to allow copying it elsewhere. The de facto way to perform this action
|
||||
* is the middle mouse button, although it is not limited to this one.
|
||||
*
|
||||
* Clients wishing to honor primary selection should create a primary
|
||||
* selection source and set it as the selection through
|
||||
* wp_primary_selection_device.set_selection whenever the text selection
|
||||
* changes. In order to minimize calls in pointer-driven text selection,
|
||||
* it should happen only once after the operation finished. Similarly,
|
||||
* a NULL source should be set when text is unselected.
|
||||
*
|
||||
* wp_primary_selection_offer objects are first announced through the
|
||||
* wp_primary_selection_device.data_offer event. Immediately after this event,
|
||||
* the primary data offer will emit wp_primary_selection_offer.offer events
|
||||
* to let know of the mime types being offered.
|
||||
*
|
||||
* When the primary selection changes, the client with the keyboard focus
|
||||
* will receive wp_primary_selection_device.selection events. Only the client
|
||||
* with the keyboard focus will receive such events with a non-NULL
|
||||
* wp_primary_selection_offer. Across keyboard focus changes, previously
|
||||
* focused clients will receive wp_primary_selection_device.events with a
|
||||
* NULL wp_primary_selection_offer.
|
||||
*
|
||||
* In order to request the primary selection data, the client must pass
|
||||
* a recent serial pertaining to the press event that is triggering the
|
||||
* operation, if the compositor deems the serial valid and recent, the
|
||||
* wp_primary_selection_source.send event will happen in the other end
|
||||
* to let the transfer begin. The client owning the primary selection
|
||||
* should write the requested data, and close the file descriptor
|
||||
* immediately.
|
||||
*
|
||||
* If the primary selection owner client disappeared during the transfer,
|
||||
* the client reading the data will receive a
|
||||
* wp_primary_selection_device.selection event with a NULL
|
||||
* wp_primary_selection_offer, the client should take this as a hint
|
||||
* to finish the reads related to the no longer existing offer.
|
||||
*
|
||||
* The primary selection owner should be checking for errors during
|
||||
* writes, merely cancelling the ongoing transfer if any happened.
|
||||
*
|
||||
* @section page_ifaces_wp_primary_selection_unstable_v1 Interfaces
|
||||
* - @subpage page_iface_zwp_primary_selection_device_manager_v1 - X primary selection emulation
|
||||
* - @subpage page_iface_zwp_primary_selection_device_v1 -
|
||||
* - @subpage page_iface_zwp_primary_selection_offer_v1 - offer to transfer primary selection contents
|
||||
* - @subpage page_iface_zwp_primary_selection_source_v1 - offer to replace the contents of the primary selection
|
||||
* @section page_copyright_wp_primary_selection_unstable_v1 Copyright
|
||||
* <pre>
|
||||
*
|
||||
* Copyright © 2015, 2016 Red Hat
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
* </pre>
|
||||
*/
|
||||
struct wl_seat;
|
||||
struct zwp_primary_selection_device_manager_v1;
|
||||
struct zwp_primary_selection_device_v1;
|
||||
struct zwp_primary_selection_offer_v1;
|
||||
struct zwp_primary_selection_source_v1;
|
||||
|
||||
#ifndef ZWP_PRIMARY_SELECTION_DEVICE_MANAGER_V1_INTERFACE
|
||||
#define ZWP_PRIMARY_SELECTION_DEVICE_MANAGER_V1_INTERFACE
|
||||
/**
|
||||
* @page page_iface_zwp_primary_selection_device_manager_v1 zwp_primary_selection_device_manager_v1
|
||||
* @section page_iface_zwp_primary_selection_device_manager_v1_desc Description
|
||||
*
|
||||
* The primary selection device manager is a singleton global object that
|
||||
* provides access to the primary selection. It allows to create
|
||||
* wp_primary_selection_source objects, as well as retrieving the per-seat
|
||||
* wp_primary_selection_device objects.
|
||||
* @section page_iface_zwp_primary_selection_device_manager_v1_api API
|
||||
* See @ref iface_zwp_primary_selection_device_manager_v1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_zwp_primary_selection_device_manager_v1 The zwp_primary_selection_device_manager_v1 interface
|
||||
*
|
||||
* The primary selection device manager is a singleton global object that
|
||||
* provides access to the primary selection. It allows to create
|
||||
* wp_primary_selection_source objects, as well as retrieving the per-seat
|
||||
* wp_primary_selection_device objects.
|
||||
*/
|
||||
extern const struct wl_interface zwp_primary_selection_device_manager_v1_interface;
|
||||
#endif
|
||||
#ifndef ZWP_PRIMARY_SELECTION_DEVICE_V1_INTERFACE
|
||||
#define ZWP_PRIMARY_SELECTION_DEVICE_V1_INTERFACE
|
||||
/**
|
||||
* @page page_iface_zwp_primary_selection_device_v1 zwp_primary_selection_device_v1
|
||||
* @section page_iface_zwp_primary_selection_device_v1_api API
|
||||
* See @ref iface_zwp_primary_selection_device_v1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_zwp_primary_selection_device_v1 The zwp_primary_selection_device_v1 interface
|
||||
*/
|
||||
extern const struct wl_interface zwp_primary_selection_device_v1_interface;
|
||||
#endif
|
||||
#ifndef ZWP_PRIMARY_SELECTION_OFFER_V1_INTERFACE
|
||||
#define ZWP_PRIMARY_SELECTION_OFFER_V1_INTERFACE
|
||||
/**
|
||||
* @page page_iface_zwp_primary_selection_offer_v1 zwp_primary_selection_offer_v1
|
||||
* @section page_iface_zwp_primary_selection_offer_v1_desc Description
|
||||
*
|
||||
* A wp_primary_selection_offer represents an offer to transfer the contents
|
||||
* of the primary selection clipboard to the client. Similar to
|
||||
* wl_data_offer, the offer also describes the mime types that the data can
|
||||
* be converted to and provides the mechanisms for transferring the data
|
||||
* directly to the client.
|
||||
* @section page_iface_zwp_primary_selection_offer_v1_api API
|
||||
* See @ref iface_zwp_primary_selection_offer_v1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_zwp_primary_selection_offer_v1 The zwp_primary_selection_offer_v1 interface
|
||||
*
|
||||
* A wp_primary_selection_offer represents an offer to transfer the contents
|
||||
* of the primary selection clipboard to the client. Similar to
|
||||
* wl_data_offer, the offer also describes the mime types that the data can
|
||||
* be converted to and provides the mechanisms for transferring the data
|
||||
* directly to the client.
|
||||
*/
|
||||
extern const struct wl_interface zwp_primary_selection_offer_v1_interface;
|
||||
#endif
|
||||
#ifndef ZWP_PRIMARY_SELECTION_SOURCE_V1_INTERFACE
|
||||
#define ZWP_PRIMARY_SELECTION_SOURCE_V1_INTERFACE
|
||||
/**
|
||||
* @page page_iface_zwp_primary_selection_source_v1 zwp_primary_selection_source_v1
|
||||
* @section page_iface_zwp_primary_selection_source_v1_desc Description
|
||||
*
|
||||
* The source side of a wp_primary_selection_offer, it provides a way to
|
||||
* describe the offered data and respond to requests to transfer the
|
||||
* requested contents of the primary selection clipboard.
|
||||
* @section page_iface_zwp_primary_selection_source_v1_api API
|
||||
* See @ref iface_zwp_primary_selection_source_v1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_zwp_primary_selection_source_v1 The zwp_primary_selection_source_v1 interface
|
||||
*
|
||||
* The source side of a wp_primary_selection_offer, it provides a way to
|
||||
* describe the offered data and respond to requests to transfer the
|
||||
* requested contents of the primary selection clipboard.
|
||||
*/
|
||||
extern const struct wl_interface zwp_primary_selection_source_v1_interface;
|
||||
#endif
|
||||
|
||||
#define ZWP_PRIMARY_SELECTION_DEVICE_MANAGER_V1_CREATE_SOURCE 0
|
||||
#define ZWP_PRIMARY_SELECTION_DEVICE_MANAGER_V1_GET_DEVICE 1
|
||||
#define ZWP_PRIMARY_SELECTION_DEVICE_MANAGER_V1_DESTROY 2
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_device_manager_v1
|
||||
*/
|
||||
#define ZWP_PRIMARY_SELECTION_DEVICE_MANAGER_V1_CREATE_SOURCE_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_device_manager_v1
|
||||
*/
|
||||
#define ZWP_PRIMARY_SELECTION_DEVICE_MANAGER_V1_GET_DEVICE_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_device_manager_v1
|
||||
*/
|
||||
#define ZWP_PRIMARY_SELECTION_DEVICE_MANAGER_V1_DESTROY_SINCE_VERSION 1
|
||||
|
||||
/** @ingroup iface_zwp_primary_selection_device_manager_v1 */
|
||||
static inline void
|
||||
zwp_primary_selection_device_manager_v1_set_user_data(struct zwp_primary_selection_device_manager_v1 *zwp_primary_selection_device_manager_v1, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) zwp_primary_selection_device_manager_v1, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_zwp_primary_selection_device_manager_v1 */
|
||||
static inline void *
|
||||
zwp_primary_selection_device_manager_v1_get_user_data(struct zwp_primary_selection_device_manager_v1 *zwp_primary_selection_device_manager_v1)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) zwp_primary_selection_device_manager_v1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
zwp_primary_selection_device_manager_v1_get_version(struct zwp_primary_selection_device_manager_v1 *zwp_primary_selection_device_manager_v1)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) zwp_primary_selection_device_manager_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_device_manager_v1
|
||||
*
|
||||
* Create a new primary selection source.
|
||||
*/
|
||||
static inline struct zwp_primary_selection_source_v1 *
|
||||
zwp_primary_selection_device_manager_v1_create_source(struct zwp_primary_selection_device_manager_v1 *zwp_primary_selection_device_manager_v1)
|
||||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_constructor((struct wl_proxy *) zwp_primary_selection_device_manager_v1,
|
||||
ZWP_PRIMARY_SELECTION_DEVICE_MANAGER_V1_CREATE_SOURCE, &zwp_primary_selection_source_v1_interface, NULL);
|
||||
|
||||
return (struct zwp_primary_selection_source_v1 *) id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_device_manager_v1
|
||||
*
|
||||
* Create a new data device for a given seat.
|
||||
*/
|
||||
static inline struct zwp_primary_selection_device_v1 *
|
||||
zwp_primary_selection_device_manager_v1_get_device(struct zwp_primary_selection_device_manager_v1 *zwp_primary_selection_device_manager_v1, struct wl_seat *seat)
|
||||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_constructor((struct wl_proxy *) zwp_primary_selection_device_manager_v1,
|
||||
ZWP_PRIMARY_SELECTION_DEVICE_MANAGER_V1_GET_DEVICE, &zwp_primary_selection_device_v1_interface, NULL, seat);
|
||||
|
||||
return (struct zwp_primary_selection_device_v1 *) id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_device_manager_v1
|
||||
*
|
||||
* Destroy the primary selection device manager.
|
||||
*/
|
||||
static inline void
|
||||
zwp_primary_selection_device_manager_v1_destroy(struct zwp_primary_selection_device_manager_v1 *zwp_primary_selection_device_manager_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_primary_selection_device_manager_v1,
|
||||
ZWP_PRIMARY_SELECTION_DEVICE_MANAGER_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zwp_primary_selection_device_manager_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_device_v1
|
||||
* @struct zwp_primary_selection_device_v1_listener
|
||||
*/
|
||||
struct zwp_primary_selection_device_v1_listener {
|
||||
/**
|
||||
* introduce a new wp_primary_selection_offer
|
||||
*
|
||||
* Introduces a new wp_primary_selection_offer object that may be
|
||||
* used to receive the current primary selection. Immediately
|
||||
* following this event, the new wp_primary_selection_offer object
|
||||
* will send wp_primary_selection_offer.offer events to describe
|
||||
* the offered mime types.
|
||||
*/
|
||||
void (*data_offer)(void *data,
|
||||
struct zwp_primary_selection_device_v1 *zwp_primary_selection_device_v1,
|
||||
struct zwp_primary_selection_offer_v1 *offer);
|
||||
/**
|
||||
* advertise a new primary selection
|
||||
*
|
||||
* The wp_primary_selection_device.selection event is sent to
|
||||
* notify the client of a new primary selection. This event is sent
|
||||
* after the wp_primary_selection.data_offer event introducing this
|
||||
* object, and after the offer has announced its mimetypes through
|
||||
* wp_primary_selection_offer.offer.
|
||||
*
|
||||
* The data_offer is valid until a new offer or NULL is received or
|
||||
* until the client loses keyboard focus. The client must destroy
|
||||
* the previous selection data_offer, if any, upon receiving this
|
||||
* event.
|
||||
*/
|
||||
void (*selection)(void *data,
|
||||
struct zwp_primary_selection_device_v1 *zwp_primary_selection_device_v1,
|
||||
struct zwp_primary_selection_offer_v1 *id);
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_device_v1
|
||||
*/
|
||||
static inline int
|
||||
zwp_primary_selection_device_v1_add_listener(struct zwp_primary_selection_device_v1 *zwp_primary_selection_device_v1,
|
||||
const struct zwp_primary_selection_device_v1_listener *listener, void *data)
|
||||
{
|
||||
return wl_proxy_add_listener((struct wl_proxy *) zwp_primary_selection_device_v1,
|
||||
(void (**)(void)) listener, data);
|
||||
}
|
||||
|
||||
#define ZWP_PRIMARY_SELECTION_DEVICE_V1_SET_SELECTION 0
|
||||
#define ZWP_PRIMARY_SELECTION_DEVICE_V1_DESTROY 1
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_device_v1
|
||||
*/
|
||||
#define ZWP_PRIMARY_SELECTION_DEVICE_V1_DATA_OFFER_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_device_v1
|
||||
*/
|
||||
#define ZWP_PRIMARY_SELECTION_DEVICE_V1_SELECTION_SINCE_VERSION 1
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_device_v1
|
||||
*/
|
||||
#define ZWP_PRIMARY_SELECTION_DEVICE_V1_SET_SELECTION_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_device_v1
|
||||
*/
|
||||
#define ZWP_PRIMARY_SELECTION_DEVICE_V1_DESTROY_SINCE_VERSION 1
|
||||
|
||||
/** @ingroup iface_zwp_primary_selection_device_v1 */
|
||||
static inline void
|
||||
zwp_primary_selection_device_v1_set_user_data(struct zwp_primary_selection_device_v1 *zwp_primary_selection_device_v1, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) zwp_primary_selection_device_v1, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_zwp_primary_selection_device_v1 */
|
||||
static inline void *
|
||||
zwp_primary_selection_device_v1_get_user_data(struct zwp_primary_selection_device_v1 *zwp_primary_selection_device_v1)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) zwp_primary_selection_device_v1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
zwp_primary_selection_device_v1_get_version(struct zwp_primary_selection_device_v1 *zwp_primary_selection_device_v1)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) zwp_primary_selection_device_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_device_v1
|
||||
*
|
||||
* Replaces the current selection. The previous owner of the primary
|
||||
* selection will receive a wp_primary_selection_source.cancelled event.
|
||||
*
|
||||
* To unset the selection, set the source to NULL.
|
||||
*/
|
||||
static inline void
|
||||
zwp_primary_selection_device_v1_set_selection(struct zwp_primary_selection_device_v1 *zwp_primary_selection_device_v1, struct zwp_primary_selection_source_v1 *source, uint32_t serial)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_primary_selection_device_v1,
|
||||
ZWP_PRIMARY_SELECTION_DEVICE_V1_SET_SELECTION, source, serial);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_device_v1
|
||||
*
|
||||
* Destroy the primary selection device.
|
||||
*/
|
||||
static inline void
|
||||
zwp_primary_selection_device_v1_destroy(struct zwp_primary_selection_device_v1 *zwp_primary_selection_device_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_primary_selection_device_v1,
|
||||
ZWP_PRIMARY_SELECTION_DEVICE_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zwp_primary_selection_device_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_offer_v1
|
||||
* @struct zwp_primary_selection_offer_v1_listener
|
||||
*/
|
||||
struct zwp_primary_selection_offer_v1_listener {
|
||||
/**
|
||||
* advertise offered mime type
|
||||
*
|
||||
* Sent immediately after creating announcing the
|
||||
* wp_primary_selection_offer through
|
||||
* wp_primary_selection_device.data_offer. One event is sent per
|
||||
* offered mime type.
|
||||
*/
|
||||
void (*offer)(void *data,
|
||||
struct zwp_primary_selection_offer_v1 *zwp_primary_selection_offer_v1,
|
||||
const char *mime_type);
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_offer_v1
|
||||
*/
|
||||
static inline int
|
||||
zwp_primary_selection_offer_v1_add_listener(struct zwp_primary_selection_offer_v1 *zwp_primary_selection_offer_v1,
|
||||
const struct zwp_primary_selection_offer_v1_listener *listener, void *data)
|
||||
{
|
||||
return wl_proxy_add_listener((struct wl_proxy *) zwp_primary_selection_offer_v1,
|
||||
(void (**)(void)) listener, data);
|
||||
}
|
||||
|
||||
#define ZWP_PRIMARY_SELECTION_OFFER_V1_RECEIVE 0
|
||||
#define ZWP_PRIMARY_SELECTION_OFFER_V1_DESTROY 1
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_offer_v1
|
||||
*/
|
||||
#define ZWP_PRIMARY_SELECTION_OFFER_V1_OFFER_SINCE_VERSION 1
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_offer_v1
|
||||
*/
|
||||
#define ZWP_PRIMARY_SELECTION_OFFER_V1_RECEIVE_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_offer_v1
|
||||
*/
|
||||
#define ZWP_PRIMARY_SELECTION_OFFER_V1_DESTROY_SINCE_VERSION 1
|
||||
|
||||
/** @ingroup iface_zwp_primary_selection_offer_v1 */
|
||||
static inline void
|
||||
zwp_primary_selection_offer_v1_set_user_data(struct zwp_primary_selection_offer_v1 *zwp_primary_selection_offer_v1, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) zwp_primary_selection_offer_v1, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_zwp_primary_selection_offer_v1 */
|
||||
static inline void *
|
||||
zwp_primary_selection_offer_v1_get_user_data(struct zwp_primary_selection_offer_v1 *zwp_primary_selection_offer_v1)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) zwp_primary_selection_offer_v1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
zwp_primary_selection_offer_v1_get_version(struct zwp_primary_selection_offer_v1 *zwp_primary_selection_offer_v1)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) zwp_primary_selection_offer_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_offer_v1
|
||||
*
|
||||
* To transfer the contents of the primary selection clipboard, the client
|
||||
* issues this request and indicates the mime type that it wants to
|
||||
* receive. The transfer happens through the passed file descriptor
|
||||
* (typically created with the pipe system call). The source client writes
|
||||
* the data in the mime type representation requested and then closes the
|
||||
* file descriptor.
|
||||
*
|
||||
* The receiving client reads from the read end of the pipe until EOF and
|
||||
* closes its end, at which point the transfer is complete.
|
||||
*/
|
||||
static inline void
|
||||
zwp_primary_selection_offer_v1_receive(struct zwp_primary_selection_offer_v1 *zwp_primary_selection_offer_v1, const char *mime_type, int32_t fd)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_primary_selection_offer_v1,
|
||||
ZWP_PRIMARY_SELECTION_OFFER_V1_RECEIVE, mime_type, fd);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_offer_v1
|
||||
*
|
||||
* Destroy the primary selection offer.
|
||||
*/
|
||||
static inline void
|
||||
zwp_primary_selection_offer_v1_destroy(struct zwp_primary_selection_offer_v1 *zwp_primary_selection_offer_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_primary_selection_offer_v1,
|
||||
ZWP_PRIMARY_SELECTION_OFFER_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zwp_primary_selection_offer_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_source_v1
|
||||
* @struct zwp_primary_selection_source_v1_listener
|
||||
*/
|
||||
struct zwp_primary_selection_source_v1_listener {
|
||||
/**
|
||||
* send the primary selection contents
|
||||
*
|
||||
* Request for the current primary selection contents from the
|
||||
* client. Send the specified mime type over the passed file
|
||||
* descriptor, then close it.
|
||||
*/
|
||||
void (*send)(void *data,
|
||||
struct zwp_primary_selection_source_v1 *zwp_primary_selection_source_v1,
|
||||
const char *mime_type,
|
||||
int32_t fd);
|
||||
/**
|
||||
* request for primary selection contents was canceled
|
||||
*
|
||||
* This primary selection source is no longer valid. The client
|
||||
* should clean up and destroy this primary selection source.
|
||||
*/
|
||||
void (*cancelled)(void *data,
|
||||
struct zwp_primary_selection_source_v1 *zwp_primary_selection_source_v1);
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_source_v1
|
||||
*/
|
||||
static inline int
|
||||
zwp_primary_selection_source_v1_add_listener(struct zwp_primary_selection_source_v1 *zwp_primary_selection_source_v1,
|
||||
const struct zwp_primary_selection_source_v1_listener *listener, void *data)
|
||||
{
|
||||
return wl_proxy_add_listener((struct wl_proxy *) zwp_primary_selection_source_v1,
|
||||
(void (**)(void)) listener, data);
|
||||
}
|
||||
|
||||
#define ZWP_PRIMARY_SELECTION_SOURCE_V1_OFFER 0
|
||||
#define ZWP_PRIMARY_SELECTION_SOURCE_V1_DESTROY 1
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_source_v1
|
||||
*/
|
||||
#define ZWP_PRIMARY_SELECTION_SOURCE_V1_SEND_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_source_v1
|
||||
*/
|
||||
#define ZWP_PRIMARY_SELECTION_SOURCE_V1_CANCELLED_SINCE_VERSION 1
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_source_v1
|
||||
*/
|
||||
#define ZWP_PRIMARY_SELECTION_SOURCE_V1_OFFER_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_source_v1
|
||||
*/
|
||||
#define ZWP_PRIMARY_SELECTION_SOURCE_V1_DESTROY_SINCE_VERSION 1
|
||||
|
||||
/** @ingroup iface_zwp_primary_selection_source_v1 */
|
||||
static inline void
|
||||
zwp_primary_selection_source_v1_set_user_data(struct zwp_primary_selection_source_v1 *zwp_primary_selection_source_v1, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) zwp_primary_selection_source_v1, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_zwp_primary_selection_source_v1 */
|
||||
static inline void *
|
||||
zwp_primary_selection_source_v1_get_user_data(struct zwp_primary_selection_source_v1 *zwp_primary_selection_source_v1)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) zwp_primary_selection_source_v1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
zwp_primary_selection_source_v1_get_version(struct zwp_primary_selection_source_v1 *zwp_primary_selection_source_v1)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) zwp_primary_selection_source_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_source_v1
|
||||
*
|
||||
* This request adds a mime type to the set of mime types advertised to
|
||||
* targets. Can be called several times to offer multiple types.
|
||||
*/
|
||||
static inline void
|
||||
zwp_primary_selection_source_v1_offer(struct zwp_primary_selection_source_v1 *zwp_primary_selection_source_v1, const char *mime_type)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_primary_selection_source_v1,
|
||||
ZWP_PRIMARY_SELECTION_SOURCE_V1_OFFER, mime_type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_zwp_primary_selection_source_v1
|
||||
*
|
||||
* Destroy the primary selection source.
|
||||
*/
|
||||
static inline void
|
||||
zwp_primary_selection_source_v1_destroy(struct zwp_primary_selection_source_v1 *zwp_primary_selection_source_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) zwp_primary_selection_source_v1,
|
||||
ZWP_PRIMARY_SELECTION_SOURCE_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) zwp_primary_selection_source_v1);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,115 @@
|
||||
/* Generated by wayland-scanner 1.19.0 */
|
||||
|
||||
/*
|
||||
* Copyright © 2015, 2016 Red Hat
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "wayland-util.h"
|
||||
|
||||
#ifndef __has_attribute
|
||||
# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
|
||||
#endif
|
||||
|
||||
#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4)
|
||||
#define WL_PRIVATE __attribute__ ((visibility("hidden")))
|
||||
#else
|
||||
#define WL_PRIVATE
|
||||
#endif
|
||||
|
||||
extern const struct wl_interface wl_seat_interface;
|
||||
extern const struct wl_interface zwp_primary_selection_device_v1_interface;
|
||||
extern const struct wl_interface zwp_primary_selection_offer_v1_interface;
|
||||
extern const struct wl_interface zwp_primary_selection_source_v1_interface;
|
||||
|
||||
static const struct wl_interface *wp_primary_selection_unstable_v1_types[] = {
|
||||
NULL,
|
||||
NULL,
|
||||
&zwp_primary_selection_source_v1_interface,
|
||||
&zwp_primary_selection_device_v1_interface,
|
||||
&wl_seat_interface,
|
||||
&zwp_primary_selection_source_v1_interface,
|
||||
NULL,
|
||||
&zwp_primary_selection_offer_v1_interface,
|
||||
&zwp_primary_selection_offer_v1_interface,
|
||||
};
|
||||
|
||||
static const struct wl_message zwp_primary_selection_device_manager_v1_requests[] = {
|
||||
{ "create_source", "n", wp_primary_selection_unstable_v1_types + 2 },
|
||||
{ "get_device", "no", wp_primary_selection_unstable_v1_types + 3 },
|
||||
{ "destroy", "", wp_primary_selection_unstable_v1_types + 0 },
|
||||
};
|
||||
|
||||
WL_PRIVATE const struct wl_interface zwp_primary_selection_device_manager_v1_interface = {
|
||||
"zwp_primary_selection_device_manager_v1", 1,
|
||||
3, zwp_primary_selection_device_manager_v1_requests,
|
||||
0, NULL,
|
||||
};
|
||||
|
||||
static const struct wl_message zwp_primary_selection_device_v1_requests[] = {
|
||||
{ "set_selection", "?ou", wp_primary_selection_unstable_v1_types + 5 },
|
||||
{ "destroy", "", wp_primary_selection_unstable_v1_types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message zwp_primary_selection_device_v1_events[] = {
|
||||
{ "data_offer", "n", wp_primary_selection_unstable_v1_types + 7 },
|
||||
{ "selection", "?o", wp_primary_selection_unstable_v1_types + 8 },
|
||||
};
|
||||
|
||||
WL_PRIVATE const struct wl_interface zwp_primary_selection_device_v1_interface = {
|
||||
"zwp_primary_selection_device_v1", 1,
|
||||
2, zwp_primary_selection_device_v1_requests,
|
||||
2, zwp_primary_selection_device_v1_events,
|
||||
};
|
||||
|
||||
static const struct wl_message zwp_primary_selection_offer_v1_requests[] = {
|
||||
{ "receive", "sh", wp_primary_selection_unstable_v1_types + 0 },
|
||||
{ "destroy", "", wp_primary_selection_unstable_v1_types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message zwp_primary_selection_offer_v1_events[] = {
|
||||
{ "offer", "s", wp_primary_selection_unstable_v1_types + 0 },
|
||||
};
|
||||
|
||||
WL_PRIVATE const struct wl_interface zwp_primary_selection_offer_v1_interface = {
|
||||
"zwp_primary_selection_offer_v1", 1,
|
||||
2, zwp_primary_selection_offer_v1_requests,
|
||||
1, zwp_primary_selection_offer_v1_events,
|
||||
};
|
||||
|
||||
static const struct wl_message zwp_primary_selection_source_v1_requests[] = {
|
||||
{ "offer", "s", wp_primary_selection_unstable_v1_types + 0 },
|
||||
{ "destroy", "", wp_primary_selection_unstable_v1_types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message zwp_primary_selection_source_v1_events[] = {
|
||||
{ "send", "sh", wp_primary_selection_unstable_v1_types + 0 },
|
||||
{ "cancelled", "", wp_primary_selection_unstable_v1_types + 0 },
|
||||
};
|
||||
|
||||
WL_PRIVATE const struct wl_interface zwp_primary_selection_source_v1_interface = {
|
||||
"zwp_primary_selection_source_v1", 1,
|
||||
2, zwp_primary_selection_source_v1_requests,
|
||||
2, zwp_primary_selection_source_v1_events,
|
||||
};
|
||||
|
||||
0
src/java.desktop/unix/native/libawt_wlawt/xdg-activation-v1-client-protocol.h
Executable file → Normal file
0
src/java.desktop/unix/native/libawt_wlawt/xdg-activation-v1-client-protocol.h
Executable file → Normal file
0
src/java.desktop/unix/native/libawt_wlawt/xdg-activation-v1-protocol.c
Executable file → Normal file
0
src/java.desktop/unix/native/libawt_wlawt/xdg-activation-v1-protocol.c
Executable file → Normal file
@@ -259,7 +259,7 @@ vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi005/TestDescription
|
||||
gc/shenandoah/mxbeans/TestChurnNotifications.java#aggressive NO_BUG macosx_all
|
||||
|
||||
runtime/cds/appcds/CommandLineFlagCombo.java NO_BUG generic_all
|
||||
runtime/cds/appcds/TestDumpClassListSource.java NO_BUG generic_all
|
||||
runtime/cds/appcds/TestDumpClassListSource.java JBR-6099 generic_all
|
||||
runtime/cds/appcds/dynamicArchive/TestAutoCreateSharedArchiveNoDefaultArchive.java NO_BUG generic_all
|
||||
runtime/cds/appcds/dynamicArchive/TestAutoCreateSharedArchiveUpgrade.java NO_BUG generic_all
|
||||
|
||||
|
||||
@@ -789,6 +789,7 @@ jdk_containers_extended = \
|
||||
# Wayland tests to be executed with -Dawt.toolkit.name=WLToolkit
|
||||
jdk_awt_wayland = \
|
||||
:jdk_awt \
|
||||
jb/java/awt/wayland \
|
||||
-com/apple/eawt \
|
||||
-com/apple/laf \
|
||||
-sun/awt \
|
||||
|
||||
@@ -146,6 +146,7 @@ public class RowToleranceTransitivityTest {
|
||||
if (!setFocusOn(cb, new Runnable() {
|
||||
public void run() {
|
||||
robot.keyPress(KeyEvent.VK_TAB);
|
||||
robot.keyRelease(KeyEvent.VK_TAB);
|
||||
}
|
||||
})) {
|
||||
System.out.println("Focus got stuck while traversing.");
|
||||
|
||||
79
test/jdk/jb/java/awt/Focus/FocusTraversalOrderTest.java
Normal file
79
test/jdk/jb/java/awt/Focus/FocusTraversalOrderTest.java
Normal file
@@ -0,0 +1,79 @@
|
||||
import java.awt.*;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary JBR-6060 Verify that the focus traverse to the next component if the current focused became invisible
|
||||
* @run main/othervm FocusTraversalOrderTest
|
||||
*/
|
||||
public class FocusTraversalOrderTest {
|
||||
|
||||
private static Frame frame;
|
||||
private static Button button0, button1, button2, button3, button4;
|
||||
|
||||
public static void main(String... args) throws InterruptedException, InvocationTargetException, AWTException {
|
||||
Robot robot = new Robot();
|
||||
try {
|
||||
EventQueue.invokeAndWait(() -> {
|
||||
frame = new Frame();
|
||||
frame.setLayout(new FlowLayout());
|
||||
frame.setFocusTraversalPolicy(new ContainerOrderFocusTraversalPolicy());
|
||||
button0 = new Button();
|
||||
button0.setFocusable(true);
|
||||
frame.add(button0);
|
||||
|
||||
button1 = new Button();
|
||||
button1.setFocusable(true);
|
||||
frame.add(button1);
|
||||
|
||||
button2 = new Button();
|
||||
button2.setFocusable(true);
|
||||
frame.add(button2);
|
||||
|
||||
button3 = new Button();
|
||||
button3.setFocusable(true);
|
||||
frame.add(button3);
|
||||
|
||||
button4 = new Button();
|
||||
button4.setFocusable(true);
|
||||
frame.add(button4);
|
||||
|
||||
frame.pack();
|
||||
frame.setVisible(true);
|
||||
});
|
||||
frame.requestFocus();
|
||||
frame.toFront();
|
||||
robot.waitForIdle();
|
||||
button2.requestFocusInWindow();
|
||||
robot.waitForIdle();
|
||||
button2.setVisible(false);
|
||||
robot.waitForIdle();
|
||||
|
||||
boolean isRightFocus = button3.isFocusOwner();
|
||||
if (!isRightFocus) {
|
||||
System.out.println("ERROR: button3 expected to be focus owner");
|
||||
}
|
||||
|
||||
FocusTraversalPolicy focusTraversalPolicy = frame.getFocusTraversalPolicy();
|
||||
Component compAfterButton2 = focusTraversalPolicy.getComponentAfter(frame, button2);
|
||||
|
||||
boolean isRightNextComp = compAfterButton2.equals(button3);
|
||||
if (!isRightNextComp) {
|
||||
System.out.println("ERROR: the next component after button2 expected to be button3, but got " + compAfterButton2.getName());
|
||||
}
|
||||
|
||||
if (!(isRightFocus && isRightNextComp)) {
|
||||
throw new RuntimeException("TEST FAILED: the next component didn't gain the focus");
|
||||
} else {
|
||||
System.out.println("TEST PASSED");
|
||||
}
|
||||
} finally {
|
||||
EventQueue.invokeAndWait(() -> {
|
||||
if (frame != null) {
|
||||
frame.dispose();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
141
test/jdk/jb/java/awt/im/ImWindowIsPlacedUnderPopup5984.java
Normal file
141
test/jdk/jb/java/awt/im/ImWindowIsPlacedUnderPopup5984.java
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* Copyright (c) 2023, JetBrains s.r.o.. 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary A manual test of JBR-5984 bug checks if an IM's window is placed above Swing's/AWT's popups
|
||||
* @author Nikita Provotorov
|
||||
* @requires (os.family == "mac")
|
||||
* @key headful
|
||||
* @run main/othervm/manual -Xcheck:jni ImWindowIsPlacedUnderPopup5984
|
||||
*/
|
||||
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
|
||||
public class ImWindowIsPlacedUnderPopup5984 extends JFrame {
|
||||
static final CompletableFuture<RuntimeException> swingError = new CompletableFuture<>();
|
||||
|
||||
public static void main(String[] args) throws InterruptedException, InvocationTargetException, ExecutionException {
|
||||
final ImWindowIsPlacedUnderPopup5984 frame;
|
||||
{
|
||||
final CompletableFuture<ImWindowIsPlacedUnderPopup5984> frameFuture = new CompletableFuture<>();
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
try {
|
||||
final var result = new ImWindowIsPlacedUnderPopup5984();
|
||||
result.setVisible(true);
|
||||
frameFuture.complete(result);
|
||||
} catch (Throwable err) {
|
||||
frameFuture.completeExceptionally(err);
|
||||
}
|
||||
});
|
||||
frame = frameFuture.get();
|
||||
}
|
||||
|
||||
try {
|
||||
final var err = swingError.get();
|
||||
if (err != null) {
|
||||
throw err;
|
||||
}
|
||||
} finally {
|
||||
if (frame != null) {
|
||||
SwingUtilities.invokeAndWait(frame::dispose);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ImWindowIsPlacedUnderPopup5984() {
|
||||
super("JBR-5984");
|
||||
setDefaultCloseOperation(HIDE_ON_CLOSE);
|
||||
|
||||
popupShowingButton = new JButton("Show a Popup");
|
||||
add(popupShowingButton, BorderLayout.NORTH);
|
||||
|
||||
instructionTextArea = new JTextArea();
|
||||
instructionTextArea.setLineWrap(true);
|
||||
instructionTextArea.setWrapStyleWord(true);
|
||||
instructionTextArea.setText(
|
||||
"""
|
||||
INSTRUCTION:
|
||||
1. Switch the input source to an input method (e.g. "Pinyin - Simplified");
|
||||
2. Press the "Show a Popup" button;
|
||||
3. Start typing into the text field on the shown popup;
|
||||
4. Check if the input candidates' popup is shown above the java popup:
|
||||
4.1. If it's shown above, press the "PASS" button;
|
||||
4.2. Otherwise, press the "FAIL" button.
|
||||
"""
|
||||
);
|
||||
instructionTextArea.setEditable(false);
|
||||
add(instructionTextArea, BorderLayout.CENTER);
|
||||
|
||||
final JPanel southContainer = new JPanel(new BorderLayout());
|
||||
failTestButton = new JButton("FAIL");
|
||||
passTestButton = new JButton("PASS");
|
||||
southContainer.add(failTestButton, BorderLayout.LINE_START);
|
||||
southContainer.add(passTestButton, BorderLayout.LINE_END);
|
||||
add(southContainer, BorderLayout.SOUTH);
|
||||
|
||||
popupPanel = new JPanel();
|
||||
popupTextField = new JTextArea();
|
||||
popupTextField.setPreferredSize(new Dimension(200, 125));
|
||||
popupPanel.add(popupTextField);
|
||||
|
||||
pack();
|
||||
setSize(400, 250);
|
||||
setLocationRelativeTo(null);
|
||||
|
||||
popup = new JPopupMenu();
|
||||
popup.add(popupPanel);
|
||||
popup.pack();
|
||||
|
||||
popupShowingButton.addActionListener(ignored -> popup.show(ImWindowIsPlacedUnderPopup5984.this, 100, 65));
|
||||
|
||||
failTestButton.addActionListener(ignored -> swingError.completeExceptionally(new RuntimeException("The tester has pressed FAILED")));
|
||||
passTestButton.addActionListener(ignored -> swingError.complete(null));
|
||||
|
||||
addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
swingError.completeExceptionally(new RuntimeException("The window was closed not through the \"PASS\"/\"FAIL\" buttons"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private final JButton popupShowingButton;
|
||||
private final JTextArea instructionTextArea;
|
||||
private final JButton failTestButton;
|
||||
private final JButton passTestButton;
|
||||
private final JPanel popupPanel;
|
||||
private final JTextArea popupTextField;
|
||||
private final JPopupMenu popup;
|
||||
}
|
||||
141
test/jdk/jb/java/awt/wayland/WLShutdownTest.java
Normal file
141
test/jdk/jb/java/awt/wayland/WLShutdownTest.java
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2023, JetBrains s.r.o.. 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.WindowConstants;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Verifies that the program finishes after disposing of JFrame
|
||||
* @run main WLShutdownTest
|
||||
*/
|
||||
public class WLShutdownTest {
|
||||
private static JFrame frame = null;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
final CountDownLatch latchShownFrame = new CountDownLatch(1);
|
||||
final CountDownLatch latchClosedFrame = new CountDownLatch(1);
|
||||
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
frame = new JFrame("TEST");
|
||||
|
||||
frame.addComponentListener(new ComponentAdapter() {
|
||||
@Override
|
||||
public void componentShown(ComponentEvent e) {
|
||||
latchShownFrame.countDown();
|
||||
}
|
||||
});
|
||||
frame.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosed(WindowEvent e) {
|
||||
latchClosedFrame.countDown();
|
||||
}
|
||||
});
|
||||
|
||||
JPanel panel = new JPanel() {
|
||||
int n = 0;
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics g) {
|
||||
System.out.print("P");
|
||||
g.setColor((n++ % 2 == 0) ? Color.RED : Color.BLUE);
|
||||
g.fillRect(0, 0, getWidth(), getHeight());
|
||||
System.out.print("Q");
|
||||
}
|
||||
};
|
||||
|
||||
panel.setPreferredSize(new Dimension(800, 800));
|
||||
panel.setBackground(Color.BLACK);
|
||||
frame.add(panel);
|
||||
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
frame.pack();
|
||||
frame.setVisible(true);
|
||||
System.out.print(">>");
|
||||
}
|
||||
});
|
||||
|
||||
// Wait frame to be shown:
|
||||
latchShownFrame.await();
|
||||
|
||||
System.out.print(":>>");
|
||||
|
||||
final long startTime = System.currentTimeMillis();
|
||||
final long endTime = startTime + 3000;
|
||||
|
||||
// Start 1st measurement:
|
||||
repaint();
|
||||
|
||||
for (; ; ) {
|
||||
System.out.print(".");
|
||||
|
||||
repaint();
|
||||
|
||||
if (System.currentTimeMillis() >= endTime) {
|
||||
break;
|
||||
}
|
||||
sleep();
|
||||
} // end measurements
|
||||
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
frame.setVisible(false);
|
||||
frame.dispose();
|
||||
});
|
||||
|
||||
latchClosedFrame.await();
|
||||
System.out.print("<<\n");
|
||||
|
||||
frame = null; // free static ref: gc
|
||||
System.out.println("Waiting AWT to shutdown JVM soon ...");
|
||||
}
|
||||
|
||||
|
||||
static void repaint() throws Exception {
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
frame.repaint();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void sleep() {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException ie) {
|
||||
ie.printStackTrace(System.err);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +1,48 @@
|
||||
java/awt/Choice/ChoicePopupLocation/ChoicePopupLocation.java 8202931,JBR-5398 macosx-all,linux-all,windows-all
|
||||
java/awt/Debug/X11Trace.java JBR-5442 linux-all
|
||||
java/awt/Multiscreen/MultiScreenLocationTest/MultiScreenLocationTest.java JBR-6058 windows-all
|
||||
java/awt/FullScreen/CurrentDisplayModeTest/CurrentDisplayModeTest.java JBR-5059 linux-all
|
||||
java/awt/FullScreen/MultimonFullscreenTest/MultimonDeadlockTest.java JBR-4379 windows-all
|
||||
java/awt/Frame/FramesGC/FramesGC.java JBR-6057 windows-all
|
||||
java/awt/GraphicsDevice/DisplayModes/CompareToXrandrTest.java JBR-5062 linux-all
|
||||
java/awt/datatransfer/Clipboard/GetContentsInterruptedTest.java JBR-5086 linux-5.15.0-46-generic Ubuntu 20.04
|
||||
java/awt/dnd/MissedDragEnterTest.java JBR-6091 windows-all
|
||||
java/awt/Frame/FramesGC/FramesGC.java JBR-6057 windows-all
|
||||
java/awt/Frame/GetGraphicsStressTest/GetGraphicsStressTest.java JBR-5117 linux-all
|
||||
java/awt/LightweightDispatcher/LWDispatcherMemoryLeakTest.java 8311535 windows-all
|
||||
java/awt/Multiscreen/WindowGCChangeTest/WindowGCChangeTest.java JBR-5531 macosx-all
|
||||
java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java#id1 JBR-5442 linux-all
|
||||
java/awt/Mouse/MouseWheelAbsXY/MouseWheelAbsXY.java 8253184,JBR-5442 windows-all,linux-all
|
||||
java/awt/MouseInfo/MultiscreenPointerInfo.java JBR-5442 linux-all
|
||||
java/awt/Multiscreen/LocationRelativeToTest/LocationRelativeToTest.java 8253184,JBR-5442 windows-all,linux-all
|
||||
java/awt/Multiscreen/MultiScreenLocationTest/MultiScreenLocationTest.java JBR-5442 linux-all
|
||||
java/awt/Multiscreen/WindowGCChangeTest/WindowGCChangeTest.java JBR-5531,JBR-5442 macosx-all,linux-all
|
||||
java/awt/Multiscreen/UpdateGCTest/UpdateGCTest.java JBR-5442 linux-all
|
||||
java/awt/PopupMenu/PopupMenuLocation.java 8238720,JBR-5442 windows-all,linux-all
|
||||
java/awt/Robot/CheckCommonColors/CheckCommonColors.java 8253184,JBR-5510,JBR-5442,JBR-6092 windows-all,linux-all,macosx-aarch64
|
||||
java/awt/Robot/CheckCommonColors/CheckCommonColors.java JBR-6092 macosx-aarch64
|
||||
java/awt/Robot/HiDPIScreenCapture/ScreenCaptureTest.java 8253184,JBR-5442 windows-all,linux-all
|
||||
java/awt/Robot/MouseLocationOnScreen/MouseLocationOnScreen.java JBR-5390 macosx-all,linux-all
|
||||
java/awt/Robot/NonEmptyErrorStream.java JBR-5442 linux-all
|
||||
java/awt/Robot/RobotMoveMultiscreen.java JBR-5442 linux-all
|
||||
java/awt/Toolkit/AWTEventListenerProxyTest/AWTEventListenerProxyTest.java JBR-6065 windows-all
|
||||
java/awt/Window/SlowMotion/SlowMotion.java JBR-5442 linux-all
|
||||
java/awt/Window/WindowSizeDifferentScreens/WindowSizeDifferentScreens.java JBR-5442 linux-all
|
||||
java/awt/dnd/MissingEventsOnModalDialog/MissingEventsOnModalDialogTest.java JBR-5442 linux-all
|
||||
java/awt/im/memoryleak/InputContextMemoryLeakTest.java JBR-6065 windows-all
|
||||
java/awt/image/VolatileImage/DrawHugeImageTest.java JBR-5442 linux-all
|
||||
|
||||
javax/swing/GraphicsConfigNotifier/TestMultiScreenGConfigNotify.java JBR-5442 linux-all
|
||||
javax/swing/JComboBox/TestComboBoxComponentRendering.java JBR-6100 linux-all
|
||||
javax/swing/JInternalFrame/Test6325652.java JBR-6065 windows-all
|
||||
javax/swing/JMenu/4692443/bug4692443.java JBR-6065 windows-all
|
||||
javax/swing/JMenuBar/4750590/bug4750590.java JBR-6065 windows-all
|
||||
javax/swing/JMenuItem/4171437/bug4171437.java JBR-6065 windows-all
|
||||
javax/swing/JTable/7124218/SelectEditTableCell.java JBR-5442 linux-all
|
||||
javax/swing/JTextArea/8149849/DNDTextToScaledArea.java 8253184 windows-all
|
||||
javax/swing/JTextField/8036819/bug8036819.java JBR-6065 windows-all
|
||||
javax/swing/JTree/4927934/bug4927934.java JBR-6065 windows-all
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
javax/swing/plaf/basic/BasicGraphicsUtils/8132119/bug8132119.java JBR-5442 linux-all
|
||||
javax/swing/plaf/metal/MetalGradient/8163193/ButtonGradientTest.java 8253184,JBR-5510,JBR-5442 windows-all,linux-all
|
||||
javax/swing/SwingWorker/TestDoneBeforeDoInBackground.java JBR-5442 linux-all
|
||||
javax/swing/text/html/StyleSheet/bug4936917.java JBR-899,JBR-5510,JBR-5442 windows-all,linux-all
|
||||
javax/swing/UI/UnninstallUIMemoryLeaks/UnninstallUIMemoryLeaks.java JBR-5952,JBR-5442 windows-x64,linux-all
|
||||
|
||||
@@ -142,6 +142,7 @@ java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_2.java 820420
|
||||
java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_4.java 8204200 windows-all,macosx-all,linux-all
|
||||
java/awt/dnd/DropTargetEnterExitTest/ExtraDragEnterTest.java 8029680 generic-all
|
||||
java/awt/dnd/DropTargetEnterExitTest/MissedDragExitTest.java JBR-5730 linux-all
|
||||
java/awt/dnd/NextDropActionTest/NextDropActionTest.java 8313633 macosx-aarch64
|
||||
java/awt/dnd/MissingDragExitEventTest/MissingDragExitEventTest.java 8288839,JBR-5727,JBR-5959 windows-x64,linux-all, windows-aarch64
|
||||
java/awt/dnd/URIListBetweenJVMsTest/URIListBetweenJVMsTest.java 8171510,JBR-881 macosx-all,linux-all
|
||||
javax/swing/dnd/7171812/bug7171812.java 8041447,8253184 macosx-all,windows-all
|
||||
@@ -345,7 +346,7 @@ java/awt/Frame/MiscUndecorated/ActiveSwingWindowTest.java JBR-5210 windows-all
|
||||
java/awt/Frame/MiscUndecorated/FrameCloseTest.java JBR-5210 windows-all
|
||||
java/awt/Frame/MiscUndecorated/RepaintTest.java 8266244,JBR-5786 macosx-aarch64,generic-all
|
||||
java/awt/Robot/HiDPIMouseClick/HiDPIRobotMouseClick.java 8253184 windows-all
|
||||
java/awt/Modal/FileDialog/FileDialogAppModal1Test.java 7186009,8253184,JBR-5827 macosx-all,windows-all,linux-all
|
||||
java/awt/Modal/FileDialog/FileDialogAppModal1Test.java 7186009,8253184 macosx-all,windows-all
|
||||
java/awt/Modal/FileDialog/FileDialogAppModal2Test.java 7186009,8253184 macosx-all,windows-all
|
||||
java/awt/Modal/FileDialog/FileDialogAppModal3Test.java 7186009,8253184 macosx-all,windows-all
|
||||
java/awt/Modal/FileDialog/FileDialogAppModal4Test.java 7186009,8253184 macosx-all,windows-all
|
||||
@@ -882,7 +883,7 @@ javax/swing/plaf/basic/BasicTreeUI/8023474/bug8023474.java 8253184 linux-all,win
|
||||
javax/swing/plaf/nimbus/8041642/bug8041642.java 8253184,JBR-5510 windows-all,linux-5.18.2-arch1-1
|
||||
javax/swing/plaf/nimbus/8057791/bug8057791.java 8253184,JBR-5510 windows-all,linux-5.18.2-arch1-1
|
||||
javax/swing/plaf/nimbus/TestNimbusBGColor.java JBR-5359 windows-aarch64
|
||||
javax/swing/plaf/nimbus/TestNimbusOverride.java 8253184 windows-all
|
||||
javax/swing/plaf/nimbus/TestNimbusOverride.java 8253184, JBR-5829 windows-all,linux-all
|
||||
javax/swing/plaf/windows/6921687/bug6921687.java 8253184 windows-all
|
||||
javax/swing/plaf/windows/WindowsRootPaneUI/WrongAltProcessing/WrongAltProcessing.java JBR-4372 windows-all
|
||||
|
||||
@@ -904,9 +905,14 @@ javax/swing/JDialog/Transparency/TransparencyTest.java 8253184,JBR-5510 windows-
|
||||
javax/swing/JLabel/4138746/JLabelMnemonicsTest.java JBR-4949 linux-all,windows-all
|
||||
javax/swing/JLabel/6596966/bug6596966.java 8197552 windows-all
|
||||
javax/swing/JLabel/7004134/bug7004134.java JBR-5437 linux-all
|
||||
javax/swing/JMenu/4213634/bug4213634.java 8197552 windows-all
|
||||
javax/swing/JMenu/4515762/bug4515762.java 8197552 windows-all
|
||||
javax/swing/JMenu/4692443/bug4692443.java JBR-6093 windows-x64
|
||||
javax/swing/JMenu/6470128/bug6470128.java 8253184 windows-all
|
||||
javax/swing/JMenu/6538132/bug6538132.java JBR-894 windows-all00
|
||||
javax/swing/JMenu/PopupReferenceMemoryLeak.java JBR-5890,JBR-6056 windows-aarch64,windows-x64
|
||||
javax/swing/JMenuBar/4750590/bug4750590.java JBR-6094 windows-x64
|
||||
javax/swing/JMenuItem/4171437/bug4171437.java JBR-6112 windows-x64
|
||||
javax/swing/JMenuItem/4654927/bug4654927.java JBR-164 windows-all
|
||||
javax/swing/JMenuItem/4654927/bug4654927.java JBR-164,JBR-4337 windows-all,linux-all
|
||||
javax/swing/JMenuItem/6209975/bug6209975.java 8253184 windows-all
|
||||
@@ -957,7 +963,7 @@ javax/swing/JFileChooser/6520101/bug6520101.java JBR-5703 linux-5.8.0-1032-raspi
|
||||
javax/swing/JFileChooser/6570445/bug6570445.java JBR-5767 windows-all
|
||||
javax/swing/JFileChooser/6738668/bug6738668.java JBR-5767 windows-all
|
||||
javax/swing/JFileChooser/7036025/bug7036025.java JBR-5767 windows-all
|
||||
javax/swing/JFileChooser/8062561/bug8062561.java JBR-5767 windows-all
|
||||
javax/swing/JFileChooser/8062561/bug8062561.java JBR-5767,JBR-5808 windows-all
|
||||
javax/swing/JFileChooser/8194044/FileSystemRootTest.java JBR-5767 windows-all
|
||||
javax/swing/JFileChooser/ShellFolderQueries/ShellFolderQueriesSecurityManagerTest.java JBR-5767 windows-all
|
||||
javax/swing/JFrame/8016356/bug8016356.java JBR-108 windows-all
|
||||
@@ -985,6 +991,7 @@ javax/swing/JInternalFrame/6288609/TestJInternalFrameDispose.java JBR-788 window
|
||||
javax/swing/JInternalFrame/6647340/bug6647340.java 8253184 windows-all
|
||||
javax/swing/JInternalFrame/8145060/TestJInternalFrameMinimize.java JBR-788 windows-all,linux-all
|
||||
javax/swing/JInternalFrame/8145896/TestJInternalFrameMaximize.java JBR-5539 windows-all
|
||||
javax/swing/JInternalFrame/Test6325652.java JBR-6111 windows-all
|
||||
javax/swing/JInternalFrame/Test6505027.java JBR-5954 linux-all,osx-all
|
||||
javax/swing/JInternalFrame/Test6802868.java 8253184 windows-all
|
||||
javax/swing/JPopupMenu/4634626/bug4634626.java 8253184 windows-all
|
||||
@@ -1010,6 +1017,7 @@ javax/swing/JInternalFrame/5066752/bug5066752.java 8253184,JBR-5510 windows-all,
|
||||
javax/swing/JInternalFrame/8160248/JInternalFrameDraggingTest.java JBR-5359,JBR-5510 windows-aarch64,linux-5.18.2-arch1-1
|
||||
javax/swing/JInternalFrame/8020708/bug8020708.java JBR-4879 windows-all
|
||||
javax/swing/JInternalFrame/8069348/bug8069348.java 8253184,JBR-900 macosx-aarch64,windows-all
|
||||
javax/swing/ToolTipManager/Test6256140.java 8197552 windows-all
|
||||
javax/swing/text/DefaultEditorKit/4278839/bug4278839.java CODETOOLS-7901623 windows-all
|
||||
javax/swing/text/GlyphPainter2/6427244/bug6427244.java JBR-896 windows-all
|
||||
javax/swing/text/JTextComponent/5074573/bug5074573.java CODETOOLS-7901623,JBR-5386 windows-all,linux-all
|
||||
@@ -1031,7 +1039,7 @@ sanity/client/SwingSet/src/DialogDemoTest.java 8253184 windows-all
|
||||
sanity/client/SwingSet/src/FrameDemoTest.java 8253184 windows-all
|
||||
sanity/client/SwingSet/src/InternalFrameDemoTest.java 8253184 windows-all
|
||||
sanity/client/SwingSet/src/GridBagLayoutDemoTest.java 8253184 windows-all
|
||||
sanity/client/SwingSet/src/TextFieldDemoTest.java JBR-5061 linux-5.15.0-39-generic Ubuntu-22.04
|
||||
sanity/client/SwingSet/src/TextFieldDemoTest.java JBR-5061 linux-all Ubuntu-22.04
|
||||
sanity/client/SwingSet/src/ToolTipDemoTest.java 8293001 linux-all
|
||||
sanity/client/SwingSet/src/SliderDemoTest.java 8253184 windows-all
|
||||
sanity/client/SwingSet/src/SpinnerDemoTest.java 8253184 windows-all
|
||||
@@ -1163,6 +1171,8 @@ java/awt/font/EmojiVariation.java JBR-5009,JBR-5510 linux-aarch64,linux-5.18.2-a
|
||||
java/awt/font/TextLayout/TestJustification.html 8250791 macosx-all
|
||||
java/awt/font/TextLayout/TestSinhalaChar.java JBR-5103 generic-all
|
||||
javax/swing/JTableHeader/6889007/bug6889007.java 8310238,8253184,JBR-5387 macosx-all,windows-all,linux-all
|
||||
javax/swing/JTextField/8036819/bug8036819.java JBR-6113 windows-x64
|
||||
javax/swing/JTree/4927934/bug4927934.java JBR-6114 windows-x64
|
||||
java/awt/TrayIcon/DragEventSource/DragEventSource.java 8252242 macosx-all
|
||||
java/awt/FileDialog/DefaultFocusOwner/DefaultFocusOwner.java 7187728 macosx-all,linux-all
|
||||
java/awt/FileDialog/RegexpFilterTest/RegexpFilterTest.html 7187728 macosx-all,linux-all
|
||||
@@ -1175,6 +1185,7 @@ java/awt/TextArea/TextAreaTwicePack/TextAreaTwicePack.java 8253184 windows-all
|
||||
java/awt/TextField/OverScrollTest/OverScrollTest.java 8253184 windows-all
|
||||
java/awt/event/MouseEvent/SpuriousExitEnter/SpuriousExitEnter.java 8254841 macosx-all
|
||||
java/awt/Focus/AppletInitialFocusTest/AppletInitialFocusTest1.java 8256289,JBR-5359 windows-x64,windows-aarch64
|
||||
java/awt/Focus/RemoveAfterRequest/RemoveAfterRequest.java JBR-6052 macosx-all,linux-all
|
||||
java/awt/Focus/RowToleranceTransitivityTest.java JBR-5751 windows-all
|
||||
java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java 8258103,8253184 linux-all,windows-all
|
||||
|
||||
@@ -1231,6 +1242,7 @@ com/sun/java/swing/plaf/windows/AltFocusIssueTest.java
|
||||
java/awt/event/MouseEvent/AltGraphModifierTest/AltGraphModifierTest.java JBR-4207 windows-all
|
||||
jb/java/awt/Graphics2D/TextRender/OGLMetalTextRender.java JBR-5392 windows-aarch64
|
||||
jb/java/awt/event/TouchScreenEvent/TouchScreenEventsTestLinux.sh JBR-4078 linux-all
|
||||
jb/java/awt/event/MouseEvent/ReleaseAndClickModifiers.java JBR-5366 windows-all
|
||||
jb/java/awt/Font/Font467.java JBR-3960 generic-all
|
||||
jb/java/awt/keyboard/AltGrMustGenerateAltGrModifierTest4207.java JBR-4207 windows-all
|
||||
jb/java/awt/Toolkit/AWTThreadingTest.java JBR-4350 macosx-all
|
||||
@@ -1329,6 +1341,7 @@ javax/sound/sampled/Mixers/BogusMixers.java JBR-4455 linux-aarch64
|
||||
|
||||
java/awt/Choice/RemoveAllShrinkTest/RemoveAllShrinkTest.java JBR-5359,JBR-5510,8310487 windows-aarch64,linux-5.18.2-arch1-1,linux-all
|
||||
java/awt/Choice/ResizeAutoClosesChoice/ResizeAutoClosesChoice.java JBR-5359,JBR-5510,JBR-5905 windows-aarch64,linux-5.18.2-arch1-1,linux-all
|
||||
java/awt/Choice/SelectNewItemTest/SelectNewItemTest.java 8315733 macosx-all
|
||||
java/awt/ColorClass/XRenderTranslucentColorDrawTest.java JBR-5359 windows-aarch64
|
||||
java/awt/Frame/InvisibleOwner/InvisibleOwner.java JBR-5359,JBR-5510 windows-aarch64,linux-5.18.2-arch1-1
|
||||
java/awt/Graphics/CopyScaledArea/CopyScaledAreaTest.java JBR-5359 windows-aarch64
|
||||
@@ -1383,19 +1396,20 @@ jb/java/awt/CustomTitleBar/WindowsControlWidthTest.java JBR-5359,JBR-5345 window
|
||||
jb/java/awt/CustomTitleBar/WindowResizeTest.java JBR-5592 windows-all
|
||||
sanity/client/SwingSet/src/EditorPaneDemoTest.java JBR-5359,JBR-5510 windows-aarch64,linux-5.18.2-arch1-1
|
||||
sun/java2d/AcceleratedXORModeTest.java JBR-5359 windows-aarch64
|
||||
sun/java2d/GdiRendering/ClipShapeRendering.java JBR-5359,JBR-5510 windows-aarch64,linux-5.18.2-arch1-1
|
||||
sun/java2d/GdiRendering/InsetClipping.java 7124403,JBR-5359,JBR-5510 windows-x64,macosx-all,windows-aarch64,linux-5.18.2-arch1-1
|
||||
sun/java2d/GdiRendering/ClipShapeRendering.java JBR-5359,JBR-5366,JBR-5510 windows-all,linux-5.18.2-arch1-1
|
||||
sun/java2d/GdiRendering/InsetClipping.java 7124403,JBR-5359,JBR-5366,JBR-5510 windows-all,macosx-all,windows-aarch64,linux-5.18.2-arch1-1
|
||||
|
||||
java/awt/Choice/PopdownGeneratesMouseEvents/PopdownGeneratesMouseEvents.java JBR-5510 linux-5.18.2-arch1-1
|
||||
java/awt/Insets/DialogInsets.java JBR-5510 linux-5.18.2-arch1-1
|
||||
java/awt/Menu/OpensWithNoGrab/OpensWithNoGrab.java JBR-5510 linux-5.18.2-arch1-1
|
||||
javax/swing/JFormattedTextField/TestSelectedTextBackgroundColor.java JBR-5510 linux-5.18.2-arch1-1
|
||||
javax/swing/JMenu/JMenuSelectedColorTest.java JBR-5510 linux-5.18.2-arch1-1
|
||||
javax/swing/JMenuItem/8158566/CloseOnMouseClickPropertyTest.java JBR-5510 linux-5.18.2-arch1-1
|
||||
javax/swing/JSpinner/4670051/DateFieldUnderCursorTest.java JBR-5510 linux-5.18.2-arch1-1
|
||||
javax/swing/JSpinner/4788637/bug4788637.java JBR-5510 linux-5.18.2-arch1-1
|
||||
javax/swing/LookAndFeel/8145547/DemandGTK2.sh JBR-5510 linux-5.18.2-arch1-1
|
||||
javax/swing/LookAndFeel/8145547/DemandGTK3.sh JBR-5510 linux-5.18.2-arch1-1
|
||||
|
||||
java/awt/Toolkit/LockingKeyStateTest/LockingKeyStateTest.java JBR-5765 macosx-all
|
||||
jb/sun/awt/macos/InputMethodTest/FocusMoveUncommitedCharactersTest.java JBR-5765 macosx-all
|
||||
jb/sun/awt/macos/InputMethodTest/FocusMoveUncommitedCharactersTest.java JBR-5765 macosx-all
|
||||
|
||||
jb/java/awt/Focus/FocusTraversalOrderTest.java JBR-6060 generic-all
|
||||
|
||||
@@ -1,16 +1,47 @@
|
||||
java/awt/datatransfer/DragUnicodeBetweenJVMTest/DragUnicodeBetweenJVMTest.java JBR-5538 windows-all
|
||||
java/awt/Frame/RestoreToOppositeScreen/RestoreToOppositeScreen.java 8286840 linux-all
|
||||
java/awt/GridLayout/ChangeGridSize/ChangeGridSize.java JBR-4199 linux-5.4.0-1083-aws
|
||||
java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java JBR-4199 linux-5.4.0-1083-aws
|
||||
java/awt/Dialog/DialogLocationTest.java JBR-6090 windows-all
|
||||
java/awt/datatransfer/DragUnicodeBetweenJVMTest/DragUnicodeBetweenJVMTest.java JBR-5538 windows-all
|
||||
java/awt/datatransfer/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java JBR-6027 windows-all
|
||||
java/awt/dnd/MissedDragEnterTest.java JBR-6091 windows-all
|
||||
java/awt/event/StressTest/MouseAndKeyEventStressTest.java JBR-6090 windows-all
|
||||
java/awt/event/MouseEvent/FrameMouseEventAbsoluteCoordsTest/FrameMouseEventAbsoluteCoordsTest.java 8238720,JBR-6095 windows-all,linux-all
|
||||
java/awt/Focus/6378278/InputVerifierTest.java JBR-6090 windows-all
|
||||
java/awt/Focus/6382144/EndlessLoopTest.java JBR-6090 windows-all
|
||||
java/awt/Focus/8282640/ScrollPaneFocusBugTest.java JBR-6090 windows-all
|
||||
java/awt/Focus/ClearLwQueueBreakTest/ClearLwQueueBreakTest.java JBR-6090 windows-all
|
||||
java/awt/Focus/LabelScrollBarFocus.java JBR-6090 windows-x64
|
||||
java/awt/Focus/ModalExcludedWindowClickTest/ModalExcludedWindowClickTest.java JBR-6090 windows-x64
|
||||
java/awt/Focus/MouseClickRequestFocusRaceTest/MouseClickRequestFocusRaceTest.java JBR-6090 windows-x64
|
||||
java/awt/Focus/SimpleWindowActivationTest/SimpleWindowActivationTest.java JBR-6089 windows-all
|
||||
java/awt/Focus/WindowUpdateFocusabilityTest/WindowUpdateFocusabilityTest.java JBR-6090 windows-all
|
||||
java/awt/Frame/InvisibleOwner/InvisibleOwner.java JBR-6090 windows-all
|
||||
java/awt/Frame/MaximizedToOppositeScreen/MaximizedToOppositeScreenSmall.java JBR-6090 windows-all
|
||||
java/awt/Frame/RestoreToOppositeScreen/RestoreToOppositeScreen.java 8286840 linux-all
|
||||
java/awt/Frame/SetMaximizedBounds/SetMaximizedBounds.java JBR-6090 windows-all
|
||||
java/awt/Frame/WindowDragTest/WindowDragTest.java JBR-6090 windows-x64
|
||||
java/awt/GridLayout/ChangeGridSize/ChangeGridSize.java 8238720,JBR-4199,JBR-6090 linux-5.4.0-1083-aws,linux-5.4.0-1103-aws,windows-all
|
||||
java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java JBR-4199,JBR-6090 linux-5.4.0-1083-aws,linux-5.4.0-1103-aws,windows-all
|
||||
|
||||
java/awt/Graphics/LineClipTest.java JBR-5071 linux-all
|
||||
java/awt/image/VolatileImage/DrawHugeImageTest.java JBR-5071 linux-all
|
||||
java/awt/image/VolatileImage/DrawHugeImageTest.java JBR-5071,JBR-5359 linux-all,windows-aarch64
|
||||
java/awt/LightweightComponent/LightweightEventTest/LightweightEventTest.java JBR-5071 linux-all
|
||||
java/awt/Mixing/AWT_Mixing/JComboBoxOverlapping.java 8049405,JBR-5359,JBR-5510,JBR-6090 macosx-all,windows-aarch64,linux-5.18.2-arch1-1,windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JGlassPaneMoveOverlapping.java JBR-5359,JBR-5510,JBR-6090 windows-aarch64,linux-5.18.2-arch1-1,windows-all
|
||||
java/awt/Mixing/MixingOnDialog.java JBR-6090 windows-all
|
||||
java/awt/Modal/BlockedMouseInputTest2.java JBR-6090 windows-all
|
||||
java/awt/PopupMenu/PopupMenuLocation.java 8238720,JBR-5071 windows-all,macosx-all,linux-all
|
||||
javax/swing/JComboBox/TestComboBoxComponentRendering.java JBR-6100 linux-all
|
||||
javax/swing/JComponent/7154030/bug7154030.java JBR-6134 windows-x64
|
||||
javax/swing/JPopupMenu/6580930/bug6580930.java JBR-5071 linux-all
|
||||
javax/swing/JWindow/ShapedAndTranslucentWindows/ShapedPerPixelTranslucentGradient.java JBR-6090 windows-all
|
||||
javax/swing/JWindow/ShapedAndTranslucentWindows/ShapedTranslucentPerPixelTranslucentGradient.java JBR-6090 windows-all
|
||||
|
||||
sun/java2d/GdiRendering/ClipShapeRendering.java JBR-5204 linux-all,windows-all
|
||||
|
||||
jb/java/awt/Focus/RequestFocusInParent.java JBR-5715 windows-all
|
||||
jb/java/awt/Focus/SecondLevelPopupTest.java JBR-6090 windows-all
|
||||
java/awt/Window/WindowSizeDifferentScreens/WindowSizeDifferentScreens.java JBR-5513 linux-all
|
||||
jb/java/awt/Window/UndecoratedDialogInTransientsChain.java JBR-6090 windows-all
|
||||
java/awt/Focus/SimpleWindowActivationTest/SimpleWindowActivationTest.java JBR-6089 windows-all
|
||||
java/awt/Focus/WindowUpdateFocusabilityTest/WindowUpdateFocusabilityTest.java JBR-6089 windows-all
|
||||
jb/java/awt/Window/ZOrderOnModalDialogActivation.java JBR-5713 windows-all
|
||||
jdk/editpad/EditPadTest.java JBR-5712 windows-all
|
||||
@@ -20,11 +20,9 @@ java/awt/KeyboardFocusmanager/TypeAhead/FreezeTest/FreezeTest.java nobug windows
|
||||
java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.java nobug windows-all
|
||||
java/awt/MenuBar/SeparatorsNavigation/SeparatorsNavigation.java nobug windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JGlassPaneInternalFrameOverlapping.java nobug windows-all
|
||||
java/awt/Mixing/AWT_Mixing/JGlassPaneMoveOverlapping.java nobug windows-all
|
||||
java/awt/Mouse/ExtraMouseClick/ExtraMouseClick.java JBR-4354 windows-all,linux-all # linux: JBR-4354
|
||||
java/awt/Mouse/MouseComboBoxTest/MouseComboBoxTest.java nobug windows-all
|
||||
java/awt/Paint/PaintNativeOnUpdate.java nobug windows-all
|
||||
java/awt/Robot/CheckCommonColors/CheckCommonColors.java nobug windows-all
|
||||
java/awt/TextArea/OverScrollTest/OverScrollTest.java nobug windows-all
|
||||
java/awt/TextField/OverScrollTest/OverScrollTest.java nobug windows-all
|
||||
java/awt/Window/8159168/SetShapeTest.java nobug windows-all
|
||||
@@ -50,15 +48,10 @@ javax/swing/JInternalFrame/5066752/bug5066752.java nobug windows-all
|
||||
javax/swing/JInternalFrame/8145060/TestJInternalFrameMinimize.java nobug windows-all,linux-all
|
||||
javax/swing/JInternalFrame/Test6505027.java nobug windows-all
|
||||
javax/swing/JLabel/7004134/bug7004134.java nobug linux-all
|
||||
javax/swing/JMenu/4213634/bug4213634.java nobug windows-all
|
||||
javax/swing/JMenu/4692443/bug4692443.java nobug windows-all
|
||||
javax/swing/JMenu/8072900/WrongSelectionOnMouseOver.java nobug windows-all,linux-all
|
||||
javax/swing/JMenuBar/4750590/bug4750590.java nobug windows-all
|
||||
javax/swing/JMenuItem/4171437/bug4171437.java nobug windows-all
|
||||
javax/swing/JMenuItem/4654927/bug4654927.java nobug windows-all,linux-all
|
||||
javax/swing/JMenuItem/6209975/bug6209975.java JBR-4894 windows-all
|
||||
javax/swing/JMenuItem/6249972/bug6249972.java JBR-4894 windows-all
|
||||
javax/swing/JMenuItem/8158566/CloseOnMouseClickPropertyTest.java nobug windows-all,linux-all
|
||||
javax/swing/JPopupMenu/4634626/bug4634626.java nobug windows-all
|
||||
javax/swing/JPopupMenu/4760494/bug4760494.java JBR-4894 windows-all
|
||||
javax/swing/JPopupMenu/6415145/bug6415145.java nobug windows-all
|
||||
@@ -77,12 +70,9 @@ javax/swing/JSpinner/TestJSpinnerFocusLost.java nobug windows-all
|
||||
javax/swing/JTabbedPane/4624207/bug4624207.java 8064922,8197552 macosx-all,windows-all,linux-all 8064922:macosx-all, 8197552:windows-all
|
||||
javax/swing/JTabbedPane/TestBackgroundScrollPolicy.java nobug windows-all
|
||||
javax/swing/JTable/7124218/SelectEditTableCell.java JBR-4894 windows-all
|
||||
javax/swing/JTextArea/8149849/DNDTextToScaledArea.java nobug windows-all
|
||||
javax/swing/JTextField/8036819/bug8036819.java nobug windows-all
|
||||
javax/swing/JToolTip/4846413/bug4846413.java nobug windows-all
|
||||
javax/swing/JToolTip/6219960/bug6219960.java nobug windows-all
|
||||
javax/swing/JTree/4633594/JTreeFocusTest.java 8173125 macosx-all,windows-all
|
||||
javax/swing/JTree/4927934/bug4927934.java nobug windows-all
|
||||
javax/swing/JTree/DnD/LastNodeLowerHalfDrop.java 8159131 linux-all,windows-all
|
||||
javax/swing/JWindow/ShapedAndTranslucentWindows/PerPixelTranslucentSwing.java 8194128 macosx-all,windows-all
|
||||
javax/swing/JWindow/ShapedAndTranslucentWindows/SetShapeAndClickSwing.java 8013450 macosx-all,windows-all
|
||||
@@ -99,4 +89,3 @@ javax/swing/text/html/HTMLEditorKit/5043626/bug5043626.java nobug windows-all
|
||||
javax/swing/text/JTextComponent/6361367/bug6361367.java nobug windows-all
|
||||
javax/swing/text/View/8014863/bug8014863.java nobug windows-all
|
||||
javax/swing/text/View/8156217/FPMethodCalledTest.java nobug linux-all
|
||||
javax/swing/ToolTipManager/Test6256140.java nobug windows-all
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user