osso, muali , dbus and Qt closeEvent()s

osso, muali , dbus and Qt closeEvent()s

David Greaves
Karma: 715
2009-03-23 13:44 UTC
Hi

Crossposting as I think this is a maemo-dev question of interest to Qt devs :)

I am having a problem with my Qt applications and the osso window manager.
Essentially the window manager is doing a sigkill which doesn't allow Qt to emit
a closeEvent().

A gtk app calls osso_initialize() which amongst other things registers a service
name to the DBus.freedestop.org service.

I've been through osso-init.c and osso-rpc.c to try and figure it out but,
whilst I've made progress, I've not finished.

So far I have:
* added an entry into the desktop file for X-Osso-Service=com.dgreaves.shopper
* created : /usr/share/dbus-1/services/com.dgreaves.shopper.service
* added a QDBusConnection::sessionBus().interface()->registerService (name, 1 );
and
connect(iface, SIGNAL(serviceOwnerChanged(QString,QString,QString)),
this, SLOT(serviceOwnerChanged(QString,QString,QString)));

dbus-monitor is showing very similar messages for gtk and my Qt apps now.

I've hooked serviceOwnerChanged and try to send out a ReleaseName to
org.freedesktop.DBus.

However I'm still getting killed.

Digging into libosso and libossowm/osso-rpc.c I find

#define HILDON_DESKTOP_SERVICE "com.nokia.hildon-desktop"
#define HDWM_STARTUP_NOTIFICATION_IFACE "com.nokia.hildon.hdwm.startupnotification"
#define HDWM_OBJECT_PATH "/com/nokia/hildon/hdwm"
#define HDWM_STARTUP_NOTIFICATION_STARTING "starting"

This failed as
Name:org.freedesktop.DBus.Error.UnknownMethod

Message:Method "starting" with signature "" on interface
"com.nokia.hildon.hdwm.startupnotification" doesn't exist

I installed qdbusmonitor and "com.nokia.hildon-desktop" doesn't provide
hdwm.startupnotification or starting

Nor do I see it on the dbus-monitor --session when my gtk app runs.

Any pointers?

David


--
"Don't worry, you'll be fine; I saw it work in a cartoon once..."
  •  Reply

Re: osso, muali , dbus and Qt closeEvent()s

2009-03-24 16:30 UTC
On Mon, 2009-03-23 at 14:44 +0100, ext David Greaves wrote:
> Hi
>
> Crossposting as I think this is a maemo-dev question of interest to Qt devs :)
>
> I am having a problem with my Qt applications and the osso window manager.
> Essentially the window manager is doing a sigkill which doesn't allow Qt to emit
> a closeEvent().

You mean D-Bus daemon is killing you 20-30s after you are D-Bus
activated?

Maybe looking at this example helps:
https://garage.maemo.org/svn/maemoexamples/tags/maemo_4.1/maemopad/

> A gtk app calls osso_initialize() which amongst other things registers a service
> name to the DBus.freedestop.org service.
>
> I've been through osso-init.c and osso-rpc.c to try and figure it out but,
> whilst I've made progress, I've not finished.
>
> So far I have:
> * added an entry into the desktop file for X-Osso-Service=com.dgreaves.shopper
> * created : /usr/share/dbus-1/services/com.dgreaves.shopper.service
> * added a QDBusConnection::sessionBus().interface()->registerService (name, 1 );
> and
> connect(iface, SIGNAL(serviceOwnerChanged(QString,QString,QString)),
> this, SLOT(serviceOwnerChanged(QString,QString,QString)));
>
> dbus-monitor is showing very similar messages for gtk and my Qt apps now.
>
> I've hooked serviceOwnerChanged and try to send out a ReleaseName to
> org.freedesktop.DBus.
>
> However I'm still getting killed.
>
> Digging into libosso and libossowm/osso-rpc.c I find
>
> #define HILDON_DESKTOP_SERVICE "com.nokia.hildon-desktop"
> #define HDWM_STARTUP_NOTIFICATION_IFACE "com.nokia.hildon.hdwm.startupnotification"
> #define HDWM_OBJECT_PATH "/com/nokia/hildon/hdwm"
> #define HDWM_STARTUP_NOTIFICATION_STARTING "starting"

You don't need this. It's just for the "Loading..." banner in Diablo.

