summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-03-03 14:41:44 -0800
committerKeith Packard <keithp@keithp.com>2011-03-03 14:41:44 -0800
commit6c90e839d9872a37d371578c9c423e8213922044 (patch)
tree72148d81e7c54d16afeccab026caf8faf8db3b6e /include
parent0bc95d5b06dcea65a1aa193ea907b50f7dd168b5 (diff)
parentedcceedbd35df576929685767d0b619659e5b020 (diff)
Merge remote branch 'whot/for-keith'
Diffstat (limited to 'include')
-rw-r--r--include/dix.h1
-rw-r--r--include/eventconvert.h2
-rw-r--r--include/input.h16
-rw-r--r--include/inputstr.h8
-rw-r--r--include/list.h182
-rw-r--r--include/protocol-versions.h4
-rw-r--r--include/ptrveloc.h10
-rw-r--r--include/xkbsrv.h4
8 files changed, 201 insertions, 26 deletions
diff --git a/include/dix.h b/include/dix.h
index 12e4b5977..3f99098a2 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -570,6 +570,7 @@ extern Bool _X_EXPORT IsPointerDevice( DeviceIntPtr dev);
extern Bool _X_EXPORT IsKeyboardDevice(DeviceIntPtr dev);
extern Bool IsPointerEvent(InternalEvent *event);
extern _X_EXPORT Bool IsMaster(DeviceIntPtr dev);
+extern _X_EXPORT Bool IsFloating(DeviceIntPtr dev);
extern _X_HIDDEN void CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master);
extern _X_HIDDEN int CorePointerProc(DeviceIntPtr dev, int what);
diff --git a/include/eventconvert.h b/include/eventconvert.h
index b1196a00e..b000abc4b 100644
--- a/include/eventconvert.h
+++ b/include/eventconvert.h
@@ -30,7 +30,7 @@
#define FP1616(integral, frac) ((integral) * (1 << 16) + (frac) * (1 << 16))
-_X_EXPORT int EventToCore(InternalEvent *event, xEvent *core);
+_X_EXPORT int EventToCore(InternalEvent *event, xEvent **core, int *count);
_X_EXPORT int EventToXI(InternalEvent *ev, xEvent **xi, int *count);
_X_EXPORT int EventToXI2(InternalEvent *ev, xEvent **xi);
_X_INTERNAL int GetCoreType(InternalEvent* ev);
diff --git a/include/input.h b/include/input.h
index f96a0a988..643866f98 100644
--- a/include/input.h
+++ b/include/input.h
@@ -150,6 +150,11 @@ typedef void (*PointerAccelSchemeProc)(
typedef void (*DeviceCallbackProc)(
DeviceIntPtr /*pDev*/);
+struct _ValuatorAccelerationRec;
+typedef Bool (*PointerAccelSchemeInitProc)(
+ DeviceIntPtr /*dev*/,
+ struct _ValuatorAccelerationRec* /*protoScheme*/);
+
typedef struct _DeviceRec {
pointer devicePrivate;
ProcessInputProc processInputProc; /* current */
@@ -538,14 +543,15 @@ extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y);
extern int EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event,
WindowPtr win);
/**
- * Return masks for EventIsDeliverable.
+ * Masks specifying the type of event to deliver for an InternalEvent; used
+ * by EventIsDeliverable.
* @defgroup EventIsDeliverable return flags
* @{
*/
-#define XI_MASK (1 << 0) /**< XI mask set on window */
-#define CORE_MASK (1 << 1) /**< Core mask set on window */
-#define DONT_PROPAGATE_MASK (1 << 2) /**< DontPropagate mask set on window */
-#define XI2_MASK (1 << 3) /**< XI2 mask set on window */
+#define EVENT_XI1_MASK (1 << 0) /**< XI1.x event */
+#define EVENT_CORE_MASK (1 << 1) /**< Core event */
+#define EVENT_DONT_PROPAGATE_MASK (1 << 2) /**< DontPropagate mask set */
+#define EVENT_XI2_MASK (1 << 3) /**< XI2 mask set on window */
/* @} */
/* Implemented by the DDX. */
diff --git a/include/inputstr.h b/include/inputstr.h
index b74ee0454..8509eb024 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -266,6 +266,7 @@ typedef struct _ValuatorAccelerationRec {
int number;
PointerAccelSchemeProc AccelSchemeProc;
void *accelData; /* at disposal of AccelScheme */
+ PointerAccelSchemeInitProc AccelInitProc;
DeviceCallbackProc AccelCleanupProc;
} ValuatorAccelerationRec, *ValuatorAccelerationPtr;
@@ -493,6 +494,7 @@ typedef struct _SpriteInfoRec {
#define MASTER_POINTER 1
#define MASTER_KEYBOARD 2
#define SLAVE 3
+#define MASTER_ATTACHED 4 /* special type for GetMaster */
typedef struct _DeviceIntRec {
DeviceRec public;
@@ -529,10 +531,8 @@ typedef struct _DeviceIntRec {
PrivateRec *devPrivates;
DeviceUnwrapProc unwrapProc;
SpriteInfoPtr spriteInfo;
- union {
- DeviceIntPtr master; /* master device */
- DeviceIntPtr lastSlave; /* last slave device used */
- } u;
+ DeviceIntPtr master; /* master device */
+ DeviceIntPtr lastSlave; /* last slave device used */
/* last valuator values recorded, not posted to client;
* for slave devices, valuators is in device coordinates
diff --git a/include/list.h b/include/list.h
index 4ce20a866..5933b973d 100644
--- a/include/list.h
+++ b/include/list.h
@@ -26,11 +26,102 @@
#ifndef _LIST_H_
#define _LIST_H_
-/* classic doubly-link circular list */
+/**
+ * @file Classic doubly-link circular list implementation.
+ *
+ * Example:
+ * We need to keep a list of struct foo in the parent struct bar, i.e. what
+ * we want is something like this.
+ *
+ * struct bar {
+ * ...
+ * struct foo *foos; -----> struct foo {}, struct foo {}, struct foo{}
+ * ...
+ * }
+ *
+ * We need one list head in bar and a list element in all foos (both are of
+ * data type 'struct list').
+ *
+ * struct bar {
+ * ...
+ * struct list foos;
+ * ...
+ * }
+ *
+ * struct foo {
+ * ...
+ * struct list entry;
+ * ...
+ * }
+ *
+ * Now we initialize the list head:
+ *
+ * struct bar bar;
+ * ...
+ * list_init(&bar.foos);
+ *
+ * Then we create the first element and add it to this list:
+ *
+ * struct foo *foo = malloc(...);
+ * ....
+ * list_add(&foo->entry, &bar.foos);
+ *
+ * Repeat the above for each element you want to add to the list. Deleting
+ * works with the element itself.
+ * list_del(&foo->entry);
+ * free(foo);
+ *
+ * Note: calling list_del(&bar.foos) will set bar.foos to an empty
+ * list again.
+ *
+ * Looping through the list requires a 'struct foo' as iterator and the
+ * name of the field the subnodes use.
+ *
+ * struct foo *iterator;
+ * list_for_each_entry(iterator, &bar.foos, entry) {
+ * if (iterator->something == ...)
+ * ...
+ * }
+ *
+ * Note: You must not call list_del() on the iterator if you continue the
+ * loop. You need to run the safe for-each loop instead:
+ *
+ * struct foo *iterator, *next;
+ * list_for_each_entry_safe(iterator, next, &bar.foos, entry) {
+ * if (...)
+ * list_del(&iterator->entry);
+ * }
+ *
+ */
+
+/**
+ * The linkage struct for list nodes. This struct must be part of your
+ * to-be-linked struct.
+ *
+ * Example:
+ * struct foo {
+ * int a;
+ * void *b;
+ * struct list *mylist;
+ * }
+ *
+ * Position and name of the struct list field is irrelevant.
+ * There are no requirements that elements of a list are of the same type.
+ * There are no requirements for a list head, any struct list can be a list
+ * head.
+ */
struct list {
struct list *next, *prev;
};
+/**
+ * Initialize the list as an empty list.
+ *
+ * Example:
+ * list_init(&foo->mylist);
+ *
+ * @param The list to initialized.
+ */
static void
list_init(struct list *list)
{
@@ -48,6 +139,20 @@ __list_add(struct list *entry,
prev->next = entry;
}
+/**
+ * Insert a new element after the given list head.
+ * The list changes from:
+ * head → some element → ...
+ * to
+ * head → new element → older element → ...
+ *
+ * Example:
+ * struct foo *newfoo = malloc(...);
+ * list_add(&newfoo->mylist, &foo->mylist);
+ *
+ * @param entry The new element to prepend to the list.
+ * @param head The existing list.
+ */
static inline void
list_add(struct list *entry, struct list *head)
{
@@ -61,6 +166,20 @@ __list_del(struct list *prev, struct list *next)
prev->next = next;
}
+/**
+ * Remove the element from the list it is in. Using this function will reset
+ * the pointers to/from this element so it is removed from the list. It does
+ * NOT free the element itself or manipulate it otherwise.
+ *
+ * Using list_del on a pure list head (like in the example at the top of
+ * this file) will NOT remove the first element from
+ * the list but rather reset the list as empty list.
+ *
+ * Example:
+ * list_del(&newfoo->mylist);
+ *
+ * @param entry The element to remove.
+ */
static inline void
list_del(struct list *entry)
{
@@ -68,32 +187,91 @@ list_del(struct list *entry)
list_init(entry);
}
+/**
+ * Check if the list is empty.
+ *
+ * Example:
+ * list_is_empty(&foo->mylist);
+ *
+ * @return True if the list contains one or more elements or False otherwise.
+ */
static inline Bool
list_is_empty(struct list *head)
{
return head->next == head;
}
+/**
+ * Returns a pointer to the container of this list element.
+ *
+ * Example:
+ * struct foo* f;
+ * f = container_of(&foo->mylist, struct foo, mylist);
+ * assert(f == foo);
+ *
+ * @param ptr Pointer to the struct list.
+ * @param type Data type of the list element.
+ * @param member Member name of the struct list field in the list element.
+ * @return A pointer to the data struct containing the list head.
+ */
#ifndef container_of
#define container_of(ptr, type, member) \
(type *)((char *)(ptr) - (char *) &((type *)0)->member)
#endif
+/**
+ * Alias of container_of
+ */
#define list_entry(ptr, type, member) \
container_of(ptr, type, member)
+/**
+ * Retrieve the first list entry for the given list pointer.
+ *
+ * Example:
+ * struct foo *first;
+ * first = list_first_entry(&foo->mylist, struct foo, mylist);
+ *
+ * @param ptr The list head
+ * @param type Data type of the list element to retrieve
+ * @param member Member name of the struct list field in the list element.
+ * @return A pointer to the first list element.
+ */
#define list_first_entry(ptr, type, member) \
list_entry((ptr)->next, type, member)
#define __container_of(ptr, sample, member) \
(void *)((char *)(ptr) \
- ((char *)&(sample)->member - (char *)(sample)))
-
+/**
+ * Loop through the list given by head and set pos to struct in the list.
+ *
+ * Example:
+ * struct foo *iterator;
+ * list_for_each_entry(iterator, &foo->mylist, mylist) {
+ * [modify iterator]
+ * }
+ *
+ * This macro is not safe for node deletion. Use list_for_each_entry_safe
+ * instead.
+ *
+ * @param pos Iterator variable of the type of the list elements.
+ * @param head List head
+ * @param member Member name of the struct list in the list elements.
+ *
+ */
#define list_for_each_entry(pos, head, member) \
for (pos = __container_of((head)->next, pos, member); \
&pos->member != (head); \
pos = __container_of(pos->member.next, pos, member))
+/**
+ * Loop through the list, keeping a backup pointer to the element. This
+ * macro allows for the deletion of a list element while looping through the
+ * list.
+ *
+ * See list_for_each_entry for more details.
+ */
#define list_for_each_entry_safe(pos, tmp, head, member) \
for (pos = __container_of((head)->next, pos, member), \
tmp = __container_of(pos->member.next, pos, member); \
diff --git a/include/protocol-versions.h b/include/protocol-versions.h
index 1d33bddcf..8692ded8a 100644
--- a/include/protocol-versions.h
+++ b/include/protocol-versions.h
@@ -104,10 +104,6 @@
#define SERVER_WINDOWSWM_MINOR_VERSION 0
#define SERVER_WINDOWSWM_PATCH_VERSION 0
-/* Xcalibrate */
-#define SERVER_XCALIBRATE_MAJOR_VERSION 0
-#define SERVER_XCALIBRATE_MINOR_VERSION 1
-
/* DGA */
#define SERVER_XDGA_MAJOR_VERSION 2
#define SERVER_XDGA_MINOR_VERSION 0
diff --git a/include/ptrveloc.h b/include/ptrveloc.h
index 6f999a88f..8c59c0361 100644
--- a/include/ptrveloc.h
+++ b/include/ptrveloc.h
@@ -110,12 +110,6 @@ BasicComputeAcceleration(DeviceIntPtr dev, DeviceVelocityPtr vel,
extern _X_EXPORT void
FreeVelocityData(DeviceVelocityPtr vel);
-extern _X_INTERNAL BOOL
-InitializePredictableAccelerationProperties(DeviceIntPtr dev);
-
-extern _X_INTERNAL BOOL
-DeletePredictableAccelerationProperties(DeviceIntPtr dev);
-
extern _X_EXPORT int
SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
@@ -129,6 +123,10 @@ SetDeviceSpecificAccelerationProfile(DeviceVelocityPtr vel,
extern _X_INTERNAL void
AccelerationDefaultCleanup(DeviceIntPtr dev);
+extern _X_INTERNAL Bool
+InitPredictableAccelerationScheme(DeviceIntPtr dev,
+ struct _ValuatorAccelerationRec* protoScheme);
+
extern _X_INTERNAL void
acceleratePointerPredictable(DeviceIntPtr dev, int first_valuator,
int num_valuators, int *valuators, int evtime);
diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index 9f1507e8e..422bae014 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -846,10 +846,6 @@ extern _X_EXPORT XkbGeometryPtr XkbLookupNamedGeometry(
Bool * /* shouldFree */
);
-extern _X_EXPORT char * _XkbDupString(
- const char * /* str */
-);
-
extern _X_EXPORT void XkbConvertCase(
KeySym /* sym */,
KeySym * /* lower */,