[maemo-developers] Rotation support.. :(
From: Aniello Del Sorbo anidel at gmail.comDate: Sat Nov 7 17:19:28 EET 2009
- Previous message: How about upgrading bandwidth for maemo.org?
- Next message: Rotation support.. :(
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I am trying to add rotation to Xournal.
I have defined the DBus message sig as follows:
#define MCE_SIGNAL_MATCH "type='signal'," \
"sender='" MCE_SERVICE "'," \
"path='" MCE_SIGNAL_PATH "'," \
"interface='" MCE_SIGNAL_IF "'"
then I've added a DBus filter and handler:
sys_conn = osso_get_sys_dbus_connection(ctx);
if (sys_conn) {
DBusError error;
dbus_error_init (&error);
dbus_bus_add_match (sys_conn, MCE_SIGNAL_MATCH, &error);
if (dbus_error_is_set(&error)){
printf("dbus_bus_add_match failed: %s\n", error.message);
dbus_error_free(&error);
}
if (!dbus_connection_add_filter (sys_conn,
(DBusHandleMessageFunction) mce_filter_func, NULL, NULL)) {
printf("Error dbus_connection_add_filter failed\n");
} else {
printf ("DBUS filter added\n");
}
}
and defined the handler function:
DBusHandlerResult
mce_filter_func (DBusConnection *connection, DBusMessage *message, void *data)
{
DBusMessageIter iter;
const gchar *mode = NULL;
printf ("MCE\n");
if (dbus_message_is_signal(message, MCE_SIGNAL_IF,
MCE_DEVICE_ORIENTATION_SIG)) {
printf ("is a orientation signal\n");
if (dbus_message_iter_init(message, &iter)) {
printf ("getting mode\n");
dbus_message_iter_get_basic(&iter, &mode);
hildon_rotate_ui (mode);
}
}
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
It compiles, starts up, the MCE function gets called twice when
Xournal starts (it prints MCE twice) and gets called for several other
DBus messages (like screen lock/unlock), but NOT for rotate messages.
What am I missing?
Thanks!
References:
[1] <http://wiki.maemo.org/Using_Fremantle_Widgets#Listening_To_Hardware_Orientation_Changes>
[2] <http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Porting_Software/Porting_Existing_GTK%2B_Application_to_Maemo_5#Portrait_Mode>
[3] <https://garage.maemo.org/plugins/scmsvn/viewcvs.php/trunk/omweather/src/weather-portrait.c?revision=2951&root=omweather&view=markup>
[4] <https://garage.maemo.org/plugins/scmsvn/viewcvs.php/trunk/omweather/src/weather-dbus.c?revision=3265&root=omweather&view=markup>
--
anidel
Sent from London, Eng, United Kingdom
- Previous message: How about upgrading bandwidth for maemo.org?
- Next message: Rotation support.. :(
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