> This failed as
> Name:org.freedesktop.DBus.Error.UnknownMethod
>
> Message:Method "starting" with signature "" on interface
> "com.nokia.hildon.hdwm.startupnotification" doesn't exist
>
> I installed qdbusmonitor and "com.nokia.hildon-desktop" doesn't provide
> hdwm.startupnotification or starting
>
> Nor do I see it on the dbus-monitor --session when my gtk app runs.
>
> Any pointers?
>
> David
>
>
  •  Reply

Re: osso, muali , dbus and Qt closeEvent()s

Antonio Aloisio
Karma: 261
2009-03-24 17:01 UTC
Hi,
I fixed the closeEvent issue and now it works fine.
The problem was inside Qt and it was due to an initialization of a
QVarLengthArray for some Atom values.
Now Qt sets the WM properties correctly and then also the WM_DELETE_WINDOW
one.
The closeEvents are now sent correctly.

Cheers,
Antonio.


2009/3/24 Kimmo Hämäläinen <kimmo.hamalainen@nokia.com>

> On Mon, 2009-03-23 at 14:44 +0100, ext David Greaves wrote:
> > Hi
> >
> > Crossposting as I think this is a maemo-dev question of interest to Qt
> devs :)
> >
> > I am having a problem with my Qt applications and the osso window
> manager.
> > Essentially the window manager is doing a sigkill which doesn't allow Qt
> to emit
> > a closeEvent().
>
> You mean D-Bus daemon is killing you 20-30s after you are D-Bus
> activated?
>
> Maybe looking at this example helps:
> https://garage.maemo.org/svn/maemoexamples/tags/maemo_4.1/maemopad/
>
> > A gtk app calls osso_initialize() which amongst other things registers a
> service
> > name to the DBus.freedestop.org service.
> >
> > I've been through osso-init.c and osso-rpc.c to try and figure it out
> but,
> > whilst I've made progress, I've not finished.
> >
> > So far I have:
> > * added an entry into the desktop file for
> X-Osso-Service=com.dgreaves.shopper
> > * created : /usr/share/dbus-1/services/com.dgreaves.shopper.service
> > * added a QDBusConnection::sessionBus().interface()->registerService
> (name, 1 );
> > and
> > connect(iface,
> SIGNAL(serviceOwnerChanged(QString,QString,QString)),
> > this, SLOT(serviceOwnerChanged(QString,QString,QString)));
> >
> > dbus-monitor is showing very similar messages for gtk and my Qt apps now.
> >
> > I've hooked serviceOwnerChanged and try to send out a ReleaseName to
> > org.freedesktop.DBus.
> >
> > However I'm still getting killed.
> >
> > Digging into libosso and libossowm/osso-rpc.c I find
> >
> > #define HILDON_DESKTOP_SERVICE "com.nokia.hildon-desktop"
> > #define HDWM_STARTUP_NOTIFICATION_IFACE
> "com.nokia.hildon.hdwm.startupnotification"
> > #define HDWM_OBJECT_PATH "/com/nokia/hildon/hdwm"
> > #define HDWM_STARTUP_NOTIFICATION_STARTING "starting"
>
> You don't need this. It's just for the "Loading..." banner in Diablo.
>
> > This failed as
> > Name:org.freedesktop.DBus.Error.UnknownMethod
> >
> > Message:Method "starting" with signature "" on interface
> > "com.nokia.hildon.hdwm.startupnotification" doesn't exist
> >
> > I installed qdbusmonitor and "com.nokia.hildon-desktop" doesn't provide
> > hdwm.startupnotification or starting
> >
> > Nor do I see it on the dbus-monitor --session when my gtk app runs.
> >
> > Any pointers?
> >
> > David
> >
> >
>
>



--

George Burns - "Don't stay in bed, unless you can make money in bed."
  •  Reply

Re: osso, muali , dbus and Qt closeEvent()s

David Greaves
Karma: 715
2009-03-24 17:49 UTC
Kimmo Hämäläinen wrote:
> On Mon, 2009-03-23 at 14:44 +0100, ext David Greaves wrote:
>> Hi
>>
>> Crossposting as I think this is a maemo-dev question of interest to Qt devs :)
>>
>> I am having a problem with my Qt applications and the osso window manager.
>> Essentially the window manager is doing a sigkill which doesn't allow Qt to emit
>> a closeEvent().
>
> You mean D-Bus daemon is killing you 20-30s after you are D-Bus
> activated?
No. I know about that one :)

ah, and as I write this I see Antonio has solved it :) \o/
But we still have issues....

> Maybe looking at this example helps:
> https://garage.maemo.org/svn/maemoexamples/tags/maemo_4.1/maemopad/
Yes, used that - happy with osso_initialize()

