* Fri Feb 27 2009 Peter Hutterer <peter.hutterer@redhat.com> 1.6.0-2
- xserver-1.6.0-XIPropToInt.patch: add XIPropToInt helper function (requirement for XATOM_FLOAT patch) - xserver-1.6.0-XATOM_FLOAT.patch: add support for float properties.
This commit is contained in:
parent
81bec85ede
commit
6b868c81bb
@ -19,7 +19,7 @@
|
|||||||
Summary: X.Org X11 X server
|
Summary: X.Org X11 X server
|
||||||
Name: xorg-x11-server
|
Name: xorg-x11-server
|
||||||
Version: 1.6.0
|
Version: 1.6.0
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
URL: http://www.x.org
|
URL: http://www.x.org
|
||||||
License: MIT
|
License: MIT
|
||||||
Group: User Interface/X
|
Group: User Interface/X
|
||||||
@ -91,6 +91,10 @@ Patch6015: xserver-1.5.99.902-vnc.patch
|
|||||||
# Make autoconfiguration chose nouveau driver for NVIDIA GPUs
|
# Make autoconfiguration chose nouveau driver for NVIDIA GPUs
|
||||||
Patch6017: xserver-1.5.99.902-nouveau.patch
|
Patch6017: xserver-1.5.99.902-nouveau.patch
|
||||||
|
|
||||||
|
# from master, may end up in 1.6.1.
|
||||||
|
Patch6018: xserver-1.6.0-XIPropToInt.patch
|
||||||
|
Patch6019: xserver-1.6.0-XATOM_FLOAT.patch
|
||||||
|
|
||||||
%define moduledir %{_libdir}/xorg/modules
|
%define moduledir %{_libdir}/xorg/modules
|
||||||
%define drimoduledir %{_libdir}/dri
|
%define drimoduledir %{_libdir}/dri
|
||||||
%define sdkdir %{_includedir}/xorg
|
%define sdkdir %{_includedir}/xorg
|
||||||
@ -507,6 +511,11 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Feb 27 2009 Peter Hutterer <peter.hutterer@redhat.com> 1.6.0-2
|
||||||
|
- xserver-1.6.0-XIPropToInt.patch: add XIPropToInt helper function
|
||||||
|
(requirement for XATOM_FLOAT patch)
|
||||||
|
- xserver-1.6.0-XATOM_FLOAT.patch: add support for float properties.
|
||||||
|
|
||||||
* Wed Feb 25 2009 Adam Jackson <ajax@redhat.com> 1.6.0-1
|
* Wed Feb 25 2009 Adam Jackson <ajax@redhat.com> 1.6.0-1
|
||||||
- xserver 1.6.0
|
- xserver 1.6.0
|
||||||
|
|
||||||
|
123
xserver-1.6.0-XATOM_FLOAT.patch
Normal file
123
xserver-1.6.0-XATOM_FLOAT.patch
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
From a48c81dcdf569a3f634ac23e08d2491354de6a36 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Hutterer <peter.hutterer@who-t.net>
|
||||||
|
Date: Fri, 5 Dec 2008 16:24:57 +1000
|
||||||
|
Subject: [PATCH] Xi: add XATOM_FLOAT to server-defined properties.
|
||||||
|
|
||||||
|
This property is used to denote type float for input properties. Such
|
||||||
|
properties can be accessed easily through the XIPropToFloat() function.
|
||||||
|
|
||||||
|
Code originally written by Simon Thum.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
|
||||||
|
---
|
||||||
|
Xi/xiproperty.c | 55 +++++++++++++++++++++++++++++++++++++++++-
|
||||||
|
include/exevents.h | 6 ++++
|
||||||
|
include/xserver-properties.h | 4 +++
|
||||||
|
3 files changed, 64 insertions(+), 1 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
|
||||||
|
index cd9805a..6da8424 100644
|
||||||
|
--- a/Xi/xiproperty.c
|
||||||
|
+++ b/Xi/xiproperty.c
|
||||||
|
@@ -49,7 +49,8 @@ static struct dev_properties
|
||||||
|
Atom type;
|
||||||
|
char *name;
|
||||||
|
} dev_properties[] = {
|
||||||
|
- {0, XI_PROP_ENABLED}
|
||||||
|
+ {0, XI_PROP_ENABLED},
|
||||||
|
+ {0, XATOM_FLOAT}
|
||||||
|
};
|
||||||
|
|
||||||
|
static long XIPropHandlerID = 1;
|
||||||
|
@@ -137,6 +138,58 @@ XIPropToInt(XIPropertyValuePtr val, int *nelem_return, int **buf_return)
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
+/**
|
||||||
|
+ * Convert the given property's value(s) into @nelem_return float values and
|
||||||
|
+ * store them in @buf_return. If @nelem_return is larger than the number of
|
||||||
|
+ * values in the property, @nelem_return is set to the number of values in the
|
||||||
|
+ * property.
|
||||||
|
+ *
|
||||||
|
+ * If *@buf_return is NULL and @nelem_return is 0, memory is allocated
|
||||||
|
+ * automatically and must be freed by the caller.
|
||||||
|
+ *
|
||||||
|
+ * Possible errors returned:
|
||||||
|
+ * Success
|
||||||
|
+ * BadMatch ... Wrong atom type, atom is not XA_FLOAT
|
||||||
|
+ * BadValue ... Wrong format, format is not 32
|
||||||
|
+ * BadAlloc ... NULL passed as buffer and allocation failed.
|
||||||
|
+ * BadLength ... @buff is NULL but @nelem_return is non-zero.
|
||||||
|
+ *
|
||||||
|
+ * @param val The property value
|
||||||
|
+ * @param nelem_return The maximum number of elements to return.
|
||||||
|
+ * @param buf_return Pointer to an array of at least @nelem_return values.
|
||||||
|
+ * @return Success or the error code if an error occured.
|
||||||
|
+ */
|
||||||
|
+_X_EXPORT int
|
||||||
|
+XIPropToFloat(XIPropertyValuePtr val, int *nelem_return, float **buf_return)
|
||||||
|
+{
|
||||||
|
+ int i;
|
||||||
|
+ float *buf;
|
||||||
|
+
|
||||||
|
+ if (!val->type || val->type != XIGetKnownProperty(XATOM_FLOAT))
|
||||||
|
+ return BadMatch;
|
||||||
|
+
|
||||||
|
+ if (val->format != 32)
|
||||||
|
+ return BadValue;
|
||||||
|
+ if (!*buf_return && *nelem_return)
|
||||||
|
+ return BadLength;
|
||||||
|
+
|
||||||
|
+ buf = *buf_return;
|
||||||
|
+
|
||||||
|
+ if (!buf && !(*nelem_return))
|
||||||
|
+ {
|
||||||
|
+ buf = xcalloc(val->size, sizeof(float));
|
||||||
|
+ if (!buf)
|
||||||
|
+ return BadAlloc;
|
||||||
|
+ *buf_return = buf;
|
||||||
|
+ *nelem_return = val->size;
|
||||||
|
+ } else if (val->size < *nelem_return)
|
||||||
|
+ *nelem_return = val->size;
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < val->size && i < *nelem_return; i++)
|
||||||
|
+ buf[i] = ((float*)val->data)[i];
|
||||||
|
+
|
||||||
|
+ return Success;
|
||||||
|
+}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init those properties that are allocated by the server and most likely used
|
||||||
|
diff --git a/include/exevents.h b/include/exevents.h
|
||||||
|
index 485347b..2504baf 100644
|
||||||
|
--- a/include/exevents.h
|
||||||
|
+++ b/include/exevents.h
|
||||||
|
@@ -257,4 +257,10 @@ extern _X_EXPORT int XIPropToInt(
|
||||||
|
int **buf_return
|
||||||
|
);
|
||||||
|
|
||||||
|
+extern _X_EXPORT int XIPropToFloat(
|
||||||
|
+ XIPropertyValuePtr val,
|
||||||
|
+ int *nelem_return,
|
||||||
|
+ float **buf_return
|
||||||
|
+);
|
||||||
|
+
|
||||||
|
#endif /* EXEVENTS_H */
|
||||||
|
diff --git a/include/xserver-properties.h b/include/xserver-properties.h
|
||||||
|
index 4d602b5..f8aeab6 100644
|
||||||
|
--- a/include/xserver-properties.h
|
||||||
|
+++ b/include/xserver-properties.h
|
||||||
|
@@ -26,6 +26,10 @@
|
||||||
|
#ifndef _XSERVER_PROPERTIES_H_
|
||||||
|
#define _XSERVER_PROPERTIES_H_
|
||||||
|
|
||||||
|
+/* Type for a 4 byte float. Storage format IEEE 754 in client's default
|
||||||
|
+ * byte-ordering. */
|
||||||
|
+#define XATOM_FLOAT "FLOAT"
|
||||||
|
+
|
||||||
|
/* BOOL. 0 - device disabled, 1 - device enabled */
|
||||||
|
#define XI_PROP_ENABLED "Device Enabled"
|
||||||
|
|
||||||
|
--
|
||||||
|
1.6.0.6
|
||||||
|
|
120
xserver-1.6.0-XIPropToInt.patch
Normal file
120
xserver-1.6.0-XIPropToInt.patch
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
From 669f6810af9a89187d6149841925fe765f3988ff Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Hutterer <peter.hutterer@redhat.com>
|
||||||
|
Date: Wed, 19 Nov 2008 15:50:57 +1000
|
||||||
|
Subject: [PATCH] Xi: add XIPropToInt() auxiliary function.
|
||||||
|
|
||||||
|
Converts an XIPropertyValuePtr to an integer, provided that type and format is
|
||||||
|
right.
|
||||||
|
|
||||||
|
Code originally written by Simon Thum.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
|
||||||
|
---
|
||||||
|
Xi/xiproperty.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
include/exevents.h | 6 ++++
|
||||||
|
2 files changed, 74 insertions(+), 0 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
|
||||||
|
index e79a2ed..cd9805a 100644
|
||||||
|
--- a/Xi/xiproperty.c
|
||||||
|
+++ b/Xi/xiproperty.c
|
||||||
|
@@ -32,6 +32,7 @@
|
||||||
|
#include "dix.h"
|
||||||
|
#include "inputstr.h"
|
||||||
|
#include <X11/extensions/XI.h>
|
||||||
|
+#include <X11/Xatom.h>
|
||||||
|
#include <X11/extensions/XIproto.h>
|
||||||
|
#include "exglobals.h"
|
||||||
|
#include "exevents.h"
|
||||||
|
@@ -71,6 +72,73 @@ XIGetKnownProperty(char *name)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
+ * Convert the given property's value(s) into @nelem_return integer values and
|
||||||
|
+ * store them in @buf_return. If @nelem_return is larger than the number of
|
||||||
|
+ * values in the property, @nelem_return is set to the number of values in the
|
||||||
|
+ * property.
|
||||||
|
+ *
|
||||||
|
+ * If *@buf_return is NULL and @nelem_return is 0, memory is allocated
|
||||||
|
+ * automatically and must be freed by the caller.
|
||||||
|
+ *
|
||||||
|
+ * Possible return codes.
|
||||||
|
+ * Success ... No error.
|
||||||
|
+ * BadMatch ... Wrong atom type, atom is not XA_INTEGER
|
||||||
|
+ * BadAlloc ... NULL passed as buffer and allocation failed.
|
||||||
|
+ * BadLength ... @buff is NULL but @nelem_return is non-zero.
|
||||||
|
+ *
|
||||||
|
+ * @param val The property value
|
||||||
|
+ * @param nelem_return The maximum number of elements to return.
|
||||||
|
+ * @param buf_return Pointer to an array of at least @nelem_return values.
|
||||||
|
+ * @return Success or the error code if an error occured.
|
||||||
|
+ */
|
||||||
|
+_X_EXPORT int
|
||||||
|
+XIPropToInt(XIPropertyValuePtr val, int *nelem_return, int **buf_return)
|
||||||
|
+{
|
||||||
|
+ int i;
|
||||||
|
+ int *buf;
|
||||||
|
+
|
||||||
|
+ if (val->type != XA_INTEGER)
|
||||||
|
+ return BadMatch;
|
||||||
|
+ if (!*buf_return && *nelem_return)
|
||||||
|
+ return BadLength;
|
||||||
|
+
|
||||||
|
+ switch(val->format)
|
||||||
|
+ {
|
||||||
|
+ case 8:
|
||||||
|
+ case 16:
|
||||||
|
+ case 32:
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ return BadValue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ buf = *buf_return;
|
||||||
|
+
|
||||||
|
+ if (!buf && !(*nelem_return))
|
||||||
|
+ {
|
||||||
|
+ buf = xcalloc(val->size, sizeof(int));
|
||||||
|
+ if (!buf)
|
||||||
|
+ return BadAlloc;
|
||||||
|
+ *buf_return = buf;
|
||||||
|
+ *nelem_return = val->size;
|
||||||
|
+ } else if (val->size < *nelem_return)
|
||||||
|
+ *nelem_return = val->size;
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < val->size && i < *nelem_return; i++)
|
||||||
|
+ {
|
||||||
|
+ switch(val->format)
|
||||||
|
+ {
|
||||||
|
+ case 8: buf[i] = ((CARD8*)val->data)[i]; break;
|
||||||
|
+ case 16: buf[i] = ((CARD16*)val->data)[i]; break;
|
||||||
|
+ case 32: buf[i] = ((CARD32*)val->data)[i]; break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return Success;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
* Init those properties that are allocated by the server and most likely used
|
||||||
|
* by the DIX or the DDX.
|
||||||
|
*/
|
||||||
|
diff --git a/include/exevents.h b/include/exevents.h
|
||||||
|
index 2a7ec97..485347b 100644
|
||||||
|
--- a/include/exevents.h
|
||||||
|
+++ b/include/exevents.h
|
||||||
|
@@ -251,4 +251,10 @@ extern _X_EXPORT Atom XIGetKnownProperty(
|
||||||
|
|
||||||
|
extern DeviceIntPtr XIGetDevice(xEvent *ev);
|
||||||
|
|
||||||
|
+extern _X_EXPORT int XIPropToInt(
|
||||||
|
+ XIPropertyValuePtr val,
|
||||||
|
+ int *nelem_return,
|
||||||
|
+ int **buf_return
|
||||||
|
+);
|
||||||
|
+
|
||||||
|
#endif /* EXEVENTS_H */
|
||||||
|
--
|
||||||
|
1.6.0.6
|
||||||
|
|
Loading…
Reference in New Issue
Block a user