help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Can't run dialogs with GTK+


From: Gwenaël Casaccio
Subject: Re: [Help-smalltalk] Can't run dialogs with GTK+
Date: Wed, 25 Aug 2010 13:28:14 +0200

This should work

run [
        <category: 'services'>

        | signals sema answer modal destroyed |
        destroyed := false.
        sema := Semaphore new.
        modal := self getModal.
        self setModal: true.
        signals := {
            self
                connectSignal: 'response'
                to: [ :dialog :integer | answer := integer. sema signal ]
                selector: #'value:value:'.

            self
                connectSignal: 'unmap'
                to: sema
                selector: #signal.

            self
                connectSignal: 'delete-event'
                to: [ :dialog :event | answer := Gtk
gtkResponseDeleteEvent. sema signal. true ]
                selector: #'value:value:'.

            self
                connectSignal: 'destroy'
                to: [ destroyed := true. true ]
                selector: #value }.

        self showAll.
        Processor activeProcess detach.
        sema wait.
        destroyed ifFalse: [
            self
                setModal: modal;
                hideAll.
            signals do: [ :each | self disconnectSignal: each ] ].
        ^ answer
    ]

On Wed, Aug 25, 2010 at 10:54 AM, Paolo Bonzini <address@hidden> wrote:
> On 08/25/2010 10:51 AM, Gwenaël Casaccio wrote:
>>
>> Ok I understand the problem, run message launches a new inner loop.
>> But with our gtk event loop we should use showAll, showModalOnAnswer:, ...
>
> Hmm, #run is overridden by GtkImpl.st to not use a new event loop.  It uses
> a Smalltalk semaphore and the outer event loop.  Since events are run in
> their own Process, everything should work without blocking the outer event
> loop.
>
> Paolo
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]