I actually would like to know what osso_initialize() should do so we can do the
right things in a Qt app though.

And your name appears a lot in the source Kimmo :)

>> Digging into libosso and libossowm/osso-rpc.c I find
>>
>> #define HILDON_DESKTOP_SERVICE "com.nokia.hildon-desktop"
>> #define HDWM_STARTUP_NOTIFICATION_IFACE "com.nokia.hildon.hdwm.startupnotification"
>> #define HDWM_OBJECT_PATH "/com/nokia/hildon/hdwm"
>> #define HDWM_STARTUP_NOTIFICATION_STARTING "starting"
>
> You don't need this. It's just for the "Loading..." banner in Diablo.
OK - but do you have a list of things that we should do to make Qt equivalent to
gtk?

I seem to recall things like dbus messages on low memory and others. Are these
documented?

The banner would be nice - but the dbus services listed above don't seem to be
correct - and I can't find them using a dbus introspect (qdbusviewer)
ie this bit (from original email)

>> Message:Method "starting" with signature "" on interface
>> "com.nokia.hildon.hdwm.startupnotification" doesn't exist
>>
>> I installed qdbusmonitor and "com.nokia.hildon-desktop" doesn't provide
>> hdwm.startupnotification or starting
>>
>> Nor do I see it on the dbus-monitor --session when my gtk app runs.

Are you in a postion to help us write the Qt equivalent of osso_initialize() and
help make Qt == Gtk


David

--
"Don't worry, you'll be fine; I saw it work in a cartoon once..."
  •  Reply

Re: osso, muali , dbus and Qt closeEvent()s

2009-03-25 15:35 UTC
Haloo!

On Tue, 2009-03-24 at 18:49 +0100, ext David Greaves wrote:
> Kimmo Hämäläinen wrote:
> > On Mon, 2009-03-23 at 14:44 +0100, ext David Greaves wrote:
> >> Hi
> >>
> >> Crossposting as I think this is a maemo-dev question of interest to Qt devs :)
> >>
> >> I am having a problem with my Qt applications and the osso window manager.
> >> Essentially the window manager is doing a sigkill which doesn't allow Qt to emit
> >> a closeEvent().
> >
> > You mean D-Bus daemon is killing you 20-30s after you are D-Bus
> > activated?
> No. I know about that one :)
>
> ah, and as I write this I see Antonio has solved it :) \o/
> But we still have issues....
>
> > Maybe looking at this example helps:
> > https://garage.maemo.org/svn/maemoexamples/tags/maemo_4.1/maemopad/
> Yes, used that - happy with osso_initialize()
>
> I actually would like to know what osso_initialize() should do so we can do the
> right things in a Qt app though.
>
> And your name appears a lot in the source Kimmo :)

The code is not that hard to follow, just take a look. (Btw. most of the
code/API was not written by me.) Basically it just connects to D-Bus
busses and allows further use of libosso functions to abstract some D-
Bus messaging/signals.

> >> Digging into libosso and libossowm/osso-rpc.c I find
> >>
> >> #define HILDON_DESKTOP_SERVICE "com.nokia.hildon-desktop"
> >> #define HDWM_STARTUP_NOTIFICATION_IFACE "com.nokia.hildon.hdwm.startupnotification"
> >> #define HDWM_OBJECT_PATH "/com/nokia/hildon/hdwm"
> >> #define HDWM_STARTUP_NOTIFICATION_STARTING "starting"
> >
> > You don't need this. It's just for the "Loading..." banner in Diablo.
> OK - but do you have a list of things that we should do to make Qt equivalent to
> gtk?

Gtk does not use Libosso :)

> I seem to recall things like dbus messages on low memory and others. Are these
> documented?

Check osso-hw.c. Code is still in SVN (login: guest/guest):
https://stage.maemo.org/svn/maemo/projects/haf/trunk/libosso/src/

> The banner would be nice - but the dbus services listed above don't seem to be
> correct - and I can't find them using a dbus introspect (qdbusviewer)
> ie this bit (from original email)

We don't have that in Fremantle. We have a new service for starting
applications in hildon-desktop. You can learn these API things from
http://www7.connecting.nokia.com/nmp/osso/ossodm.nsf/WebAllByID2/DSD07052-EN
(currently in Nokia intranet only)

> >> Message:Method "starting" with signature "" on interface
> >> "com.nokia.hildon.hdwm.startupnotification" doesn't exist
> >>
> >> I installed qdbusmonitor and "com.nokia.hildon-desktop" doesn't provide
> >> hdwm.startupnotification or starting
> >>
> >> Nor do I see it on the dbus-monitor --session when my gtk app runs.
>
> Are you in a postion to help us write the Qt equivalent of osso_initialize() and
> help make Qt == Gtk

