Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinrushforth committed Apr 27, 2020
2 parents bb5ce2c + 91d4c8b commit f1ac39b
Show file tree
Hide file tree
Showing 20 changed files with 642 additions and 76 deletions.
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jfx.gradle.version=6.3
jfx.gradle.version.min=5.3

# Toolchains
jfx.build.linux.gcc.version=gcc8.3.0-OL6.4+1.0
jfx.build.linux.gcc.version=gcc9.2.0-OL6.4+1.0
jfx.build.windows.msvc.version=VS2017-15.9.16+1.0
jfx.build.macosx.xcode.version=Xcode10.1-MacOSX10.14+1.0

Expand Down
35 changes: 19 additions & 16 deletions buildSrc/linux.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ LINUX.library = { name -> return (IS_STATIC_BUILD ? "lib${name}.a" : "lib${name}
def commonFlags = [
"-fno-strict-aliasing", "-fPIC", "-fno-omit-frame-pointer", // optimization flags
"-fstack-protector",
"-Wextra", "-Wall", "-Wformat-security", "-Wno-unused", "-Wno-parentheses", "-Werror=implicit-function-declaration", "-Werror=trampolines"] // warning flags
"-Wextra", "-Wall", "-Wformat-security", "-Wno-unused", "-Wno-parentheses", "-Werror=trampolines"] // warning flags

if (!IS_64) {
commonFlags += "-m32"
Expand All @@ -54,11 +54,14 @@ if (IS_STATIC_BUILD) {
}

// Specify the compilation parameters and link parameters
def ccFlags = [
def cppFlags = [
commonFlags, "-I$JDK_HOME/include", "-I$JDK_HOME/include/linux", "-c",
"-ffunction-sections", "-fdata-sections",
IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : ["-O2", "-DNDEBUG"]].flatten()
def ccFlagsGTK3 = ccFlags

def cFlags = [cppFlags, "-Werror=implicit-function-declaration"].flatten()

def ccFlagsGTK3 = cppFlags
//ccFlags.addAll(["-Wnon-virtual-dtor", "-Woverloaded-virtual", "-std=c++0x"])
def dynamicLinkFlags = ["-static-libgcc", "-static-libstdc++", "-shared", commonFlags,
"-z", "relro",
Expand Down Expand Up @@ -222,7 +225,7 @@ FileTree ft_gtk = fileTree("${project(":graphics").projectDir}/src/main/native-g
LINUX.glass.glass = [:]
LINUX.glass.glass.nativeSource = ft_gtk_launcher.getFiles()
LINUX.glass.glass.compiler = compiler
LINUX.glass.glass.ccFlags = [ccFlags, "-Werror"].flatten()
LINUX.glass.glass.ccFlags = [cppFlags, "-Werror"].flatten()
LINUX.glass.glass.linker = linker
LINUX.glass.glass.linkFlags = IS_STATIC_BUILD? linkFlags : [linkFlags, "-lX11", "-ldl"].flatten()
LINUX.glass.glass.lib = "glass"
Expand All @@ -231,8 +234,8 @@ LINUX.glass.glassgtk2 = [:]
LINUX.glass.glassgtk2.nativeSource = ft_gtk.getFiles()
LINUX.glass.glassgtk2.compiler = compiler
LINUX.glass.glassgtk2.ccFlags = IS_STATIC_BUILD ?
["-fno-threadsafe-statics", ccFlags, gtk2CCFlags].flatten() :
[ccFlags, gtk2CCFlags, "-Werror"].flatten()
["-fno-threadsafe-statics", cppFlags, gtk2CCFlags].flatten() :
[cppFlags, gtk2CCFlags, "-Werror"].flatten()
LINUX.glass.glassgtk2.linker = linker
LINUX.glass.glassgtk2.linkFlags = IS_STATIC_BUILD ? linkFlags : [linkFlags, gtk2LinkFlags].flatten()
LINUX.glass.glassgtk2.lib = "glassgtk2"
Expand All @@ -241,31 +244,31 @@ LINUX.glass.glassgtk3 = [:]
LINUX.glass.glassgtk3.nativeSource = ft_gtk.getFiles()
LINUX.glass.glassgtk3.compiler = compiler
LINUX.glass.glassgtk3.ccFlags = IS_STATIC_BUILD ?
["-fno-threadsafe-statics", ccFlags, gtk3CCFlags].flatten() :
[ccFlags, gtk3CCFlags, "-Werror"].flatten()
["-fno-threadsafe-statics", cppFlags, gtk3CCFlags].flatten() :
[cppFlags, gtk3CCFlags, "-Werror"].flatten()
LINUX.glass.glassgtk3.linker = linker
LINUX.glass.glassgtk3.linkFlags = IS_STATIC_BUILD ? linkFlags : [linkFlags, gtk3LinkFlags].flatten()
LINUX.glass.glassgtk3.lib = "glassgtk3"

LINUX.decora = [:]
LINUX.decora.compiler = compiler
LINUX.decora.ccFlags = [ccFlags, "-ffast-math"].flatten()
LINUX.decora.ccFlags = [cppFlags, "-ffast-math"].flatten()
LINUX.decora.linker = linker
LINUX.decora.linkFlags = [linkFlags].flatten()
LINUX.decora.lib = "decora_sse"

LINUX.prism = [:]
LINUX.prism.nativeSource = file("${project(":graphics").projectDir}/src/main/native-prism")
LINUX.prism.compiler = compiler
LINUX.prism.ccFlags = [ccFlags, "-DINLINE=inline"].flatten()
LINUX.prism.ccFlags = [cFlags, "-DINLINE=inline"].flatten()
LINUX.prism.linker = linker
LINUX.prism.linkFlags = [linkFlags].flatten()
LINUX.prism.lib = "prism_common"

LINUX.prismSW = [:]
LINUX.prismSW.nativeSource = file("${project(":graphics").projectDir}/src/main/native-prism-sw")
LINUX.prismSW.compiler = compiler
LINUX.prismSW.ccFlags = [ccFlags, "-DINLINE=inline"].flatten()
LINUX.prismSW.ccFlags = [cFlags, "-DINLINE=inline"].flatten()
LINUX.prismSW.linker = linker
LINUX.prismSW.linkFlags = [linkFlags].flatten()
LINUX.prismSW.lib = "prism_sw"
Expand All @@ -275,7 +278,7 @@ LINUX.iio.nativeSource = [
file("${project("graphics").projectDir}/src/main/native-iio"),
file("${project("graphics").projectDir}/src/main/native-iio/libjpeg")]
LINUX.iio.compiler = compiler
LINUX.iio.ccFlags = [ccFlags].flatten()
LINUX.iio.ccFlags = [cFlags].flatten()
LINUX.iio.linker = linker
LINUX.iio.linkFlags = [linkFlags].flatten()
LINUX.iio.lib = "javafx_iio"
Expand All @@ -287,7 +290,7 @@ LINUX.prismES2.nativeSource = [
file("${project("graphics").projectDir}/src/main/native-prism-es2/x11")
]
LINUX.prismES2.compiler = compiler
LINUX.prismES2.ccFlags = ["-DLINUX", ccFlags].flatten()
LINUX.prismES2.ccFlags = ["-DLINUX", cFlags].flatten()
LINUX.prismES2.linker = linker
LINUX.prismES2.linkFlags =IS_STATIC_BUILD ? linkFlags : [linkFlags, "-lX11", "-lXxf86vm", "-lGL"].flatten()
LINUX.prismES2.lib = "prism_es2"
Expand All @@ -296,23 +299,23 @@ def closedDir = file("$projectDir/../rt-closed")
LINUX.font = [:]
LINUX.font.compiler = compiler
LINUX.font.nativeSource = [file("${project("graphics").projectDir}/src/main/native-font")]
LINUX.font.ccFlags = ["-DJFXFONT_PLUS", ccFlags].flatten()
LINUX.font.ccFlags = ["-DJFXFONT_PLUS", cppFlags].flatten()
LINUX.font.linker = linker
LINUX.font.linkFlags = [linkFlags].flatten()
LINUX.font.lib = "javafx_font"

LINUX.fontFreetype = [:]
LINUX.fontFreetype.nativeSource = ["src/main/native-font/freetype.c"]
LINUX.fontFreetype.compiler = compiler
LINUX.fontFreetype.ccFlags = ["-DJFXFONT_PLUS", ccFlags, freetypeCCFlags].flatten()
LINUX.fontFreetype.ccFlags = ["-DJFXFONT_PLUS", cFlags, freetypeCCFlags].flatten()
LINUX.fontFreetype.linker = linker
LINUX.fontFreetype.linkFlags = IS_STATIC_BUILD ? linkFlags : [linkFlags, freetypeLinkFlags].flatten()
LINUX.fontFreetype.lib = "javafx_font_freetype"

LINUX.fontPango = [:]
LINUX.fontPango.nativeSource = ["src/main/native-font/pango.c"]
LINUX.fontPango.compiler = compiler
LINUX.fontPango.ccFlags = ["-DJFXFONT_PLUS", ccFlags, pangoCCFlags].flatten()
LINUX.fontPango.ccFlags = ["-DJFXFONT_PLUS", cFlags, pangoCCFlags].flatten()
LINUX.fontPango.linker = linker
LINUX.fontPango.linkFlags =IS_STATIC_BUILD ? linkFlags : [linkFlags, pangoLinkFlags].flatten()
LINUX.fontPango.lib = "javafx_font_pango"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ public ChoiceBox(ObservableList<T> items) {
oldSM = sm;
if (sm != null) {
sm.selectedItemProperty().addListener(selectedItemListener);
// FIXME JDK-8242001 - must sync to model state always
if (sm.getSelectedItem() != null && ! valueProperty().isBound()) {
ChoiceBox.this.setValue(sm.getSelectedItem());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -28,9 +28,6 @@
import com.sun.javafx.scene.control.ContextMenuContent;
import com.sun.javafx.scene.control.behavior.BehaviorBase;
import javafx.beans.WeakInvalidationListener;
import javafx.scene.Node;
import javafx.scene.control.Accordion;
import javafx.scene.control.Button;
import javafx.scene.control.Control;
import javafx.scene.control.SkinBase;
import javafx.util.StringConverter;
Expand Down Expand Up @@ -156,20 +153,11 @@ public ChoiceBoxSkin(ChoiceBox<T> control) {
registerChangeListener(control.selectionModelProperty(), e -> updateSelectionModel());
registerChangeListener(control.showingProperty(), e -> {
if (getSkinnable().isShowing()) {
MenuItem item = null;

SelectionModel sm = getSkinnable().getSelectionModel();
SelectionModel<T> sm = getSkinnable().getSelectionModel();
if (sm == null) return;

long currentSelectedIndex = sm.getSelectedIndex();
int itemInControlCount = choiceBoxItems.size();
boolean hasSelection = currentSelectedIndex >= 0 && currentSelectedIndex < itemInControlCount;
if (hasSelection) {
item = popup.getItems().get((int) currentSelectedIndex);
if (item != null && item instanceof RadioMenuItem) ((RadioMenuItem)item).setSelected(true);
} else {
if (itemInControlCount > 0) item = popup.getItems().get(0);
}

// This is a fix for RT-9071. Ideally this won't be necessary in
// the long-run, but for now at least this resolves the
Expand Down Expand Up @@ -201,15 +189,6 @@ public ChoiceBoxSkin(ChoiceBox<T> control) {
label.setText(""); // clear label text when selectedIndex is -1
}
});
registerChangeListener(control.getSelectionModel().selectedItemProperty(), e -> {
if (getSkinnable().getSelectionModel() != null) {
int index = getSkinnable().getSelectionModel().getSelectedIndex();
if (index != -1) {
MenuItem item = popup.getItems().get(index);
if (item instanceof RadioMenuItem) ((RadioMenuItem)item).setSelected(true);
}
}
});
registerChangeListener(control.converterProperty(), e -> {
updateChoiceBoxItems();
updatePopupItems();
Expand Down Expand Up @@ -364,6 +343,11 @@ String getChoiceBoxSelectedText() {
return label.getText();
}

// Test only purpose
ContextMenu getChoiceBoxPopup() {
return popup;
}

private void addPopupItem(final T o, int i) {
MenuItem popupItem = null;
if (o instanceof Separator) {
Expand Down Expand Up @@ -428,6 +412,9 @@ private void updateSelection() {
MenuItem selectedItem = popup.getItems().get(selectedIndex);
if (selectedItem instanceof RadioMenuItem) {
((RadioMenuItem) selectedItem).setSelected(true);
} else {
// need to unselect toggles if selectionModel allows a Separator/MenuItem
// to be selected
toggleGroup.selectToggle(null);
}
// update the label
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
import javafx.scene.control.Label;
import javafx.scene.control.MenuItem;
import javafx.scene.control.RadioMenuItem;
import javafx.scene.control.SelectionModel;
import javafx.scene.control.SkinBase;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
Expand Down Expand Up @@ -195,12 +196,9 @@ public TabPaneSkin(TabPane control) {
}

initializeTabListener();
updateSelectionModel();

registerChangeListener(control.getSelectionModel().selectedItemProperty(), e -> {
isSelectingTab = true;
selectedTab = getSkinnable().getSelectionModel().getSelectedItem();
getSkinnable().requestLayout();
});
registerChangeListener(control.selectionModelProperty(), e -> updateSelectionModel());
registerChangeListener(control.sideProperty(), e -> updateTabPosition());
registerChangeListener(control.widthProperty(), e -> clipRect.setWidth(getSkinnable().getWidth()));
registerChangeListener(control.heightProperty(), e -> clipRect.setHeight(getSkinnable().getHeight()));
Expand Down Expand Up @@ -257,8 +255,6 @@ public TabPaneSkin(TabPane control) {
}
};



/***************************************************************************
* *
* Public API *
Expand All @@ -267,6 +263,11 @@ public TabPaneSkin(TabPane control) {

/** {@inheritDoc} */
@Override public void dispose() {
if (selectionModel != null) {
selectionModel.selectedItemProperty().removeListener(weakSelectionChangeListener);
selectionModel = null;
}

super.dispose();

if (behavior != null) {
Expand Down Expand Up @@ -429,6 +430,25 @@ public TabPaneSkin(TabPane control) {
* *
**************************************************************************/

private SelectionModel<Tab> selectionModel;
private InvalidationListener selectionChangeListener = observable -> {
isSelectingTab = true;
selectedTab = getSkinnable().getSelectionModel().getSelectedItem();
getSkinnable().requestLayout();
};
private WeakInvalidationListener weakSelectionChangeListener =
new WeakInvalidationListener(selectionChangeListener);

private void updateSelectionModel() {
if (selectionModel != null) {
selectionModel.selectedItemProperty().removeListener(weakSelectionChangeListener);
}
selectionModel = getSkinnable().getSelectionModel();
if (selectionModel != null) {
selectionModel.selectedItemProperty().addListener(weakSelectionChangeListener);
}
}

private static int getRotation(Side pos) {
switch (pos) {
case TOP:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -25,11 +25,17 @@

package javafx.scene.control.skin;

import javafx.scene.control.ContextMenu;

public class ChoiceBoxSkinNodesShim {

// can only access the getChoiceBoxSelectedText method in ChoiceBoxSkin
// from this package.
public static String getChoiceBoxSelectedText(ChoiceBoxSkin skin) {
return skin.getChoiceBoxSelectedText();
}

public static ContextMenu getChoiceBoxPopup(ChoiceBoxSkin skin) {
return skin.getChoiceBoxPopup();
}
}
Loading

0 comments on commit f1ac39b

Please sign in to comment.