Skip to content

Commit

Permalink
Fix task
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisePla committed Oct 30, 2024
1 parent 2541539 commit d05eb06
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
8 changes: 5 additions & 3 deletions src/Bloc-Text-Elements/BlTextElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -400,7 +400,9 @@ BlTextElement >> onMeasure: anExtentMeasurementSpec [

fillSize := 0.


self onParagraphMeasure: anExtentMeasurementSpec.
paragraph ifNil: [ ^ self textChanged ].
self onPostMeasure: anExtentMeasurementSpec.
self measureChildren: anExtentMeasurementSpec
]
Expand Down
13 changes: 7 additions & 6 deletions src/Bloc/BlElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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 ].
Expand Down Expand Up @@ -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 }
Expand Down
6 changes: 3 additions & 3 deletions src/Bloc/BlTaskQueue.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ BlTaskQueue >> requeue: aBlTask [
self enqueue: aBlTask
]

{ #category : #'api - running' }
{ #category : #actions }
BlTaskQueue >> runOn: aSpace [

| theTasks |
Expand All @@ -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."
Expand All @@ -158,7 +158,7 @@ BlTaskQueue >> runOn: aSpace [
run;
requeueTaskAfterExecution)
ifTrue: [ self requeue: aTask ]
ifFalse: [ aTask setComplete ] ] ]
ifFalse: [ aTask setComplete ] ] ] ]
]

{ #category : #accessing }
Expand Down

0 comments on commit d05eb06

Please sign in to comment.