File tree Expand file tree Collapse file tree
src/commonMain/kotlin/com/kdroid/composetray Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -741,7 +741,6 @@ private fun ApplicationScope.TrayAppImplLinux(
741741 }
742742
743743 val dialogState = rememberDialogState(position = initialPositionForFirstFrame, size = currentWindowSize)
744- SideEffect { dialogState.position = initialPositionForFirstFrame }
745744 LaunchedEffect (currentWindowSize) { dialogState.size = currentWindowSize }
746745
747746 // Visibility controller for exit-finish detection; content will NOT be disposed.
Original file line number Diff line number Diff line change @@ -328,24 +328,30 @@ private fun calculateWindowPositionFromClick(
328328 horizontalOffset : Int ,
329329 verticalOffset : Int
330330): WindowPosition {
331+ val isTop = trayPosition == TrayPosition .TOP_LEFT || trayPosition == TrayPosition .TOP_RIGHT
332+ val isRight = trayPosition == TrayPosition .TOP_RIGHT || trayPosition == TrayPosition .BOTTOM_RIGHT
333+
331334 var x = clickX - (windowWidth / 2 )
332- var y = if (trayPosition == TrayPosition .TOP_LEFT || trayPosition == TrayPosition .TOP_RIGHT ) {
335+ var y = if (isTop) {
336+ // Anchor below the top bar
333337 clickY
334338 } else {
339+ // Anchor above the bottom bar
335340 clickY - windowHeight
336341 }
337342
338- // Offsets utilisateur
339- x + = horizontalOffset
340- y + = verticalOffset
343+ // Direction-aware offsets: always push AWAY from the bar/edge.
344+ x + = if (isRight) - horizontalOffset else horizontalOffset
345+ y + = if (isTop) verticalOffset else - verticalOffset
341346
342- // Clamp écran
347+ // Clamp to screen
343348 if (x < 0 ) x = 0 else if (x + windowWidth > screenWidth) x = screenWidth - windowWidth
344349 if (y < 0 ) y = 0 else if (y + windowHeight > screenHeight) y = screenHeight - windowHeight
345350
346351 return WindowPosition (x = x.dp, y = y.dp)
347352}
348353
354+
349355/* * Position de repli coin + offsets */
350356private fun fallbackCornerPosition (
351357 w : Int , h : Int ,
You can’t perform that action at this time.
0 commit comments