As I said, Hildon widgets and Gtk do not use libosso at all (it would be
quite ugly since libosso depends on D-Bus connections).

BR; Kimmo

>
> David
>
  •  Reply

Re: osso, muali , dbus and Qt closeEvent()s

David Greaves
Karma: 715
2009-03-25 16:16 UTC
Kimmo Hämäläinen wrote:
> Haloo!
Hi

> The code is not that hard to follow, just take a look. (Btw. most of the
> code/API was not written by me.) Basically it just connects to D-Bus
> busses and allows further use of libosso functions to abstract some D-
> Bus messaging/signals.
OK. Searching for dbus interfaces etc will probably help here.

>> OK - but do you have a list of things that we should do to make Qt equivalent to
>> gtk?
>
> Gtk does not use Libosso :)

I meant gtk apps need to use osso-initialize() or they just don't work.
Since libosso uses glib, I expect that's not really right for Qt apps.

In particular I think osso-init.c calls glib setups that seem to hook into the
glib context and I think the glib main loop - not used in Qt apps.

eg line 503 in osso-init.c calls dbus_connection_setup_with_g_main()
which:
"Sets the watch and timeout functions of a DBusConnection to integrate the
connection with the GLib main loop. "
see:
http://dbus.freedesktop.org/doc/api/html/group__DBusGLib.html#ga754eed235cc2b8153bd8f824b687d9e


so libosso, as it stands, isn't suitable for Qt apps .... unless I'm confused :)

>> I seem to recall things like dbus messages on low memory and others. Are these
>> documented?
>
> Check osso-hw.c. Code is still in SVN (login: guest/guest):
> https://stage.maemo.org/svn/maemo/projects/haf/trunk/libosso/src/

Good pointer... yep, things like:
com.nokia.dsme.signal shutdown_ind and save_unsaved_data_ind

We don't want Qt apps ignoring these do we?

>> The banner would be nice - but the dbus services listed above don't seem to be
>> correct - and I can't find them using a dbus introspect (qdbusviewer)
>> ie this bit (from original email)
>
> We don't have that in Fremantle.
Currently I'm looking at Diablo...

> We have a new service for starting
> applications in hildon-desktop. You can learn these API things from
> http://www7.connecting.nokia.com/nmp/osso/ossodm.nsf/WebAllByID2/DSD07052-EN
> (currently in Nokia intranet only)
Ah, I don't have that - can you post it?

> As I said, Hildon widgets and Gtk do not use libosso at all (it would be
> quite ugly since libosso depends on D-Bus connections).

agreed - I am not sure how best to proceed with Qt - one of the trolls (I think)
suggested extending QSession.


David

--
"Don't worry, you'll be fine; I saw it work in a cartoon once..."
  •  Reply

Re: osso, muali , dbus and Qt closeEvent()s

Santtu Lakkala
Karma: 156
2009-03-25 19:12 UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David Greaves wrote:
> I meant gtk apps need to use osso-initialize() or they just don't work.
> Since libosso uses glib, I expect that's not really right for Qt apps.
>
> In particular I think osso-init.c calls glib setups that seem to hook into the
> glib context and I think the glib main loop - not used in Qt apps.
>
> eg line 503 in osso-init.c calls dbus_connection_setup_with_g_main()
> which:
> "Sets the watch and timeout functions of a DBusConnection to integrate the
> connection with the GLib main loop. "
> see:
> http://dbus.freedesktop.org/doc/api/html/group__DBusGLib.html#ga754eed235cc2b8153bd8f824b687d9e
>
>
> so libosso, as it stands, isn't suitable for Qt apps .... unless I'm confused :)


Actually Qt has supported GLib context stuff since 4.2 (IIRC), so
libosso is suitable. That doesn't say that it's practical or nice, but
it should work.

- --
Santtu
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAknKghEACgkQX9Rc0+po4p3zUQCgmZLaGy3jTDm3YuCbkuh7OZE4
2J4An3avfLa5Elu8eo94IbW1srViA8aw
=ozXP
-----END PGP SIGNATURE-----
  •  Reply

Re: osso, muali , dbus and Qt closeEvent()s

Antonio Aloisio
Karma: 261
2009-03-25 20:39 UTC
Hi,
IMHO using the Qt D-Bus API to rewrite some parts of libosso is more
easy that resolve the symobls, load and use libosso in Qt.
Kimmo said adding D-Bus dependencies in the widget is ugly, I agree
with him.. but... is this also true for the QStatusBar?

