pharo-graphics / Bloc

Low-level UI infrastructure & framework for Pharo
MIT License
81 stars 40 forks source link

BlSpaceResizedEvent weird behavior #626

Open tinchodias opened 5 days ago

tinchodias commented 5 days ago

With BlOSWindowSDL2Host, the event is dispatched twice when the cursor drags the border: Oct-14-2024 19-37-11

Code:

queue := WaitfreeQueue new.

space := BlSpace new.
space
    addEventHandlerOn: BlSpaceResizedEvent
    do: [ :evt | queue nextPut: evt ].
space useSDL2Host.
space show.

events := OrderedCollection new.
queue flush: [ :anEvent | events add: anEvent ]. events.
tinchodias commented 5 days ago

However, the same event is not announced when size changes due to BlSpace>>extent::

Oct-14-2024 19-43-05

Code:

queue := WaitfreeQueue new.

space := BlSpace new.
space
    addEventHandlerOn: BlSpaceResizedEvent
    do: [ :evt | queue nextPut: evt ].
space useSDL2Host.
space show.

space extent: 400 asPoint.

events := OrderedCollection new.
queue flush: [ :anEvent | events add: anEvent ]. events.
tinchodias commented 5 days ago

EDIT: this doesn't happen anymore after #614

MorphicWindow host dispatches 3 BlSpaceResizedEvent only on show:

Oct-14-2024 19-46-51

code:

queue := WaitfreeQueue new.

space := BlSpace new.
space
    addEventHandlerOn: BlSpaceResizedEvent
    do: [ :evt | queue nextPut: evt ].
space useMorphicHost.
space show.

events := OrderedCollection new.
queue flush: [ :anEvent | events add: anEvent ]. events.
tinchodias commented 4 days ago

This report is affected by the recently merged https://github.com/pharo-graphics/Bloc/pull/614