mirror of
https://gitlab.com/cc-ru/ocelot/ocelot-desktop.git
synced 2025-12-20 02:59:19 +01:00
Remove the window focusing hack
This commit is contained in:
parent
1c19df7cf3
commit
87b13e66b1
@ -501,11 +501,6 @@ object UiHandler extends Logging {
|
||||
for (mouseTarget <- mouseTarget) {
|
||||
dispatchCapturing(mouseTarget)(event)
|
||||
}
|
||||
|
||||
// TODO: this should be done in the event capturing phase in [[Window]] itself.
|
||||
for (mouseTarget <- mouseTarget if !mouseTarget.isInstanceOf[Window]) {
|
||||
focusParentWindow(mouseTarget.parent)
|
||||
}
|
||||
} else {
|
||||
dispatchEvent(hierarchy)(Capturing(event))
|
||||
dispatchEvent(hierarchy.reverseIterator)(event)
|
||||
@ -525,15 +520,6 @@ object UiHandler extends Logging {
|
||||
root.update()
|
||||
}
|
||||
|
||||
@tailrec
|
||||
private def focusParentWindow(parent: Option[Widget]): Unit = {
|
||||
parent match {
|
||||
case Some(window: Window) => window.focus()
|
||||
case Some(widget) => focusParentWindow(widget.parent)
|
||||
case None =>
|
||||
}
|
||||
}
|
||||
|
||||
private def updateWindowSizeAndPosition(): Unit = {
|
||||
val width = Display.getWidth
|
||||
val height = Display.getHeight
|
||||
|
||||
@ -4,7 +4,7 @@ import ocelot.desktop.Settings
|
||||
import ocelot.desktop.geometry.{Rect2D, Size2D, Vector2D}
|
||||
import ocelot.desktop.ui.UiHandler
|
||||
import ocelot.desktop.ui.event.handlers.MouseHandler
|
||||
import ocelot.desktop.ui.event.{DragEvent, KeyEvent, MouseEvent}
|
||||
import ocelot.desktop.ui.event.{Capturing, DragEvent, KeyEvent, MouseEvent}
|
||||
import ocelot.desktop.ui.widget.Widget
|
||||
import ocelot.desktop.util.Persistable
|
||||
import org.lwjgl.input.Keyboard
|
||||
@ -30,7 +30,7 @@ trait Window extends Widget with Persistable with MouseHandler {
|
||||
override protected def receiveDragEvents: Boolean = true
|
||||
|
||||
eventHandlers += {
|
||||
case MouseEvent(MouseEvent.State.Pressed, _) =>
|
||||
case Capturing(MouseEvent(MouseEvent.State.Pressed, _)) =>
|
||||
focus()
|
||||
|
||||
case ev @ DragEvent(DragEvent.State.Start, MouseEvent.Button.Left, mousePos) =>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user