commit libgaminggear for openSUSE:Factory
Hello community,
here is the log from the commit of package libgaminggear for openSUSE:Factory checked in at 2014-09-29 12:40:36
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libgaminggear (Old)
and /work/SRC/openSUSE:Factory/.libgaminggear.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libgaminggear"
Changes:
--------
--- /work/SRC/openSUSE:Factory/libgaminggear/libgaminggear.changes 2014-07-11 20:06:10.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.libgaminggear.new/libgaminggear.changes 2014-09-29 12:40:38.000000000 +0200
@@ -1,0 +2,18 @@
+Sun Sep 28 16:15:12 UTC 2014 - sfalken@opensuse.org
+
+- Removed %defines for minor and microversion, as they really aren't needed.
+
+-------------------------------------------------------------------
+Sat Sep 27 17:38:00 UTC 2014 - sfalken@opensuse.org
+
+- Update to version 0.5.0
+ * Improved: GaminggearDevice
+ * Fixed: Canberra notifications are failsafe now
+- Added:
+ * libgaminggear-0.5.0.tar.bz2
+ * 0001-fix_libgaminggearwidget_libs.patch
+ + Patch adds dependecy libraries to libgaminggearwidget/CMakeLists.txt
+- Removed:
+ * libgaminggear-0.4.0.tar.bz2
+
+-------------------------------------------------------------------
Old:
----
libgaminggear-0.4.0.tar.bz2
New:
----
0001-fix_libgaminggearwidget_libs.patch
libgaminggear-0.5.0.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libgaminggear.spec ++++++
--- /var/tmp/diff_new_pack.52GoNj/_old 2014-09-29 12:40:39.000000000 +0200
+++ /var/tmp/diff_new_pack.52GoNj/_new 2014-09-29 12:40:39.000000000 +0200
@@ -17,16 +17,16 @@
%define majorversion 0
-%define minorversion 4
-%define microversion 0
Name: libgaminggear
-Version: %{majorversion}.%{minorversion}.%{microversion}
+Version: 0.5.0
Release: 0
Summary: Library for gaming input devices
License: GPL-2.0 and CC-BY-3.0
Group: Development/Libraries/C and C++
Url: https://sourceforge.net/projects/libgaminggear/
-Source: http://downloads.sourceforge.net/libgaminggear/%{name}-%{version}.tar.bz2
+Source: http://downloads.sourceforge.net/project/%{name}/%{name}-%{version}.tar.bz2
+# PATCH-FIX-UPSTREAM 0001-fix_libgaminggearwidget_libs.patch sfalken@opensuse.org -- Adds library dependencies to libgaminggearwidget, so it will build properly (sf#/p/libgaminggear/patches/1/)
+Patch0: 0001-fix_libgaminggearwidget_libs.patch
BuildRequires: cmake >= 2.6.4
BuildRequires: doxygen
BuildRequires: fdupes
@@ -55,6 +55,7 @@
%prep
%setup -q
+%patch0 -p1
%build
%cmake
++++++ 0001-fix_libgaminggearwidget_libs.patch ++++++
Index: libgaminggear-0.5.0/libgaminggearwidget/CMakeLists.txt
===================================================================
--- libgaminggear-0.5.0.orig/libgaminggearwidget/CMakeLists.txt
+++ libgaminggear-0.5.0/libgaminggearwidget/CMakeLists.txt
@@ -41,7 +41,13 @@ ADD_DEPENDENCIES(libgaminggearwidget
)
TARGET_LINK_LIBRARIES(libgaminggearwidget
+ libgaminggear
+ m
${GTK2_LIBRARIES}
+ ${GLIB2_LIBRARIES}
+ ${GDK_LIBRARIES}
+ ${CAIRO_LIBRARIES}
+ ${PANGO_LIBRARIES}
)
SET_TARGET_PROPERTIES(libgaminggearwidget
++++++ libgaminggear-0.4.0.tar.bz2 -> libgaminggear-0.5.0.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.4.0/CMakeLists.txt new/libgaminggear-0.5.0/CMakeLists.txt
--- old/libgaminggear-0.4.0/CMakeLists.txt 2014-07-04 14:37:43.000000000 +0200
+++ new/libgaminggear-0.5.0/CMakeLists.txt 2014-09-08 16:02:23.000000000 +0200
@@ -37,7 +37,7 @@
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
SET(V_MAJOR 0)
-SET(V_MINOR 4)
+SET(V_MINOR 5)
SET(V_MICRO 0)
INCLUDE_DIRECTORIES(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.4.0/Changelog new/libgaminggear-0.5.0/Changelog
--- old/libgaminggear-0.4.0/Changelog 2014-07-04 14:37:43.000000000 +0200
+++ new/libgaminggear-0.5.0/Changelog 2014-09-08 16:02:23.000000000 +0200
@@ -1,3 +1,8 @@
+0.5.0 2014-09-08
+
+ * Improved: GaminggearDevice
+ * Fixed: Canberra notifications are failsafe now
+
0.4.0 2014-07-04
* Added GaminggearAudioNotificator and GaminggearScreenNotificator
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.4.0/include/gaminggear/gaminggear_device.h new/libgaminggear-0.5.0/include/gaminggear/gaminggear_device.h
--- old/libgaminggear-0.4.0/include/gaminggear/gaminggear_device.h 2014-07-04 14:37:43.000000000 +0200
+++ new/libgaminggear-0.5.0/include/gaminggear/gaminggear_device.h 2014-09-08 16:02:23.000000000 +0200
@@ -51,10 +51,11 @@
* \param identifier The unique identifier of the device.
* \param vendor_id The vendor id of the device.
* \param product_id The product id of the device.
+ * \param num_interfaces The number of interfaces of the device.
* \retval device The new GaminggearDevice which should be freed with g_object_unref().
* \since 1.0
*/
-GaminggearDevice *gaminggear_device_new(gchar const *identifier, guint vendor_id, guint product_id);
+GaminggearDevice *gaminggear_device_new(gchar const *identifier, guint vendor_id, guint product_id, guint num_interfaces);
/*! \brief Get identifier.
* \param gaminggear_dev A GaminggearDevice.
@@ -77,6 +78,13 @@
*/
guint gaminggear_device_get_vendor_id(GaminggearDevice const *gaminggear_dev);
+/*! \brief Get number of interfaces.
+ * \param gaminggear_dev A GaminggearDevice.
+ * \retval num_interfaces The number of interfaces of the device given at construction time.
+ * \since 1.0
+ */
+guint gaminggear_device_get_num_interfaces(GaminggearDevice const *gaminggear_dev);
+
/*! \brief Match device agains vendor/product id
* \param gaminggear_dev A GaminggearDevice.
* \param vendor_id The vendor id to match against.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.4.0/libgaminggear/gaminggear_audio_notificator_canberra.c new/libgaminggear-0.5.0/libgaminggear/gaminggear_audio_notificator_canberra.c
--- old/libgaminggear-0.4.0/libgaminggear/gaminggear_audio_notificator_canberra.c 2014-07-04 14:37:43.000000000 +0200
+++ new/libgaminggear-0.5.0/libgaminggear/gaminggear_audio_notificator_canberra.c 2014-09-08 16:02:23.000000000 +0200
@@ -30,6 +30,9 @@
};
static guint gaminggear_audio_notificator_claim_next_id(GaminggearAudioNotificator *notificator) {
+ if (notificator == NULL)
+ return 0;
+
return notificator->next_id++;
}
@@ -86,7 +89,7 @@
void gaminggear_audio_notificator_deinit(GaminggearAudioNotificator *notificator) {
gint retval;
- if (notificator->context == NULL)
+ if (notificator == NULL)
return;
retval = ca_context_destroy(notificator->context);
@@ -97,6 +100,10 @@
GaminggearAudioNotification *gaminggear_audio_notification_new(GaminggearAudioNotificator *notificator) {
GaminggearAudioNotification *notification;
+
+ if (notificator == NULL)
+ return NULL;
+
notification = (GaminggearAudioNotification *)g_malloc0(sizeof(GaminggearAudioNotification));
notification->notificator = notificator;
notification->id = gaminggear_audio_notificator_claim_next_id(notificator);
@@ -109,6 +116,10 @@
gboolean gaminggear_audio_notification_cancel(GaminggearAudioNotification *notification) {
gint retval;
+
+ if (notification == NULL)
+ return FALSE;
+
retval = ca_context_cancel(notification->notificator->context, notification->id);
if (retval != 0 && retval != CA_ERROR_STATE) {
g_warning("Error cancelling audio notificator: %s", ca_strerror(retval));
@@ -121,6 +132,9 @@
gint retval;
gchar *volume_string;
+ if (notification == NULL)
+ return FALSE;
+
volume_string = g_strdup_printf("%f", volume);
gaminggear_audio_notification_cancel(notification);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.4.0/libgaminggear/gaminggear_device.c new/libgaminggear-0.5.0/libgaminggear/gaminggear_device.c
--- old/libgaminggear-0.4.0/libgaminggear/gaminggear_device.c 2014-07-04 14:37:43.000000000 +0200
+++ new/libgaminggear-0.5.0/libgaminggear/gaminggear_device.c 2014-09-08 16:02:23.000000000 +0200
@@ -30,6 +30,9 @@
guint vendor_id;
guint product_id;
GaminggearRecMutex lock;
+ GHashTable *paths;
+ GHashTable *fds;
+ guint num_interfaces;
};
enum {
@@ -37,74 +40,50 @@
PROP_IDENTIFIER,
PROP_PRODUCT_ID,
PROP_VENDOR_ID,
+ PROP_NUM_INTERFACES,
};
G_DEFINE_TYPE(GaminggearDevice, gaminggear_device, G_TYPE_OBJECT);
-static gchar *create_fd_string(gchar const *key) {
- return g_strconcat("fd_", key, NULL);
-}
-
-static void gaminggear_device_set_fd(GaminggearDevice *gaminggear_device, gchar const *key, gint fd) {
- gchar *fd_key;
- fd_key = create_fd_string(key);
- g_object_set_data(G_OBJECT(gaminggear_device), fd_key, GINT_TO_POINTER(fd));
- g_free(fd_key);
-}
-
-static int gaminggear_device_get_fd(GaminggearDevice *gaminggear_device, gchar const *key) {
- gchar *fd_key;
- int fd;
-
- fd_key = create_fd_string(key);
- fd = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gaminggear_device), fd_key));
- g_free(fd_key);
-
- return fd;
-}
-
int gaminggear_device_open(GaminggearDevice *gaminggear_device, gchar const *key, gint flags, GError **error) {
gchar const *path;
+ gpointer value;
int fd;
- /* fd is only valid if path is set */
+ // already open?
+ if (g_hash_table_lookup_extended(gaminggear_device->priv->fds, key, NULL, &value))
+ return GPOINTER_TO_INT(value);
+
path = gaminggear_device_get_path(gaminggear_device, key);
if (!path) {
- g_set_error(error, G_FILE_ERROR, G_FILE_ERROR_INVAL, "Error opening file: no path");
+ g_set_error(error, G_FILE_ERROR, G_FILE_ERROR_INVAL, "GaminggearDevice: error opening file for key %s: no path", key);
return -1;
}
- fd = gaminggear_device_get_fd(gaminggear_device, key);
- if (fd >= 0)
- return fd;
-
fd = open(path, flags, 0);
if (fd < 0)
- g_set_error(error, G_FILE_ERROR, g_file_error_from_errno(errno), "Error opening %s: %s", path, g_strerror(errno));
+ g_set_error(error, G_FILE_ERROR, g_file_error_from_errno(errno), "GaminggearDevice: error opening %s for key %s: %s", path, key, g_strerror(errno));
+
+ g_hash_table_insert(gaminggear_device->priv->fds, g_strdup(key), GINT_TO_POINTER(fd));
- gaminggear_device_set_fd(gaminggear_device, key, fd);
return fd;
}
gboolean gaminggear_device_close(GaminggearDevice *gaminggear_device, gchar const *key, GError **error) {
- gchar const *path;
+ gpointer value;
int fd;
- /* fd is only valid if path is set */
- path = gaminggear_device_get_path(gaminggear_device, key);
- if (!path) {
- g_set_error(error, G_FILE_ERROR, G_FILE_ERROR_INVAL, "Error closing file: no path");
+ if (!g_hash_table_lookup_extended(gaminggear_device->priv->fds, key, NULL, &value)) {
+ g_set_error(error, G_FILE_ERROR, G_FILE_ERROR_INVAL, "GaminggearDevice: error closing fd for key %s: no entry", key);
return FALSE;
}
- fd = gaminggear_device_get_fd(gaminggear_device, key);
- if (fd >= 0) {
- if (close(fd) < 0) {
- g_set_error(error, G_FILE_ERROR, g_file_error_from_errno(errno), "Error closing %s: %s", path, g_strerror(errno));
- return FALSE;
- }
- gaminggear_device_set_fd(gaminggear_device, key, -1);
+ fd = GPOINTER_TO_INT(value);
+ if (close(fd) < 0) {
+ g_set_error(error, G_FILE_ERROR, g_file_error_from_errno(errno), "GaminggearDevice: error closing fd for key %s: %s", key, g_strerror(errno));
+ return FALSE;
}
+ g_hash_table_remove(gaminggear_device->priv->fds, key);
return TRUE;
}
@@ -117,12 +96,11 @@
g_free(old_path);
}
- g_object_set_data(G_OBJECT(gaminggear_device), key, g_strdup(path));
- gaminggear_device_set_fd(gaminggear_device, key, -1);
+ g_hash_table_insert(gaminggear_device->priv->paths, g_strdup(key), g_strdup(path));
}
gchar const *gaminggear_device_get_path(GaminggearDevice *gaminggear_device, gchar const *key) {
- return (gchar const *)g_object_get_data(G_OBJECT(gaminggear_device), key);
+ return (gchar const *)g_hash_table_lookup(gaminggear_device->priv->paths, key);
}
void gaminggear_device_lock(GaminggearDevice *gaminggear_dev) {
@@ -145,24 +123,42 @@
return gaminggear_dev->priv->vendor_id;
}
+guint gaminggear_device_get_num_interfaces(GaminggearDevice const *gaminggear_dev) {
+ return gaminggear_dev->priv->num_interfaces;
+}
+
gboolean gaminggear_device_matches(GaminggearDevice const *gaminggear_dev, guint vendor_id, guint product_id) {
GaminggearDevicePrivate *priv = gaminggear_dev->priv;
return (priv->vendor_id == vendor_id && priv->product_id == product_id);
}
-GaminggearDevice *gaminggear_device_new(gchar const *identifier, guint vendor_id, guint product_id) {
+GaminggearDevice *gaminggear_device_new(gchar const *identifier, guint vendor_id, guint product_id, guint num_interfaces) {
return GAMINGGEAR_DEVICE(g_object_new(GAMINGGEAR_DEVICE_TYPE,
"identifier", identifier,
"vendor-id", vendor_id,
"product-id", product_id,
+ "num-interfaces", num_interfaces,
NULL));
}
+static void destroy_str(gpointer data) {
+ g_free(data);
+}
+
+static void destroy_fd(gpointer data) {
+ int fd = GPOINTER_TO_INT(data);
+ if (close(fd) < 0)
+ g_warning("GaminggearDevice: error closing fd %i: %s", fd, g_strerror(errno));
+}
+
static void gaminggear_device_init(GaminggearDevice *gaminggear_dev) {
GaminggearDevicePrivate *priv = GAMINGGEAR_DEVICE_GET_PRIVATE(gaminggear_dev);
gaminggear_dev->priv = priv;
gaminggear_rec_mutex_init(&priv->lock);
+
+ priv->paths = g_hash_table_new_full(g_str_hash, g_str_equal, destroy_str, destroy_str);
+ priv->fds = g_hash_table_new_full(g_str_hash, g_str_equal, destroy_str, destroy_fd);
}
static void set_property(GObject *object, guint prop_id, GValue const *value, GParamSpec *pspec) {
@@ -178,6 +174,9 @@
case PROP_VENDOR_ID:
priv->vendor_id = g_value_get_uint(value);
break;
+ case PROP_NUM_INTERFACES:
+ priv->num_interfaces = g_value_get_uint(value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
@@ -188,6 +187,8 @@
GaminggearDevicePrivate *priv = GAMINGGEAR_DEVICE(object)->priv;
g_free(priv->identifier);
+ g_hash_table_unref(priv->paths);
+ g_hash_table_unref(priv->fds);
gaminggear_rec_mutex_clear(&priv->lock);
G_OBJECT_CLASS(gaminggear_device_parent_class)->finalize(object);
@@ -223,6 +224,13 @@
"Vendor ID",
0, G_MAXUINT, 0,
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property(gobject_class, PROP_NUM_INTERFACES,
+ g_param_spec_uint("num-interfaces",
+ "num-interfaces",
+ "Number of interfaces",
+ 0, G_MAXUINT, 0,
+ G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}
gboolean gaminggear_device_equal(GaminggearDevice const *one, GaminggearDevice const *other) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.4.0/libgaminggear.spec new/libgaminggear-0.5.0/libgaminggear.spec
--- old/libgaminggear-0.4.0/libgaminggear.spec 2014-07-04 14:37:43.000000000 +0200
+++ new/libgaminggear-0.5.0/libgaminggear.spec 2014-09-08 16:02:23.000000000 +0200
@@ -1,5 +1,5 @@
%define vmajor 0
-%define vminor 4
+%define vminor 5
%define vmicro 0
Name: libgaminggear
@@ -80,5 +80,5 @@
/usr/share/cmake/Modules/FindGAMINGGEAR%{vmajor}.cmake
%changelog
-* Fri Jul 04 2014 Stefan Achatz
participants (1)
-
root@hilbert.suse.de