[maemo-commits] [maemo-commits] r8758 - in projects/haf/branches/maemo-af-desktop/hildon-desktop: . libhildondesktop libhildonwm
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Thu Dec 14 17:31:19 EET 2006
- Previous message: [maemo-commits] r8757 - projects/haf/hafbuildbot
- Next message: [maemo-commits] r8759 - in projects/haf/branches/maemo-af-desktop/hildon-desktop: . libhildondesktop src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: moimart
Date: 2006-12-14 17:31:18 +0200 (Thu, 14 Dec 2006)
New Revision: 8758
Modified:
projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog
projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hn-app-switcher.c
projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm.c
Log:
* libhildondesktop/hn-app-switcher.c:
- Removed MCE handler.
* libhildonwm/hd-wm.c:
- Moved MCE handler to window management code.
* ChangeLog updated.
Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog 2006-12-14 13:41:14 UTC (rev 8757)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog 2006-12-14 15:31:18 UTC (rev 8758)
@@ -1,3 +1,10 @@
+2006-12-14 Moises Martinez <moises.martinez at nokia.com>
+
+ * libhildondesktop/hn-app-switcher.c:
+ - Removed MCE handler.
+ * libhildonwm/hd-wm.c:
+ - Moved MCE handler to window management code.
+
2006-12-13 Moises Martinez <moises.martinez at nokia.com>
* libhildondesktop/hn-app-switcher.c: Using the hd_keys_'s API
Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hn-app-switcher.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hn-app-switcher.c 2006-12-14 13:41:14 UTC (rev 8757)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hn-app-switcher.c 2006-12-14 15:31:18 UTC (rev 8758)
@@ -130,15 +130,6 @@
#define AS_INTERNAL_PADDING 10
#define AS_SEPARATOR_HEIGHT 10
-/* Needed for catching the MCE D-BUS messages */
-#define MCE_SERVICE "com.nokia.mce"
-#define MCE_SIGNAL_INTERFACE "com.nokia.mce.signal"
-#define MCE_SIGNAL_PATH "/com/nokia/mce/signal"
-
-/* hardware signals */
-#define HOME_LONG_PRESS "sig_home_key_pressed_long_ind"
-#define HOME_PRESS "sig_home_key_pressed_ind"
-
/* lowmem signals */
#define LOWMEM_ON_SIGNAL_INTERFACE "com.nokia.ke_recv.lowmem_on"
#define LOWMEM_ON_SIGNAL_PATH "/com/nokia/ke_recv/lowmem_on"
@@ -297,87 +288,6 @@
static guint app_switcher_signals[LAST_SIGNAL] = { 0 };
-/* MCE signals handler: listens to HOME events */
-static DBusHandlerResult
-mce_handler (DBusConnection *conn,
- DBusMessage *msg,
- void *data)
-{
- HNAppSwitcher *app_switcher = HN_APP_SWITCHER (data);
- HNAppSwitcherPrivate *priv = app_switcher->priv;
- const gchar *member;
-
- if (dbus_message_get_type (msg) != DBUS_MESSAGE_TYPE_SIGNAL)
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-
- member = dbus_message_get_member (msg);
- if (!member || member[0] == '\0')
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-
- if (strcmp (HOME_LONG_PRESS, member) == 0 && !hd_wm_modal_windows_present())
- {
- if (GTK_WIDGET_IS_SENSITIVE (priv->main_button))
- {
- GtkToggleButton *button;
- gboolean is_active;
-
- /* if the AS menu is up, close it first */
- button = GTK_TOGGLE_BUTTON (priv->main_button);
- is_active = gtk_toggle_button_get_active (button);
-
- if (is_active)
- {
- gtk_toggle_button_set_active (button, FALSE);
- gtk_toggle_button_toggled (button);
- }
-
- hd_wm_toggle_desktop ();
- }
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-
- if (strcmp (HOME_PRESS, member) == 0 && !hd_wm_modal_windows_present())
- {
- if (GTK_WIDGET_IS_SENSITIVE (priv->main_button))
- {
- GtkToggleButton *button;
- gboolean is_active;
-
- button = GTK_TOGGLE_BUTTON (priv->main_button);
-
- is_active = gtk_toggle_button_get_active (button);
- is_active = !is_active;
- gtk_toggle_button_set_active (button, is_active);
- gtk_toggle_button_toggled (button);
-
- if (is_active != ((priv->main_menu) && GTK_WIDGET_VISIBLE (priv->main_menu)))
- {
- /* XXX */
- /* Something went wrong. Most probably a menu
- * is opened, send a fake ESC key event to attempt
- * to close it
- */
-
- /* moimart */
- /* Whenever we have to send a fake key we can have side
- * effects. We must get rid of it sooner or later */
-
- HDWM *wm = hd_wm_get_singleton ();
-
- hd_keys_send_key_by_keysym (wm->keys,XK_Escape);
-
- /* Try again */
- gtk_toggle_button_toggled (button);
- }
- }
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
/* LOWMEM signals handler: listen to LOWMEM_ON and LOWMEM_OFF events,
* and relays them through the HNAppSwitcher "lowmem" signal.
*/
@@ -1238,7 +1148,7 @@
{
HNAppSwitcherPrivate *priv = app_switcher->priv;
DBusConnection *conn = NULL;
- DBusObjectPathVTable mce_vtable, lowmem_vtable, bgkill_vtable;
+ DBusObjectPathVTable lowmem_vtable, bgkill_vtable;
gboolean res;
osso_hw_state_t hs = {0};
@@ -1266,22 +1176,9 @@
return;
}
- mce_vtable.message_function = mce_handler;
- mce_vtable.unregister_function = NULL;
#define MAKE_SIGNAL_RULE(_iface) "type=\'signal\', interface=\'" _iface "\'"
- res = dbus_connection_register_object_path (conn, MCE_SIGNAL_PATH,
- &mce_vtable,
- app_switcher);
- if (res)
- {
- dbus_bus_add_match (conn, MAKE_SIGNAL_RULE (MCE_SIGNAL_INTERFACE), NULL);
- dbus_connection_flush (conn);
- }
- else
- osso_log (LOG_ERR, "Failed registering MCE handler");
-
lowmem_vtable.message_function = lowmem_handler;
lowmem_vtable.unregister_function = NULL;
Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm.c 2006-12-14 13:41:14 UTC (rev 8757)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm.c 2006-12-14 15:31:18 UTC (rev 8758)
@@ -60,6 +60,12 @@
#define TASKNAV_SERVICE_NAME "com.nokia.tasknav"
#define TASKNAV_INSENSITIVE_INTERFACE "com.nokia.tasknav.tasknav_insensitive"
#define TASKNAV_SENSITIVE_INTERFACE "com.nokia.tasknav.tasknav_sensitive"
+#define MCE_SERVICE "com.nokia.mce"
+#define MCE_SIGNAL_INTERFACE "com.nokia.mce.signal"
+#define MCE_SIGNAL_PATH "/com/nokia/mce/signal"
+/* hardware signals */
+#define HOME_LONG_PRESS "sig_home_key_pressed_long_ind"
+#define HOME_PRESS "sig_home_key_pressed_ind"
#define LAUNCH_SUCCESS_TIMEOUT 20
@@ -404,15 +410,15 @@
}
static DBusHandlerResult
-hd_wm_dbus_signal_handler(DBusConnection *conn, DBusMessage *msg, void *data)
+hd_wm_dbus_signal_handler (DBusConnection *conn, DBusMessage *msg, void *data)
{
if (dbus_message_is_signal(msg, MAEMO_LAUNCHER_SIGNAL_IFACE,
APP_DIED_SIGNAL_NAME))
{
DBusError err;
gchar *filename;
- int pid;
- int status;
+ gint pid;
+ gint status;
HDWMWatchableApp *app;
@@ -454,6 +460,39 @@
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
+static DBusHandlerResult
+mce_handler (DBusConnection *conn,
+ DBusMessage *msg,
+ void *data)
+{
+ const gchar *member;
+
+ g_debug ("processing MCE");
+
+ if (dbus_message_get_type (msg) != DBUS_MESSAGE_TYPE_SIGNAL)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ member = dbus_message_get_member (msg);
+ if (!member || member[0] == '\0')
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ if (strcmp (HOME_LONG_PRESS, member) == 0 && !hd_wm_modal_windows_present())
+ {
+ hd_wm_toggle_desktop ();
+
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+
+ if (strcmp (HOME_PRESS, member) == 0 && !hd_wm_modal_windows_present())
+ {
+ hd_wm_activate (HD_TN_ACTIVATE_MAIN_MENU);
+
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
static int
hd_wm_osso_kill_method (GArray *arguments, gpointer data)
{
@@ -573,11 +612,13 @@
static void
hd_wm_init (HDWM *hdwm)
{
- DBusConnection *connection;
- DBusError error;
+ DBusConnection *connection,*sys_connection;
+ DBusError error,sys_error;
gchar *match_rule = NULL;
GdkKeymap *keymap;
-
+ gboolean res;
+ DBusObjectPathVTable mce_vtable;
+
hdwm->priv = hdwmpriv = HD_WM_GET_PRIVATE (hdwm);
/*memset(&(hdwm->priv), 0, sizeof(HDWMPrivate));*/
@@ -667,51 +708,78 @@
/* Get on the DBus */
dbus_error_init (&error);
+ dbus_error_init (&sys_error);
- connection = dbus_bus_get (DBUS_BUS_SESSION, &error);
-
+ connection = dbus_bus_get (DBUS_BUS_SESSION, &error);
+ sys_connection = dbus_bus_get (DBUS_BUS_SYSTEM, &sys_error);
+
if (!connection)
{
- osso_log(LOG_ERR, "Failed to connect to DBUS: %s!\n", error.message );
+ g_debug ("Failed to connect to DBUS: %s!\n", error.message );
dbus_error_free( &error );
}
else
{
- /* Match rule */
+ match_rule = g_strdup_printf("interface='%s'", APP_LAUNCH_BANNER_METHOD_INTERFACE );
- match_rule = g_strdup_printf("interface='%s'",
- APP_LAUNCH_BANNER_METHOD_INTERFACE );
-
dbus_bus_add_match( connection, match_rule, NULL );
g_free (match_rule);
match_rule = g_strdup_printf("type='signal', interface='%s'",APPKILLER_SIGNAL_INTERFACE);
dbus_bus_add_match( connection, match_rule, NULL );
- dbus_connection_add_filter(connection, hd_wm_dbus_signal_handler, NULL, NULL);
+ dbus_connection_add_filter (connection, hd_wm_dbus_signal_handler, hdwm, NULL);
g_free(match_rule);
match_rule = g_strdup_printf("interface='%s'", TASKNAV_INSENSITIVE_INTERFACE );
- dbus_bus_add_match( connection, match_rule, NULL );
+ dbus_bus_add_match (connection, match_rule, NULL );
- dbus_connection_add_filter( connection, hd_wm_dbus_method_call_handler,/*model */ hdwm, NULL );
+ dbus_connection_add_filter (connection, hd_wm_dbus_method_call_handler, hdwm, NULL );
g_free(match_rule);
- /* Setup match rule for Maemo Launcher */
match_rule = g_strdup_printf("type='signal', interface='%s'", MAEMO_LAUNCHER_SIGNAL_IFACE);
- dbus_bus_add_match(connection, match_rule, NULL);
- dbus_connection_add_filter(connection, hd_wm_dbus_signal_handler,
- NULL, NULL);
+ dbus_bus_add_match (connection, match_rule, NULL);
+ dbus_connection_add_filter (connection, hd_wm_dbus_signal_handler, hdwm, NULL);
g_free(match_rule);
dbus_connection_flush(connection);
- /* Add the com.nokia.tasknav callbacks - FIXME: what are these for ? */
- add_method_cb(osso_man, KILL_APPS_METHOD, &hd_wm_osso_kill_method, osso_man);
+ /* Add the com.nokia.tasknav callbacks - FIXME: what are these for ? */
+ add_method_cb (osso_man, KILL_APPS_METHOD, &hd_wm_osso_kill_method, osso_man);
}
+
+ if (!sys_connection)
+ {
+ g_debug ("Failed to connect to DBUS: %s!\n", sys_error.message );
+ dbus_error_free( &sys_error );
+ }
+ else
+ {
+ mce_vtable.message_function = mce_handler;
+ mce_vtable.unregister_function = NULL;
+
+ match_rule = g_strdup_printf("type='signal', interface='%s'", MCE_SIGNAL_INTERFACE);
+
+ res = dbus_connection_register_object_path (sys_connection,
+ MCE_SIGNAL_PATH,
+ &mce_vtable,
+ hdwm);
+
+ if (res)
+ {
+ g_debug ("MCE Registered");
+ dbus_bus_add_match (sys_connection, match_rule, NULL);
+ }
+ else
+ g_debug ("I couldn't register MCE");
+
+ g_free(match_rule);
+
+ dbus_connection_flush(sys_connection);
+ }
}
void
- Previous message: [maemo-commits] r8757 - projects/haf/hafbuildbot
- Next message: [maemo-commits] r8759 - in projects/haf/branches/maemo-af-desktop/hildon-desktop: . libhildondesktop src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