In Qt we have a statusBar that manages and displays messages.
Currently this status bar is hidden just because we don't have it in
Hildon. I don't compiled out in order to preserve
the compatibility with the Qt Desktop application.

Adding D-Bus into the status bar, we can display messages using hildon
passive notification dialogs just calling

void QStatusBar::showMessage ( const QString & message, int timeout = 0 ).

Is it cool? Any comment is welcome.

Cheers,
Antonio

On Wed, Mar 25, 2009 at 9:12 PM, Santtu Lakkala <inz@inz.fi> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> David Greaves wrote:
> > I meant gtk apps need to use osso-initialize() or they just don't work.
> > Since libosso uses glib, I expect that's not really right for Qt apps.
> >
> > In particular I think osso-init.c calls glib setups that seem to hook into the
> > glib context and I think the glib main loop - not used in Qt apps.
> >
> > eg line 503 in osso-init.c calls dbus_connection_setup_with_g_main()
> > which:
> > "Sets the watch and timeout functions of a DBusConnection to integrate the
> > connection with the GLib main loop. "
> > see:
> > http://dbus.freedesktop.org/doc/api/html/group__DBusGLib.html#ga754eed235cc2b8153bd8f824b687d9e
> >
> >
> > so libosso, as it stands, isn't suitable for Qt apps .... unless I'm confused :)
>
>
> Actually Qt has supported GLib context stuff since 4.2 (IIRC), so
> libosso is suitable. That doesn't say that it's practical or nice, but
> it should work.
>
> - --
> Santtu
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAknKghEACgkQX9Rc0+po4p3zUQCgmZLaGy3jTDm3YuCbkuh7OZE4
> 2J4An3avfLa5Elu8eo94IbW1srViA8aw
> =ozXP
> -----END PGP SIGNATURE-----



--

Isaac Asimov  - "I do not fear computers. I fear the lack of them."
  •  Reply

Re: osso, muali , dbus and Qt closeEvent()s

David Greaves
Karma: 715
2009-03-25 22:04 UTC
It seems to me that the hildon 'platform' uses dbus and if we have some widgets
that are designed to interact with the platform environment (like notifiers or
session) then, when built for that platform, they can depend on platform
specific things.

so yes, I thing showMessage should use dbus for WS_HILDON

David


Antonio Aloisio wrote:
> Hi,
> IMHO using the Qt D-Bus API to rewrite some parts of libosso is more
> easy that resolve the symobls, load and use libosso in Qt.
> Kimmo said adding D-Bus dependencies in the widget is ugly, I agree
> with him.. but... is this also true for the QStatusBar?
>
> In Qt we have a statusBar that manages and displays messages.
> Currently this status bar is hidden just because we don't have it in
> Hildon. I don't compiled out in order to preserve
> the compatibility with the Qt Desktop application.
>
> Adding D-Bus into the status bar, we can display messages using hildon
> passive notification dialogs just calling
>
> void QStatusBar::showMessage ( const QString & message, int timeout = 0 ).
>
> Is it cool? Any comment is welcome.
>
> Cheers,
> Antonio
>
> On Wed, Mar 25, 2009 at 9:12 PM, Santtu Lakkala <inz@inz.fi> wrote:
> David Greaves wrote:
>>>> I meant gtk apps need to use osso-initialize() or they just don't work.
>>>> Since libosso uses glib, I expect that's not really right for Qt apps.
>>>>
>>>> In particular I think osso-init.c calls glib setups that seem to hook into the
>>>> glib context and I think the glib main loop - not used in Qt apps.
>>>>
>>>> eg line 503 in osso-init.c calls dbus_connection_setup_with_g_main()
>>>> which:
>>>> "Sets the watch and timeout functions of a DBusConnection to integrate the
>>>> connection with the GLib main loop. "
>>>> see:
>>>> http://dbus.freedesktop.org/doc/api/html/group__DBusGLib.html#ga754eed235cc2b8153bd8f824b687d9e
>>>>
>>>>
>>>> so libosso, as it stands, isn't suitable for Qt apps .... unless I'm confused :)
>
> Actually Qt has supported GLib context stuff since 4.2 (IIRC), so
> libosso is suitable. That doesn't say that it's practical or nice, but
> it should work.
>

> --

> Isaac Asimov - "I do not fear computers. I fear the lack of them."


--
"Don't worry, you'll be fine; I saw it work in a cartoon once..."
  •  Reply