From d05eb064c625f20892672ef2feab210e9d1b4064 Mon Sep 17 00:00:00 2001 From: Louise Plantec Date: Wed, 30 Oct 2024 15:29:10 +0100 Subject: [PATCH] Fix task --- src/Bloc-Text-Elements/BlTextElement.class.st | 8 +++++--- src/Bloc/BlElement.class.st | 13 +++++++------ src/Bloc/BlTaskQueue.class.st | 6 +++--- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/Bloc-Text-Elements/BlTextElement.class.st b/src/Bloc-Text-Elements/BlTextElement.class.st index 63b4f9f54..4989bd0e1 100644 --- a/src/Bloc-Text-Elements/BlTextElement.class.st +++ b/src/Bloc-Text-Elements/BlTextElement.class.st @@ -379,18 +379,18 @@ BlTextElement >> offsetFromSegmentStart [ ^ self textFlow offsetFromSegmentStart ] -{ #category : #'hooks - session' } +{ #category : #'hooks - children' } BlTextElement >> onAddedToSceneGraph [ super onAddedToSceneGraph. paragraph - ifNil: [ ^ self ]. + ifNil: [ ^ self textChanged ]. paragraph session == Smalltalk session ifFalse: [ self textChanged ] ] -{ #category : #layout } +{ #category : #'hooks - children' } BlTextElement >> onMeasure: anExtentMeasurementSpec [ "Do the measuring job" @@ -400,7 +400,9 @@ BlTextElement >> onMeasure: anExtentMeasurementSpec [ fillSize := 0. + self onParagraphMeasure: anExtentMeasurementSpec. + paragraph ifNil: [ ^ self textChanged ]. self onPostMeasure: anExtentMeasurementSpec. self measureChildren: anExtentMeasurementSpec ] diff --git a/src/Bloc/BlElement.class.st b/src/Bloc/BlElement.class.st index 80fd2ca90..82d33db14 100644 --- a/src/Bloc/BlElement.class.st +++ b/src/Bloc/BlElement.class.st @@ -544,11 +544,12 @@ BlElement >> attachSpace [ detached from the space. We have to requestFocus again, otherwise the focus request will never reach the space. (https://github.com/feenkcom/gtoolkit/issues/1457)" - self isFocused + self isFocusable ifTrue: [ + self isFocused ifTrue: [ self requestFocus: self ] ifFalse: [ self space focusOwner == self - ifTrue: [ self loseFocus: self ] ]. + ifTrue: [ self loseFocus: self ] ] ]. self taskQueue isEmpty ifFalse: [ self space enqueueTasksFrom: self taskQueue ]. @@ -1947,22 +1948,22 @@ BlElement >> inSpace [ ] -{ #category : #processing } +{ #category : #'api - space' } BlElement >> inUIProcessDo: aBlock [ "Run the supplied block in the UI process. If the active process is already the UI process, evaluate immediately. Otherwise, queue up for the next frame." - | uiProcess | +" | uiProcess | self isAttachedToSceneGraph ifTrue: [ self space host uiProcessDo: [ :uiProc | uiProcess := uiProc ] ]. uiProcess = Processor activeProcess ifTrue: [ aBlock value ] - ifFalse: [ + ifFalse: [ " self enqueueTask: (BlTaskAction new action: aBlock; - yourself) ] + yourself) "]" ] { #category : #initialization } diff --git a/src/Bloc/BlTaskQueue.class.st b/src/Bloc/BlTaskQueue.class.st index 7802ce5f0..f206485f9 100644 --- a/src/Bloc/BlTaskQueue.class.st +++ b/src/Bloc/BlTaskQueue.class.st @@ -133,7 +133,7 @@ BlTaskQueue >> requeue: aBlTask [ self enqueue: aBlTask ] -{ #category : #'api - running' } +{ #category : #actions } BlTaskQueue >> runOn: aSpace [ | theTasks | @@ -147,7 +147,7 @@ BlTaskQueue >> runOn: aSpace [ tasks := nil. "Mark all tasks as pending" theTasks ifNotNil: [ - theTasks do: [ :task | task setPendingExecution ] ] ]. + theTasks do: [ :task | task setPendingExecution ] ] . "Since we have an immutable reference to original array, there is need to execute task within a lock." @@ -158,7 +158,7 @@ BlTaskQueue >> runOn: aSpace [ run; requeueTaskAfterExecution) ifTrue: [ self requeue: aTask ] - ifFalse: [ aTask setComplete ] ] ] + ifFalse: [ aTask setComplete ] ] ] ] ] { #category : #accessing }