Skip to content
This repository was archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
Add trailing comma, reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
SerVB committed Aug 21, 2020
1 parent 4159e49 commit 0ee617b
Show file tree
Hide file tree
Showing 14 changed files with 250 additions and 230 deletions.
406 changes: 208 additions & 198 deletions .idea/codeStyles/Project.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ sealed class AwtImageInfo {
data class Area(
val dx1: Int, val dy1: Int, val dx2: Int, val dy2: Int,
val sx1: Int, val sy1: Int, val sx2: Int, val sy2: Int,
val argbBackgroundColor: Int?
val argbBackgroundColor: Int?,
) : AwtImageInfo()

data class Transformation(val tx: List<Double>) : AwtImageInfo()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class PGraphics2D private constructor(
private var paint: Paint,
private var foregroundColor: Color,
private var stroke: Stroke,
private var font: Font
private var font: Font,
) : Graphics2D() {

private var backingFontRenderContext = FontRenderContext(
Expand Down Expand Up @@ -142,7 +142,7 @@ class PGraphics2D private constructor(
backgroundColor: Color?,
paint: Paint?,
foregroundColor: Color?,
font: Font?
font: Font?,
) : this(
drawEventQueue = drawEventQueue,
backingComposite = AlphaComposite.SrcOver, // from Graphics2D "Default Rendering Attributes" java doc
Expand Down Expand Up @@ -713,7 +713,7 @@ class PGraphics2D private constructor(
img: Image?,
dx1: Int, dy1: Int, dx2: Int, dy2: Int,
sx1: Int, sy1: Int, sx2: Int, sy2: Int,
observer: ImageObserver?
observer: ImageObserver?,
): Boolean {
return drawImage(
img = img,
Expand All @@ -729,7 +729,7 @@ class PGraphics2D private constructor(
dx1: Int, dy1: Int, dx2: Int, dy2: Int,
sx1: Int, sy1: Int, sx2: Int, sy2: Int,
bgcolor: Color?,
observer: ImageObserver?
observer: ImageObserver?,
): Boolean {
val info = AwtImageInfo.Area(
dx1 = dx1, dy1 = dy1, dx2 = dx2, dy2 = dy2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PVolatileImage(
private val width: Int,
private val height: Int,
transparency: Int,
private val caps: ImageCapabilities?
private val caps: ImageCapabilities?,
) : VolatileImage() {

init {
Expand Down Expand Up @@ -155,6 +155,6 @@ class PVolatileImage(
class Descriptor(
val pVolatileImageId: Long,
val width: Int,
val height: Int
val height: Int,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fun intersectRectShape(
r: Rectangle2D,
s: Shape,
keepR: Boolean,
keepS: Boolean
keepS: Boolean,
): Shape {
if (r.contains(s.bounds2D)) {
if (keepS) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ abstract class PComponentPeer(target: Component, private val isFocusable: Boolea
temporary: Boolean,
focusedWindowChangeAllowed: Boolean,
time: Long,
cause: FocusEvent.Cause
cause: FocusEvent.Cause,
): Boolean {
pWindow.target.let {
return PKeyboardFocusManagerPeer.deliverFocus(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ object PKeyboardFocusManagerPeer : KeyboardFocusManagerPeerImpl() {
temporary: Boolean,
focusedWindowChangeAllowed: Boolean,
time: Long,
cause: FocusEvent.Cause
cause: FocusEvent.Cause,
): Boolean {
focusOwnerLock.read {
return deliverFocus(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ object ConnectionUtil {

data class SenderReceiver(
val sender: suspend (ToClientMessageType) -> Unit,
val receiver: suspend () -> ToServerMessageType
val receiver: suspend () -> ToServerMessageType,
)

private suspend fun DefaultWebSocketServerSession.doHandshake(): SenderReceiver {
Expand Down Expand Up @@ -108,8 +108,10 @@ object ConnectionUtil {
)
}

fun startServerAndDoHandshake(port: Int = 8887,
afterHandshake: suspend DefaultWebSocketServerSession.(senderReceiver: SenderReceiver) -> Unit): ApplicationEngine =
fun startServerAndDoHandshake(
port: Int = 8887,
afterHandshake: suspend DefaultWebSocketServerSession.(senderReceiver: SenderReceiver) -> Unit,
): ApplicationEngine =
embeddedServer(Netty, port) {
install(WebSockets)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ data class SetUpClientData(
val toClientMessageEncoder: ToClientMessageEncoder,
val toClientMessageCompressor: MessageCompressor<ToClientTransferableType>,
val toServerMessageDecoder: ToServerMessageDecoder,
val toServerMessageDecompressor: MessageDecompressor<ToServerTransferableType>
val toServerMessageDecompressor: MessageDecompressor<ToServerTransferableType>,
)

data class SetUpClientSettings(
override val connectionMillis: Long,
val setUpClientData: SetUpClientData
val setUpClientData: SetUpClientData,
) : ClientSettings()

data class ReadyClientSettings(
override val connectionMillis: Long,
val setUpClientData: SetUpClientData
val setUpClientData: SetUpClientData,
) : ClientSettings() {

var touchState: TouchState = TouchState.Released
Expand All @@ -73,7 +73,7 @@ data class ReadyClientSettings(

data class Scrolling(
val initialX: Int, val initialY: Int,
override val lastX: Int, override val lastY: Int
override val lastX: Int, override val lastY: Int,
) : TouchState(), WithCoordinates

interface WithCoordinates {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ import java.awt.Point as AwtPoint
class ProjectorServer private constructor(
port: Int,
private val laterInvokator: LaterInvokator,
private val isAgent: Boolean
private val isAgent: Boolean,
) : WebSocketServer(InetSocketAddress(port)) {

private lateinit var updateThread: Thread
Expand Down Expand Up @@ -318,7 +318,8 @@ class ProjectorServer private constructor(
val isKeystroke = KeyModifier.CTRL_KEY in message.modifiers
val key = if (isKeystroke) {
code.toJavaControlCharOrNull()
} else {
}
else {
message.key.singleOrNull()
} ?: KeyEvent.CHAR_UNDEFINED

Expand Down Expand Up @@ -401,7 +402,8 @@ class ProjectorServer private constructor(

is ClientSetKeymapEvent -> if (isAgent) {
logger.info { "Client keymap was ignored!" }
} else {
}
else {
KeymapSetter.setKeymap(message.keymap)
}

Expand Down Expand Up @@ -656,7 +658,7 @@ class ProjectorServer private constructor(
key: Char,
code: Int,
location: Int,
modifiers: Set<KeyModifier>
modifiers: Set<KeyModifier>,
): KeyEvent {
val manager = KeyboardFocusManager.getCurrentKeyboardFocusManager()
val focusedComponent = manager.focusOwner ?: source
Expand All @@ -677,7 +679,7 @@ class ProjectorServer private constructor(
event: ClientMouseEvent,
previousTouchState: TouchState,
newTouchState: TouchState,
connectionMillis: Long
connectionMillis: Long,
): MouseEvent {
val locationOnScreen = source.locationOnScreen

Expand Down Expand Up @@ -724,7 +726,8 @@ class ProjectorServer private constructor(

val awtEventButton = when (event.mouseEventType) {
ClientMouseEvent.MouseEventType.MOVE,
ClientMouseEvent.MouseEventType.OUT -> MouseEvent.NOBUTTON
ClientMouseEvent.MouseEventType.OUT,
-> MouseEvent.NOBUTTON

else -> event.button + 1
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private fun isIdeaInProperState(ideaClassLoader: ClassLoader?): Boolean {
fun invokeWhenIdeaIsInitialized(
purpose: String,
onNoIdeaFound: (() -> Unit)? = null,
onInitialized: (ideaClassLoader: ClassLoader) -> Unit
onInitialized: (ideaClassLoader: ClassLoader) -> Unit,
) {
thread(isDaemon = true) {
if (onNoIdeaFound == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class MarkdownPanelUpdater(
private val setHtmlCallback: BiConsumer<Int, String>,
private val setCssCallback: BiConsumer<Int, String>,
private val scrollCallback: BiConsumer<Int, Int>,
private val browseUriCallback: Consumer<String>
private val browseUriCallback: Consumer<String>,
) {

private lateinit var ideaClassLoader: ClassLoader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ internal class DelegatingJvmLogger(tag: String) : JvmLogger {
logFunction: JvmLogger.(t: Throwable?, lazyMessage: () -> String) -> Unit,
loggingEventConstructor: (t: Throwable?, lazyMessage: () -> String) -> LoggingEvent,
t: Throwable?,
lazyMessage: () -> String
lazyMessage: () -> String,
) {
consoleJvmLogger.logFunction(t, lazyMessage)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ object ProjectorImageCacher : ImageCacher {
is SunVolatileImage -> getImageId(image.snapshot, "$methodName, extracted snapshot from SunVolatileImage")

is MultiResolutionImage -> image.resolutionVariants
.singleOrNull()
?.let { getImageId(it, "$methodName, extracted single variant") }
?: ImageId.Unknown(
"$methodName received MultiResolutionImage with bad variant count (${image.resolutionVariants.size}): $image")
.singleOrNull()
?.let { getImageId(it, "$methodName, extracted single variant") }
?: ImageId.Unknown(
"$methodName received MultiResolutionImage with bad variant count (${image.resolutionVariants.size}): $image")

else -> ImageId.Unknown("$methodName received ${this::class.qualifiedName}: $this")
}
Expand All @@ -72,7 +72,12 @@ object ProjectorImageCacher : ImageCacher {

private val identityIdToImageId = mutableMapOf<IdentityImageId, ImageId>()

private fun <T : Image> putImageIfNeeded(identityImageId: IdentityImageId, image: T, imageIdBuilder: T.() -> ImageId, imageConverter: T.() -> ImageData) {
private fun <T : Image> putImageIfNeeded(
identityImageId: IdentityImageId,
image: T,
imageIdBuilder: T.() -> ImageId,
imageConverter: T.() -> ImageData,
) {
synchronized(this) {
if (identityImageId !in identityIdToImageId) {
val imageId = image.imageIdBuilder()
Expand Down Expand Up @@ -167,7 +172,7 @@ private val dataFieldInt = DataBufferInt::class.java.getDeclaredField("data").ap
}

val BufferedImage.imageId: ImageId
get() = when(raster.dataBuffer) {
get() = when (raster.dataBuffer) {
is DataBufferByte -> {
val pixels = dataFieldByte.get(raster.dataBuffer) as ByteArray

Expand Down

0 comments on commit 0ee617b

Please sign in to comment.