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>
This commit is contained in:
parent
5cb31cd0cb
commit
a14a0c7113
17
dix/events.c
17
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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user