示例#1
0
static void
gdkevent_dispatcher (GdkEvent *event,
                     gpointer  data)
{
	GIOChannel *channel = data;

	switch (event->type) {
	case GDK_NOTHING:
		break;
	case GDK_DELETE:
		gdkevent_handle_any(event, channel);
		break;
	case GDK_DESTROY:
		gdkevent_handle_destroy(event, channel);
		break;
	case GDK_EXPOSE:
		gdkevent_handle_expose(event, channel);
		break;
	case GDK_MOTION_NOTIFY:
		gdkevent_handle_motion_notfiy(event, channel);
		break;
	case GDK_BUTTON_PRESS:
	case GDK_2BUTTON_PRESS:
	case GDK_3BUTTON_PRESS:
	case GDK_BUTTON_RELEASE:
		gdkevent_handle_button(event, channel);
		break;
	case GDK_KEY_PRESS:
	case GDK_KEY_RELEASE:
		gdkevent_handle_key(event, channel);
		break;
	case GDK_ENTER_NOTIFY:
	case GDK_LEAVE_NOTIFY:
		gdkevent_handle_crossing(event, channel);
		break;
	case GDK_FOCUS_CHANGE:
		gdkevent_handle_focus(event, channel);
		break;
	case GDK_CONFIGURE:
		gdkevent_handle_configure(event, channel);
		break;
	case GDK_MAP:
	case GDK_UNMAP:
		gdkevent_handle_any(event, channel);
		break;
	default:
		/*
		 * TODO: Handle more of these specificaly.
		 */
		gdkevent_handle_any(event, channel);
		break;
	}

	gtk_main_do_event(event);
}
示例#2
0
static void
gdkevent_dispatcher (GdkEvent *event,
                     gpointer  data)
{
	GDBusMessage *message;
	GError *error = NULL;

	message = g_dbus_message_new_method_call(NULL, "/",
	                                         "org.perfkit.Agent.GdkEvent",
	                                         "Event");

	switch (event->type) {
   case GDK_TOUCH_BEGIN:
   case GDK_TOUCH_END:
   case GDK_TOUCH_UPDATE:
   case GDK_TOUCH_CANCEL:
	case GDK_NOTHING:
		break;
	case GDK_DELETE:
		gdkevent_handle_any(event, connection);
		break;
	case GDK_DESTROY:
		gdkevent_handle_destroy(event, connection);
		break;
	case GDK_EXPOSE:
		gdkevent_handle_expose(event, message, connection);
		break;
	case GDK_MOTION_NOTIFY:
		gdkevent_handle_motion_notfiy(event, connection);
		break;
	case GDK_BUTTON_PRESS:
	case GDK_2BUTTON_PRESS:
	case GDK_3BUTTON_PRESS:
	case GDK_BUTTON_RELEASE:
		gdkevent_handle_button(event, connection);
		break;
	case GDK_KEY_PRESS:
	case GDK_KEY_RELEASE:
		gdkevent_handle_key(event, connection);
		break;
	case GDK_ENTER_NOTIFY:
	case GDK_LEAVE_NOTIFY:
		gdkevent_handle_crossing(event, connection);
		break;
	case GDK_FOCUS_CHANGE:
		gdkevent_handle_focus(event, connection);
		break;
	case GDK_CONFIGURE:
		gdkevent_handle_configure(event, connection);
		break;
	case GDK_MAP:
	case GDK_UNMAP:
		gdkevent_handle_any(event, connection);
		break;
	case GDK_PROPERTY_NOTIFY:
	case GDK_SELECTION_CLEAR:
	case GDK_SELECTION_REQUEST:
	case GDK_SELECTION_NOTIFY:
	case GDK_PROXIMITY_IN:
	case GDK_PROXIMITY_OUT:
	case GDK_DRAG_ENTER:
	case GDK_DRAG_LEAVE:
	case GDK_DRAG_MOTION:
	case GDK_DRAG_STATUS:
	case GDK_DROP_START:
	case GDK_DROP_FINISHED:
	case GDK_CLIENT_EVENT:
	case GDK_VISIBILITY_NOTIFY:
#if !GTK_CHECK_VERSION(2, 91, 0)
	case GDK_NO_EXPOSE:
#endif
	case GDK_SCROLL:
	case GDK_WINDOW_STATE:
	case GDK_SETTING:
	case GDK_OWNER_CHANGE:
	case GDK_GRAB_BROKEN:
	case GDK_DAMAGE:
	case GDK_EVENT_LAST:
	default:
		/*
		 * TODO: Handle more of these specificaly.
		 */
		gdkevent_handle_any(event, connection);
		break;
	}

	if (!g_dbus_connection_send_message(connection, message,
	                                    G_DBUS_SEND_MESSAGE_FLAGS_NONE,
	                                    NULL, &error)) {
		CRITICAL(Gdk, "Error sending message: %s", error->message);
		g_error_free(error);
	}

	gtk_main_do_event(event);
}