diff options
-rw-r--r-- | libdbusmenu-glib/client.c | 6 | ||||
-rw-r--r-- | libdbusmenu-glib/dbus-menu.xml | 4 | ||||
-rw-r--r-- | libdbusmenu-glib/menuitem-marshal.list | 1 | ||||
-rw-r--r-- | libdbusmenu-glib/menuitem.c | 10 | ||||
-rw-r--r-- | libdbusmenu-glib/menuitem.h | 4 | ||||
-rw-r--r-- | libdbusmenu-glib/server.c | 22 | ||||
-rw-r--r-- | libdbusmenu-glib/server.h | 7 | ||||
-rw-r--r-- | libdbusmenu-gtk/client.c | 2 | ||||
-rw-r--r-- | tests/test-gtk-label-server.c | 4 |
9 files changed, 33 insertions, 27 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index c4e9860..720c8e2 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -499,8 +499,8 @@ build_proxies (DbusmenuClient * client) } dbus_g_object_register_marshaller(_dbusmenu_server_marshal_VOID__INT_UINT, G_TYPE_NONE, G_TYPE_INT, G_TYPE_UINT, G_TYPE_INVALID); - dbus_g_proxy_add_signal(priv->menuproxy, "LayoutUpdate", G_TYPE_INT, G_TYPE_UINT, G_TYPE_INVALID); - dbus_g_proxy_connect_signal(priv->menuproxy, "LayoutUpdate", G_CALLBACK(layout_update), client, NULL); + dbus_g_proxy_add_signal(priv->menuproxy, "LayoutUpdated", G_TYPE_INT, G_TYPE_UINT, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(priv->menuproxy, "LayoutUpdated", G_CALLBACK(layout_update), client, NULL); dbus_g_object_register_marshaller(_dbusmenu_server_marshal_VOID__UINT_STRING_POINTER, G_TYPE_NONE, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID); dbus_g_proxy_add_signal(priv->menuproxy, "ItemPropertyUpdated", G_TYPE_UINT, G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID); @@ -633,7 +633,7 @@ menuitem_activate (DbusmenuMenuitem * mi, DbusmenuClient * client) GValue value = {0}; g_value_init(&value, G_TYPE_INT); g_value_set_int(&value, 0); - org_ayatana_dbusmenu_event_async (priv->menuproxy, dbusmenu_menuitem_get_id(mi), "clicked", &value, menuitem_call_cb, mi); + org_ayatana_dbusmenu_event_async (priv->menuproxy, dbusmenu_menuitem_get_id(mi), "clicked", &value, 0, menuitem_call_cb, mi); return; } diff --git a/libdbusmenu-glib/dbus-menu.xml b/libdbusmenu-glib/dbus-menu.xml index a7cceaa..866969e 100644 --- a/libdbusmenu-glib/dbus-menu.xml +++ b/libdbusmenu-glib/dbus-menu.xml @@ -141,6 +141,7 @@ menu item. @param id the id of the item which received the event @param type the type of event @param data event-specific data +@param timestamp The time that the event occured if available or the time the message was sent if not. @a type can be one of the following: @@ -153,6 +154,7 @@ Vendor specific events can be added by prefixing them with "x-<vendor>-" <arg type="u" name="id" direction="in" /> <arg type="s" name="eventId" direction="in" /> <arg type="v" name="data" direction="in" /> + <arg type="u" name="timestamp" direction="in" /> </method> <!-- Signals --> @@ -182,7 +184,7 @@ revision item for the entries that have changed. It is zero if the whole layout should be considered invalid. --> - <signal name="LayoutUpdate"> + <signal name="LayoutUpdated"> <arg type="i" name="revision" direction="out" /> <arg type="u" name="parent" direction="out" /> </signal> diff --git a/libdbusmenu-glib/menuitem-marshal.list b/libdbusmenu-glib/menuitem-marshal.list index dc4ba53..654c91b 100644 --- a/libdbusmenu-glib/menuitem-marshal.list +++ b/libdbusmenu-glib/menuitem-marshal.list @@ -3,3 +3,4 @@ VOID: OBJECT, UINT, UINT VOID: OBJECT, UINT VOID: OBJECT VOID: VOID +VOID: UINT diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 0dcbade..06d6200 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -127,6 +127,7 @@ dbusmenu_menuitem_class_init (DbusmenuMenuitemClass *klass) /** DbusmenuMenuitem::item-activated: @arg0: The #DbusmenuMenuitem object. + @arg1: The timestamp of when it was activated Emitted on the objects on the server side when they are signaled on the client side. @@ -136,8 +137,8 @@ dbusmenu_menuitem_class_init (DbusmenuMenuitemClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(DbusmenuMenuitemClass, item_activated), NULL, NULL, - _dbusmenu_menuitem_marshal_VOID__VOID, - G_TYPE_NONE, 0, G_TYPE_NONE); + _dbusmenu_menuitem_marshal_VOID__UINT, + G_TYPE_NONE, 1, G_TYPE_UINT, G_TYPE_NONE); /** DbusmenuMenuitem::child-added: @arg0: The #DbusmenuMenuitem which is the parent. @@ -1117,18 +1118,19 @@ dbusmenu_menuitem_foreach (DbusmenuMenuitem * mi, void (*func) (DbusmenuMenuitem /** dbusmenu_menuitem_activate: @mi: The #DbusmenuMenuitem to send the signal on. + @timestamp: The timestamp of when the event happened Emits the #DbusmenuMenuitem::item-activate signal on this menu item. Called by server objects when they get the appropriate DBus signals from the client. */ void -dbusmenu_menuitem_activate (DbusmenuMenuitem * mi) +dbusmenu_menuitem_activate (DbusmenuMenuitem * mi, guint timestamp) { g_return_if_fail(DBUSMENU_IS_MENUITEM(mi)); #ifdef MASSIVEDEBUGGING g_debug("Menuitem %d (%s) activated", ID(mi), LABEL(mi)); #endif - g_signal_emit(G_OBJECT(mi), signals[ITEM_ACTIVATED], 0, TRUE); + g_signal_emit(G_OBJECT(mi), signals[ITEM_ACTIVATED], 0, timestamp, TRUE); return; } diff --git a/libdbusmenu-glib/menuitem.h b/libdbusmenu-glib/menuitem.h index aaafe17..238b7d9 100644 --- a/libdbusmenu-glib/menuitem.h +++ b/libdbusmenu-glib/menuitem.h @@ -104,7 +104,7 @@ struct _DbusmenuMenuitemClass /* Signals */ void (*property_changed) (gchar * property, GValue * value); - void (*item_activated) (void); + void (*item_activated) (guint timestamp); void (*child_added) (DbusmenuMenuitem * child, guint position); void (*child_removed) (DbusmenuMenuitem * child); void (*child_moved) (DbusmenuMenuitem * child, guint newpos, guint oldpos); @@ -153,7 +153,7 @@ void dbusmenu_menuitem_set_root (DbusmenuMenuitem * mi, gboolean root); gboolean dbusmenu_menuitem_get_root (DbusmenuMenuitem * mi); void dbusmenu_menuitem_foreach (DbusmenuMenuitem * mi, void (*func) (DbusmenuMenuitem * mi, gpointer data), gpointer data); -void dbusmenu_menuitem_activate (DbusmenuMenuitem * mi); +void dbusmenu_menuitem_activate (DbusmenuMenuitem * mi, guint timestamp); /** SECTION:menuitem diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 2c040a0..afcbfd3 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -39,7 +39,7 @@ static gboolean _dbusmenu_server_get_layout (DbusmenuServer * server, guint pare static gboolean _dbusmenu_server_get_property (DbusmenuServer * server, guint id, gchar * property, gchar ** value, GError ** error); static gboolean _dbusmenu_server_get_properties (DbusmenuServer * server, guint id, GPtrArray * properties, GHashTable ** dict, GError ** error); static gboolean _dbusmenu_server_get_group_properties (DbusmenuServer * server, GArray * ids, GArray * properties, GHashTable ** values, GError ** error); -static gboolean _dbusmenu_server_event (DbusmenuServer * server, guint id, gchar * eventid, GValue * data, GError ** error); +static gboolean _dbusmenu_server_event (DbusmenuServer * server, guint id, gchar * eventid, GValue * data, guint timestamp, GError ** error); static gboolean _dbusmenu_server_get_children (DbusmenuServer * server, guint id, GPtrArray * properties, GPtrArray ** output, GError ** error); #include "dbusmenu-server.h" @@ -63,7 +63,7 @@ struct _DbusmenuServerPrivate enum { ID_PROP_UPDATE, ID_UPDATE, - LAYOUT_UPDATE, + LAYOUT_UPDATED, LAST_SIGNAL }; @@ -148,7 +148,7 @@ dbusmenu_server_class_init (DbusmenuServerClass *class) g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT); /** - DbusmenuServer::layout-update: + DbusmenuServer::layout-updated: @arg0: The #DbusmenuServer emitting the signal. @arg1: A revision number representing which revision the update represents itself as. @@ -157,10 +157,10 @@ dbusmenu_server_class_init (DbusmenuServerClass *class) This signal is emitted any time the layout of the menuitems under this server is changed. */ - signals[LAYOUT_UPDATE] = g_signal_new(DBUSMENU_SERVER_SIGNAL_LAYOUT_UPDATE, + signals[LAYOUT_UPDATED] = g_signal_new(DBUSMENU_SERVER_SIGNAL_LAYOUT_UPDATED, G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET(DbusmenuServerClass, layout_update), + G_STRUCT_OFFSET(DbusmenuServerClass, layout_updated), NULL, NULL, _dbusmenu_server_marshal_VOID__INT_UINT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_UINT); @@ -248,7 +248,7 @@ set_property (GObject * obj, guint id, const GValue * value, GParamSpec * pspec) g_debug("Setting root node to NULL"); } priv->layout_revision++; - g_signal_emit(obj, signals[LAYOUT_UPDATE], 0, priv->layout_revision, 0, TRUE); + g_signal_emit(obj, signals[LAYOUT_UPDATED], 0, priv->layout_revision, 0, TRUE); break; default: g_return_if_reached(); @@ -306,7 +306,7 @@ menuitem_child_added (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint /* TODO: We probably need to group the layout update signals to make the number more reasonble. */ DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); priv->layout_revision++; - g_signal_emit(G_OBJECT(server), signals[LAYOUT_UPDATE], 0, priv->layout_revision, 0, TRUE); + g_signal_emit(G_OBJECT(server), signals[LAYOUT_UPDATED], 0, priv->layout_revision, 0, TRUE); return; } @@ -317,7 +317,7 @@ menuitem_child_removed (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, Dbu /* TODO: We probably need to group the layout update signals to make the number more reasonble. */ DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); priv->layout_revision++; - g_signal_emit(G_OBJECT(server), signals[LAYOUT_UPDATE], 0, priv->layout_revision, 0, TRUE); + g_signal_emit(G_OBJECT(server), signals[LAYOUT_UPDATED], 0, priv->layout_revision, 0, TRUE); return; } @@ -326,7 +326,7 @@ menuitem_child_moved (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint { DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); priv->layout_revision++; - g_signal_emit(G_OBJECT(server), signals[LAYOUT_UPDATE], 0, priv->layout_revision, 0, TRUE); + g_signal_emit(G_OBJECT(server), signals[LAYOUT_UPDATED], 0, priv->layout_revision, 0, TRUE); return; } @@ -537,7 +537,7 @@ _dbusmenu_server_get_children (DbusmenuServer * server, guint id, GPtrArray * pr } static gboolean -_dbusmenu_server_event (DbusmenuServer * server, guint id, gchar * eventid, GValue * data, GError ** error) +_dbusmenu_server_event (DbusmenuServer * server, guint id, gchar * eventid, GValue * data, guint timestamp, GError ** error) { DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, id); @@ -553,7 +553,7 @@ _dbusmenu_server_event (DbusmenuServer * server, guint id, gchar * eventid, GVal return FALSE; } - dbusmenu_menuitem_activate(mi); + dbusmenu_menuitem_activate(mi, timestamp); return TRUE; } diff --git a/libdbusmenu-glib/server.h b/libdbusmenu-glib/server.h index 566b3cf..e4d6dc7 100644 --- a/libdbusmenu-glib/server.h +++ b/libdbusmenu-glib/server.h @@ -45,7 +45,8 @@ G_BEGIN_DECLS #define DBUSMENU_SERVER_SIGNAL_ID_PROP_UPDATE "item-property-updated" #define DBUSMENU_SERVER_SIGNAL_ID_UPDATE "item-updated" -#define DBUSMENU_SERVER_SIGNAL_LAYOUT_UPDATE "layout-update" +#define DBUSMENU_SERVER_SIGNAL_LAYOUT_UPDATED "layout-updated" +#define DBUSMENU_SERVER_SIGNAL_LAYOUT_UPDATE DBUSMENU_SERVER_SIGNAL_LAYOUT_UPDATED #define DBUSMENU_SERVER_PROP_DBUS_OBJECT "dbus-object" #define DBUSMENU_SERVER_PROP_ROOT_NODE "root-node" @@ -56,7 +57,7 @@ G_BEGIN_DECLS @parent_class: #GObjectClass @id_prop_update: Slot for #DbusmenuServer::id-prop-update. @id_update: Slot for #DbusmenuServer::id-update. - @layout_update: Slot for #DbusmenuServer::layout-update. + @layout_updated: Slot for #DbusmenuServer::layout-update. @dbusmenu_server_reserved1: Reserved for future use. @dbusmenu_server_reserved2: Reserved for future use. @dbusmenu_server_reserved3: Reserved for future use. @@ -71,7 +72,7 @@ struct _DbusmenuServerClass { /* Signals */ void (*id_prop_update)(guint id, gchar * property, gchar * value); void (*id_update)(guint id); - void (*layout_update)(gint revision); + void (*layout_updated)(gint revision); /* Reserved */ void (*dbusmenu_server_reserved1)(void); diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 5146981..20e5523 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -109,7 +109,7 @@ static const gchar * data_menu = "dbusmenugtk-data-gtkmenu"; static gboolean menu_pressed_cb (GtkMenuItem * gmi, DbusmenuMenuitem * mi) { - dbusmenu_menuitem_activate(mi); + dbusmenu_menuitem_activate(mi, gtk_get_current_event_time()); return TRUE; } diff --git a/tests/test-gtk-label-server.c b/tests/test-gtk-label-server.c index c4d41ee..ae772f1 100644 --- a/tests/test-gtk-label-server.c +++ b/tests/test-gtk-label-server.c @@ -32,9 +32,9 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <json-glib/json-glib.h> static void -menuitem_click(DbusmenuMenuitem * mi, gpointer user_data) +menuitem_click(DbusmenuMenuitem * mi, guint32 time, gpointer user_data) { - g_debug("Clicked on: %d", dbusmenu_menuitem_get_id(mi)); + g_debug("Clicked on: %d @ %d", dbusmenu_menuitem_get_id(mi), time); return; } |