Can't run dialogs with GTK+

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Can't run dialogs with GTK+

ZuLuuuuuu
Hello,

I was trying to show a dialog via GTK+. Here is a sample code I'm using:

http://paste.ubuntu.com/483058/

On my system when I click the button, the application freezes. This happens on every kind of dialog. But apparently, this is not the case for other users so I guess the problem is on my system. My question is, how can I diagnose what is going wrong and hopefully fix it?

By the way, the dialogs gst-browser has works. And my system is Salix 13.1.1 (64-bit). GLib: 2.24.1, GTK+: 2.20.1.
Canol Gökel
Reply | Threaded
Open this post in threaded view
|

Re: Can't run dialogs with GTK+

Paolo Bonzini-2
On 08/24/2010 09:55 PM, ZuLuuuuuu wrote:
> I was trying to show a dialog via GTK+. Here is a sample code I'm using:
>
> http://paste.ubuntu.com/483058/
>
> On my system when I click the button, the application freezes. This happens
> on every kind of dialog. But apparently, this is not the case for other
> users so I guess the problem is on my system. My question is, how can I
> diagnose what is going wrong and hopefully fix it?

I actually can reproduce this.  Gwen, any ideas?

Paolo

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Can't run dialogs with GTK+

MrGwen
Ok I understand the problem, run message launches a new inner loop.
But with our gtk event loop we should use showAll, showModalOnAnswer:, ...

Paolo can you merge the dialog extentions in extensions.st into the
Gtk binding ?

Canol can you replace in cbShowDialogAbout run by showAll ?

Cheers,
Gwen

On Wed, Aug 25, 2010 at 9:57 AM, Paolo Bonzini <[hidden email]> wrote:

> On 08/24/2010 09:55 PM, ZuLuuuuuu wrote:
>>
>> I was trying to show a dialog via GTK+. Here is a sample code I'm using:
>>
>> http://paste.ubuntu.com/483058/
>>
>> On my system when I click the button, the application freezes. This
>> happens
>> on every kind of dialog. But apparently, this is not the case for other
>> users so I guess the problem is on my system. My question is, how can I
>> diagnose what is going wrong and hopefully fix it?
>
> I actually can reproduce this.  Gwen, any ideas?
>
> Paolo
>
> _______________________________________________
> help-smalltalk mailing list
> [hidden email]
> http://lists.gnu.org/mailman/listinfo/help-smalltalk
>

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Can't run dialogs with GTK+

Paolo Bonzini-2
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

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Can't run dialogs with GTK+

MrGwen
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 <[hidden email]> 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
>

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Can't run dialogs with GTK+

ZuLuuuuuu
In reply to this post by MrGwen
Gwenaël Casaccio wrote
Canol can you replace in cbShowDialogAbout run by showAll ?

Cheers,
Gwen
Ok, I replaced it with showAll for now. Works fine, thanks...
Canol Gökel