On Tue, 31 Aug 2021 16:28:53 GMT, Kevin Rushforth <k...@openjdk.org> wrote:

> This PR removes the obsolete applet implementation from JavaFX. It is an 
> ongoing maintenance burden to carry around this legacy code. Also, cleaning 
> this up could help in the implementation of GTK4, Wayland, and Metal, since 
> we won't have to account for the way applet windows are created and managed.
> 
> ## Notes to reviewers:
> 
> The first part of the removal was to eliminate the methods and classes on the 
> Java side that are associated with creating and managing an applet window, 
> and which are no longer called. After these were removed, I then removed the 
> corresponding methods and classes on the native side that are no longer 
> called.
> 
> ### Shared Code
> 
> The following were removed from the shared code.
> 
> #### Removed Java classes
> 
> 
> com.sun.javafx.tk.AppletWindow
> com.sun.javafx.tk.quantum.GlassAppletWindow
> 
> 
> #### Removed methods
> 
> The following methods were removed in the parent class and all subclasses.
> 
> 
> com.sun.glass.ui.Application:
>     public abstract Window createWindow(long parent)
> 
> com.sun.glass.ui.Window:
>     public boolean getAppletMode()
>     public void setAppletMode(boolean appletMode)
>     public void dispatchNpapiEvent(Map eventInfo)
>     protected abstract long _createChildWindow(long parent)
>     protected Window(long parent)
>     protected abstract int _getEmbeddedX(long ptr)
>     protected abstract int _getEmbeddedY(long ptr)
> 
> com.sun.javafx.tk.Toolkit:
>     public abstract AppletWindow createAppletWindow(...)
>     public abstract void closeAppletWindow()
> 
> com.sun.javafx.tk.quantum.WindowStage:
>     static void setAppletWindow(GlassAppletWindow aw)
>     static GlassAppletWindow getAppletWindow()
> 
> 
> 
> ### Linux (Gtk) Java code
> 
> The following classes or methods were removed:
> 
> 
> com.sun.glass.ui.gtk.GtkChildWindow (class removed)
> 
> com.sun.glass.ui.gtk.GtkWindow:
>     protected GtkWindow(long parent)
> 
> 
> ### Linux (Gtk) native glass:
> 
> The following native classes were removed:
> 
> 
> WindowContextChild
> WindowContextPlug
> 
> 
> ### macOS Java code
> 
> The following classes or methods were removed:
> 
> 
> com.sun.glass.events.mac.NpapiEvent (class removed)
> 
> com.sun.glass.ui.mac.MacApplication:
>     native protected String _getRemoteLayerServerName()
> 
> com.sun.glass.ui.View:
>     public int getNativeRemoteLayerId(String serverName)
> 
> com.sun.glass.ui.mac.MacView:
>     native protected int _getNativeRemoteLayerId(long ptr, String serverName)
>     native protected void _hostRemoteLayerId(long ptr, int nativeLayerId)
> 
> com.sun.glass.ui.mac.MacWindow:
>     protected MacWindow(long parent)
> 
> 
> ### macOS native code
> 
> The following native classes were removed:
> 
> 
> GlassEmbeddedWindow*
> GlassNSEvent
> GlassView3D+Remote
> RemoteLayerSupport
> 
> 
> I also removed the `jIsChild` parameter from the window creation code which 
> allowed for removing a lot of dead blocks of code. The main window creation 
> method was:
> 
> 
> - (id)_initWithContentRect:(NSRect)contentRect 
> styleMask:(NSUInteger)windowStyle
>         screen:(NSScreen *)screen jwindow:(jobject)jwindow 
> jIsChild:(jboolean)jIsChild
> 
> 
> This created a `GlassEmbeddedWindow` iff `jIsChild == JNI_TRUE`. Since 
> `jIsChild` was only set to true by the (now removed) 
> `_createChildWindow(long)` method, we can remove the parameter, the 
> `GlassEmbeddedWindow*` classes, and all code blocks that are qualified by `if 
> (jIsChild)`.
> 
> ### Windows Java code 
> 
> The following classes or methods were removed:
> 
> 
> com.sun.glass.ui.win.WinChildWindow (class removed)
> 
> com.sun.glass.ui.win.WinWindow:
>     protected WinWindow(long parent)
> 
> 
> ### Windows native code
> 
> After removing all references to `IsChild()`, which was only ever true for 
> `_createChildWindow()`, we can also remove the following:
> 
> 
> GlassApplication::InstallMouseLLHook
> GlassApplication::UninstallMouseLLHook
> 
> 
> ### iOS Java code
> 
> 
> com.sun.glass.ui.ios.IosWindow:
>     protected IosWindow(long parent)
> 
> 
> ### iOS native code
> 
> With the removal of the `_createChildWindow` method, the following JNI method 
> in `IosWindow` can be removed:
> 
> 
> Java_com_sun_glass_ui_ios_IosWindow__1createChildWindow(JNIEnv *, jobject, 
> jlong)
> 
> 
> As a note, I don't have a setup to build this. It is a simple, safe change, 
> but should be double-checked by someone from Gluon.

This pull request has now been integrated.

Changeset: 4f9b047b
Author:    Kevin Rushforth <k...@openjdk.org>
URL:       
https://git.openjdk.java.net/jfx/commit/4f9b047b8301ee3580588dd34ab809f5c6c4c193
Stats:     3424 lines in 64 files changed: 32 ins; 3308 del; 84 mod

8201538: Remove implementation support for applets from JavaFX

Reviewed-by: mstrauss, aghaisas, jvos

-------------

PR: https://git.openjdk.java.net/jfx/pull/615

Reply via email to