summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-04-22 22:19:39 -0700
committerDaniel Stone <daniel@fooishbar.org>2011-05-03 01:46:35 +0100
commita14a0c711397ff7ca0220946010300fc1b2a6e67 (patch)
treef71f82f9dcb67e41101a9023760be1a4f66bfe44 /dix
parent5cb31cd0cbf83fff5f17a475e7b0e45246b19bf3 (diff)
Move event filter initializer out of the structure itself
When kept in the structure, it causes the entire MAXDEVICES * 128 masks to be stored in the data segment and loaded from the file, and also leads to worries about later generations inheriting changes across server reset. text data bss dec hex filename Before: 91837 20528 32 112397 1b70d .libs/events.o After: 92277 48 20512 112837 1b8c5 .libs/events.o Before: 3013384 122696 163156 3299236 3257a4 Xorg After: 3013832 102216 183636 3299684 325964 Xorg File size before: 4337008 Xorg File size after: 4316568 Xorg Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'dix')
-rw-r--r--dix/events.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/dix/events.c b/dix/events.c
index d70d62fd8..1d513eb10 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -345,8 +345,8 @@ extern int DeviceMotionNotify;
/**
* Event masks for each event type.
*
- * One set of filters for each device, but only the first layer
- * is initialized. The rest is memcpy'd in InitEvents.
+ * One set of filters for each device, initialized by memcpy of
+ * default_filter in InitEvents.
*
* Filters are used whether a given event may be delivered to a client,
* usually in the form of if (window-event-mask & filter); then deliver event.
@@ -355,7 +355,9 @@ extern int DeviceMotionNotify;
* time a button is pressed, the filter is modified to also contain the
* matching ButtonXMotion mask.
*/
-static Mask filters[MAXDEVICES][128] = {
+static Mask filters[MAXDEVICES][128];
+
+static const Mask default_filter[128] =
{
NoSuchEvent, /* 0 */
NoSuchEvent, /* 1 */
@@ -392,7 +394,7 @@ static Mask filters[MAXDEVICES][128] = {
ColormapChangeMask, /* ColormapNotify */
CantBeFiltered, /* ClientMessage */
CantBeFiltered /* MappingNotify */
-}};
+};
/**
* For the given event, return the matching event filter. This filter may then
@@ -4977,12 +4979,9 @@ InitEvents(void)
inputInfo.off_devices = (DeviceIntPtr)NULL;
inputInfo.keyboard = (DeviceIntPtr)NULL;
inputInfo.pointer = (DeviceIntPtr)NULL;
- /* The mask for pointer motion events may have changed in the last server
- * generation. See comment above definition of filters. */
- filters[0][PointerMotionMask] = MotionNotify;
- for (i = 1; i < MAXDEVICES; i++)
+ for (i = 0; i < MAXDEVICES; i++)
{
- memcpy(&filters[i], filters[0], sizeof(filters[0]));
+ memcpy(&filters[i], default_filter, sizeof(default_filter));
}
syncEvents.replayDev = (DeviceIntPtr)NULL;