Re: [PATCH] dix: add a MAXEVENTS define for the number of core + extension events
looks good for me but not compile tested ntl Reviewed-by: wharms wha...@bfs.de Am 11.12.2011 03:55, schrieb Peter Hutterer: Not including GenericEvents Signed-off-by: Peter Hutterer peter.hutte...@who-t.net --- dix/events.c |6 +++--- dix/extension.c |3 +-- dix/tables.c |2 +- include/inpututils.h |2 +- include/misc.h |2 ++ 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/dix/events.c b/dix/events.c index 5d0499e..9daeb3c 100644 --- a/dix/events.c +++ b/dix/events.c @@ -367,9 +367,9 @@ extern int DeviceMotionNotify; * time a button is pressed, the filter is modified to also contain the * matching ButtonXMotion mask. */ -Mask event_filters[MAXDEVICES][128]; +Mask event_filters[MAXDEVICES][MAXEVENTS]; -static const Mask default_filter[128] = +static const Mask default_filter[MAXEVENTS] = { NoSuchEvent, /* 0 */ NoSuchEvent, /* 1 */ @@ -673,7 +673,7 @@ SetMaskForEvent(int deviceid, Mask mask, int event) void SetCriticalEvent(int event) { -if (event = 128) +if (event = MAXEVENTS) FatalError(SetCriticalEvent: bogus event number); criticalEvents[event 3] |= 1 (event 7); } diff --git a/dix/extension.c b/dix/extension.c index cc516b6..af9ba31 100644 --- a/dix/extension.c +++ b/dix/extension.c @@ -61,7 +61,6 @@ SOFTWARE. #include registry.h #include xace.h -#define LAST_EVENT 128 #define LAST_ERROR 255 static ExtensionEntry **extensions = (ExtensionEntry **)NULL; @@ -82,7 +81,7 @@ AddExtension(const char *name, int NumEvents, int NumErrors, if (!MainProc || !SwappedMainProc || !MinorOpcodeProc) return((ExtensionEntry *) NULL); -if ((lastEvent + NumEvents LAST_EVENT) || +if ((lastEvent + NumEvents MAXEVENTS) || (unsigned)(lastError + NumErrors LAST_ERROR)) { LogMessage(X_ERROR, Not enabling extension %s: maximum number of events or errors exceeded.\n, name); are you sure that MAXEVENTS is ok ? perhaps = was intended ? re, wh diff --git a/dix/tables.c b/dix/tables.c index 5bd9ea0..45ae2a9 100644 --- a/dix/tables.c +++ b/dix/tables.c @@ -592,7 +592,7 @@ int (* SwappedProcVector[256]) ( ProcBadRequest }; -EventSwapPtr EventSwapVector[128] = +EventSwapPtr EventSwapVector[MAXEVENTS] = { (EventSwapPtr)SErrorEvent, NotImplemented, diff --git a/include/inpututils.h b/include/inpututils.h index 5aa60c2..9e22c5a 100644 --- a/include/inpututils.h +++ b/include/inpututils.h @@ -32,7 +32,7 @@ #include input.h #include X11/extensions/XI2proto.h -extern Mask filters[MAXDEVICES][128]; +extern Mask event_filters[MAXDEVICES][MAXEVENTS]; struct _ValuatorMask { int8_t last_bit; /* highest bit set in mask */ diff --git a/include/misc.h b/include/misc.h index d9811ca..09f928a 100644 --- a/include/misc.h +++ b/include/misc.h @@ -89,6 +89,8 @@ OF THIS SOFTWARE. #define MAXFORMATS 8 #define MAXDEVICES 40 /* input devices */ +/* 128 event opcodes for core + extension events, excluding GE */ +#define MAXEVENTS 128 #define EXTENSION_EVENT_BASE 64 #define EXTENSION_BASE 128 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [REMINDER libX11] XIM: Allow modifier releases in compose sequences (#26705)
hi, i am not a XIM or XKB expert but for me the code looks reasonable. @Andreas Wettstein could you please add a line or two how to test the function ? what does not work (what keys to press) what works after the patch ? re, wh Am 10.12.2011 18:36, schrieb Alan Coopersmith: On 12/10/11 09:08, Andreas Wettstein wrote: About a month ago I submitted a patch for the compose mechanism. It has not been reviewed yet. The patch is here: http://patchwork.freedesktop.org/patch/7884/ Unfortunately, I don't think we have any active developers who will admit to knowing anything about XIM. I certainly can't say if that's a good idea or a horrible one - maybe one of our input or xkb gurus would have a little better idea, because otherwise I don't know what to do with that patch. ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [REMINDER libX11] XIM: Allow modifier releases in compose sequences (#26705)
wh == walter harms wha...@bfs.de writes: After the loss of my laptop, I’ve been somewhat crippled. Now that a monitor has arrived here I shold be able to spend more time on Xorg, again. wh i am not a XIM or XKB expert but for me the code looks reasonable. Agreed. Reviewed-by: James Cloos cl...@jhcloos.com wh @Andreas Wettstein wh could you please add a line or two how to test the function ? wh what does not work (what keys to press) what works after the patch ? And I second this, too. -JimC -- James Cloos cl...@jhcloos.com OpenPGP: 1024D/ED7DAEA6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 00/25] Noise abatement and eyesore rehabilitation
Removes 422 lines of warning messages from the xserver build when using gcc 4.5.2 on Solaris 11 with the latest xorg-macros set of warning flags, and does not introduce any new warnings. There's still plenty more to fix after this batch of course. Alan Coopersmith (25): CheckForEmptyMask does not need to declare int n twice Fix deconstifying cast warning in xi2_get_type Use const cast in BitIsOn macro to avoid angering gcc verify_internal_event: preserve constness of data pointer constify strings in resource name registry xres.c: Preserve constness of string returned by LookupResourceName os/access.c: replace acmp acopy macros with memcmp memcpy calls Constify string for authorization protocol names Constify the reason string throughout the authorization check framework OsInit: store /dev/null in a const char * WriteToClient: preserve constness of buf while extracting length value LockServer: store path to LOCKDIR literal string in a const char * xdmcp.c: fix three small const warnings CompareISOLatin1Lowered: constify arguments x86emu: constify debug strings DoShowOptions: preserve constness of options list as we walk it Convert KdDoSwitchCmd to use asprintf instead of malloc/strcat/etc. KdParseFindNext: Constify delim argument XkbFindSrvLedInfo: remove extraneous name-clashing sli variable _XkbFilterDeviceBtn: move variable declarations to match usage scope Remove duplicate declaration of xf86ValidateModesFlags in xf86Modes.h Remove duplicate declarations of KdAdd*Driver in kdrive.h xf86Priv.h: Add some noreturn attributes suggested by gcc Add some printf format attributes suggested by gcc xf86 parser: convert Error to a varargs macro to clear gcc format warnings Xext/security.c |5 +- Xext/xres.c |4 +- dix/cursor.c |2 +- dix/dispatch.c|5 +- dix/dixutils.c|4 +- dix/events.c |2 +- dix/inpututils.c |2 +- dix/registry.c|5 +- dix/resource.c|2 +- hw/kdrive/src/kdrive.c| 15 ++ hw/kdrive/src/kdrive.h|8 +--- hw/xfree86/common/xf86.h |2 +- hw/xfree86/common/xf86Config.c|2 +- hw/xfree86/common/xf86Configure.c |5 +- hw/xfree86/common/xf86Priv.h |6 +-- hw/xfree86/common/xf86Xinput.h|2 +- hw/xfree86/modes/xf86Modes.h |4 -- hw/xfree86/parser/Configint.h |4 +- hw/xfree86/parser/DRI.c |4 +- hw/xfree86/parser/Device.c|4 +- hw/xfree86/parser/Extensions.c|2 +- hw/xfree86/parser/Files.c |2 +- hw/xfree86/parser/Flags.c |4 +- hw/xfree86/parser/Input.c |4 +- hw/xfree86/parser/InputClass.c|4 +- hw/xfree86/parser/Layout.c| 28 ++-- hw/xfree86/parser/Module.c|4 +- hw/xfree86/parser/Monitor.c | 84 ++-- hw/xfree86/parser/Pointer.c |8 ++-- hw/xfree86/parser/Screen.c| 36 hw/xfree86/parser/Vendor.c|6 +- hw/xfree86/parser/Video.c |6 +- hw/xfree86/parser/configProcs.h |4 +- hw/xfree86/x86emu/debug.c |4 +- hw/xfree86/x86emu/fpu.c | 16 hw/xfree86/x86emu/ops2.c |4 +- hw/xfree86/x86emu/x86emu/debug.h |4 +- include/dix.h |4 +- include/inputstr.h|2 +- include/os.h |6 +- include/registry.h|2 +- include/resource.h|2 +- os/access.c | 30 ++--- os/auth.c |6 +- os/connection.c |4 +- os/io.c |2 +- os/mitauth.c |2 +- os/osdep.h|2 +- os/osinit.c |2 +- os/rpcauth.c |2 +- os/utils.c|4 +- os/xdmauth.c |4 +- os/xdmcp.c|6 +- render/filter.c |3 +- xkb/xkbActions.c |9 ++-- xkb/xkbLEDs.c |6 +-- 56 files changed, 194 insertions(+), 211 deletions(-) -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 01/25] CheckForEmptyMask does not need to declare int n twice
Just use the existing n variable again in the ARGB_CURSOR loop instead of creating another one. Fixes gcc -Wshadow warning: cursor.c: In function 'CheckForEmptyMask': cursor.c:155:6: warning: declaration of 'n' shadows a previous local cursor.c:146:9: warning: shadowed declaration is here Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- dix/cursor.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dix/cursor.c b/dix/cursor.c index f29cb11..6bff447 100644 --- a/dix/cursor.c +++ b/dix/cursor.c @@ -152,7 +152,7 @@ CheckForEmptyMask(CursorBitsPtr bits) if (bits-argb) { CARD32 *argb = bits-argb; - int n = bits-width * bits-height; + n = bits-width * bits-height; while (n--) if (*argb++ 0xff00) return; } -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 05/25] constify strings in resource name registry
LookupResourceName already returned a const char *, so just needed to change the variable we're storing the list in to be a const char ** and then add const to the name argument to RegisterResourceName (which just stores name in the array) and CreateNewResourceType (which just passes name to RegisterResourceName). Clears a bunch of gcc warnings of the form: registry.c:319:5: warning: passing argument 2 of 'RegisterResourceName' discards qualifiers from pointer target type registry.c:200:1: note: expected 'char *' but argument is of type 'const char *' and from all the extensions: damageext.c: In function 'DamageExtensionInit': damageext.c:490:5: warning: passing argument 2 of 'CreateNewResourceType' discards qualifiers from pointer target type ../include/resource.h:159:26: note: expected 'char *' but argument is of type 'const char *' Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- dix/registry.c |5 +++-- dix/resource.c |2 +- include/registry.h |2 +- include/resource.h |2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dix/registry.c b/dix/registry.c index fc35dbb..5ab25ad 100644 --- a/dix/registry.c +++ b/dix/registry.c @@ -41,7 +41,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. static FILE *fh; -static char ***requests, **events, **errors, **resources; +static char ***requests, **events, **errors; +static const char **resources; static unsigned nmajor, *nminor, nevent, nerror, nresource; /* @@ -197,7 +198,7 @@ RegisterExtensionNames(ExtensionEntry *extEntry) */ void -RegisterResourceName(RESTYPE resource, char *name) +RegisterResourceName(RESTYPE resource, const char *name) { resource = TypeMask; diff --git a/dix/resource.c b/dix/resource.c index eb9f049..be8a8f8 100644 --- a/dix/resource.c +++ b/dix/resource.c @@ -242,7 +242,7 @@ CallResourceStateCallback(ResourceState state, ResourceRec *res) } RESTYPE -CreateNewResourceType(DeleteType deleteFunc, char *name) +CreateNewResourceType(DeleteType deleteFunc, const char *name) { RESTYPE next = lastResourceType + 1; struct ResourceType *types; diff --git a/include/registry.h b/include/registry.h index 325f765..44f7925 100644 --- a/include/registry.h +++ b/include/registry.h @@ -28,7 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Registration functions. The name string is not copied, so it must * not be a stack variable. */ -extern _X_EXPORT void RegisterResourceName(RESTYPE type, char *name); +extern _X_EXPORT void RegisterResourceName(RESTYPE type, const char *name); extern _X_EXPORT void RegisterExtensionNames(ExtensionEntry *ext); /* diff --git a/include/resource.h b/include/resource.h index 772b7b8..5da2819 100644 --- a/include/resource.h +++ b/include/resource.h @@ -157,7 +157,7 @@ typedef Bool (*FindComplexResType)( pointer /*cdata*/); extern _X_EXPORT RESTYPE CreateNewResourceType( -DeleteType /*deleteFunc*/, char * /*name*/); +DeleteType /*deleteFunc*/, const char * /*name*/); extern _X_EXPORT void SetResourceTypeErrorValue( RESTYPE /*type*/, int /*errorValue*/); -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 09/25] Constify the reason string throughout the authorization check framework
Almost all of the places the string is assigned point to a literal string constant, so use const char * for those, and const char ** for function calls that return it via an argument. Fortunately the top level function, ClientAuthorized, which returns the string as its return value is called from only one place, ProcEstablishConnection. ProcEstablishConnection stores either that return value or a string literal in char *reason. It only uses reason as an argument to SendConnSetup. SendConnSetup passes the reason argument to strlen WriteToClient, both of which already have const qualifiers on their args. Thus added const to the reason variable in ProcEstablishConnection and the reason argument to SendConnSetup. Fixes gcc warnings: dispatch.c: In function 'ProcEstablishConnection': dispatch.c:3711:9: warning: assignment discards qualifiers from pointer target type auth.c: In function 'CheckAuthorization': auth.c:218:14: warning: assignment discards qualifiers from pointer target type auth.c:220:20: warning: assignment discards qualifiers from pointer target type connection.c: In function 'ClientAuthorized': connection.c:683:3: warning: return discards qualifiers from pointer target type mitauth.c: In function 'MitCheckCookie': mitauth.c:88:13: warning: assignment discards qualifiers from pointer target type xdmauth.c:259:14: warning: assignment discards qualifiers from pointer target type xdmauth.c:270:14: warning: assignment discards qualifiers from pointer target type xdmauth.c:277:11: warning: assignment discards qualifiers from pointer target type xdmauth.c:293:15: warning: assignment discards qualifiers from pointer target type xdmauth.c:313:14: warning: assignment discards qualifiers from pointer target type xdmauth.c:322:11: warning: assignment discards qualifiers from pointer target type rpcauth.c: In function 'SecureRPCCheck': rpcauth.c:136:10: warning: assignment discards qualifiers from pointer target type Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- dix/dispatch.c |5 +++-- include/os.h|4 ++-- os/auth.c |2 +- os/connection.c |4 ++-- os/mitauth.c|2 +- os/osdep.h |2 +- os/rpcauth.c|2 +- os/xdmauth.c|4 ++-- 8 files changed, 13 insertions(+), 12 deletions(-) diff --git a/dix/dispatch.c b/dix/dispatch.c index b39271f..048dff6 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -3600,7 +3600,7 @@ ProcInitialConnection(ClientPtr client) } static int -SendConnSetup(ClientPtr client, char *reason) +SendConnSetup(ClientPtr client, const char *reason) { xWindowRoot *root; int i; @@ -3699,7 +3699,8 @@ SendConnSetup(ClientPtr client, char *reason) int ProcEstablishConnection(ClientPtr client) { -char *reason, *auth_proto, *auth_string; +const char *reason; +char *auth_proto, *auth_string; xConnClientPrefix *prefix; REQUEST(xReq); diff --git a/include/os.h b/include/os.h index 0b50241..48ce329 100644 --- a/include/os.h +++ b/include/os.h @@ -127,7 +127,7 @@ extern _X_EXPORT void CloseWellKnownConnections(void); extern _X_EXPORT XID AuthorizationIDOfClient(ClientPtr /*client*/); -extern _X_EXPORT char *ClientAuthorized( +extern _X_EXPORT const char *ClientAuthorized( ClientPtr /*client*/, unsigned int /*proto_n*/, char* /*auth_proto*/, @@ -415,7 +415,7 @@ extern _X_EXPORT XID CheckAuthorization( unsigned int /*datalength*/, const char * /*data*/, ClientPtr /*client*/, -char ** /*reason*/ +const char ** /*reason*/ ); extern _X_EXPORT void ResetAuthorization(void); diff --git a/os/auth.c b/os/auth.c index 9d36249..6669c14 100644 --- a/os/auth.c +++ b/os/auth.c @@ -163,7 +163,7 @@ CheckAuthorization ( unsigned int data_length, const char *data, ClientPtr client, -char **reason) /* failure message. NULL for default msg */ +const char **reason) /* failure message. NULL for default msg */ { inti; struct stat buf; diff --git a/os/connection.c b/os/connection.c index 6f480de..8a677a7 100644 --- a/os/connection.c +++ b/os/connection.c @@ -629,7 +629,7 @@ AuthorizationIDOfClient(ClientPtr client) * */ -char * +const char * ClientAuthorized(ClientPtr client, unsigned int proto_n, char *auth_proto, unsigned int string_n, char *auth_string) @@ -639,7 +639,7 @@ ClientAuthorized(ClientPtr client, intfamily; intfromlen; XIDauth_id; -char *reason = NULL; +const char *reason = NULL; XtransConnInfo trans_conn; priv = (OsCommPtr)client-osPrivate; diff --git a/os/mitauth.c b/os/mitauth.c index 4b8f6e9..477736e 100644 --- a/os/mitauth.c +++ b/os/mitauth.c @@ -76,7 +76,7 @@ MitCheckCookie ( unsigned short data_length, const char *data, ClientPtr
[PATCH 03/25] Use const cast in BitIsOn macro to avoid angering gcc
Fixes gcc warnings such as: inpututils.c: In function 'valuator_mask_isset': inpututils.c:498:5: warning: cast discards qualifiers from pointer target type inpututils.c: In function 'CountBits': inpututils.c:613:9: warning: cast discards qualifiers from pointer target type Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- include/inputstr.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/include/inputstr.h b/include/inputstr.h index 5634f3c..6af7264 100644 --- a/include/inputstr.h +++ b/include/inputstr.h @@ -57,7 +57,7 @@ SOFTWARE. #include geext.h #include privates.h -#define BitIsOn(ptr, bit) (!!(((BYTE *) (ptr))[(bit)3] (1 ((bit) 7 +#define BitIsOn(ptr, bit) (!!(((const BYTE *) (ptr))[(bit)3] (1 ((bit) 7 #define SetBit(ptr, bit) (((BYTE *) (ptr))[(bit)3] |= (1 ((bit) 7))) #define ClearBit(ptr, bit) (((BYTE *)(ptr))[(bit)3] = ~(1 ((bit) 7))) extern _X_EXPORT int CountBits(const uint8_t *mask, int len); -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 08/25] Constify string for authorization protocol names
gcc was warning from storing string constants in a char *name field: auth.c:64:1: warning: initialization discards qualifiers from pointer target type auth.c:72:1: warning: initialization discards qualifiers from pointer target type auth.c:81:1: warning: initialization discards qualifiers from pointer target type Making the field const requires changing AuthorizationFromID to take a const char ** pointer for the name argument which it sets to point to the matching name entry. Changing that argument requires changing its sole caller in the security extension to pass the address of a const char * variable to it, which it can do, since the only thing it does with the returned name is to pass it back to the RemoveAuthorization function that already expects a const char *name. Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- Xext/security.c |3 ++- include/os.h|2 +- os/auth.c |4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Xext/security.c b/Xext/security.c index 6fc1eaf..63892aa 100644 --- a/Xext/security.c +++ b/Xext/security.c @@ -171,7 +171,8 @@ SecurityDeleteAuthorization( { SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)value; unsigned short name_len, data_len; -char *name, *data; +const char *name; +char *data; int status; int i; OtherClientsPtr pEventClient; diff --git a/include/os.h b/include/os.h index 1fd5367..0b50241 100644 --- a/include/os.h +++ b/include/os.h @@ -405,7 +405,7 @@ extern _X_EXPORT void InitAuthorization(char * /*filename*/); extern _X_EXPORT int AuthorizationFromID ( XID id, unsigned short *name_lenp, - char**namep, + const char **namep, unsigned short *data_lenp, char**datap); diff --git a/os/auth.c b/os/auth.c index 7685751..9d36249 100644 --- a/os/auth.c +++ b/os/auth.c @@ -48,7 +48,7 @@ from The Open Group. struct protocol { unsigned short name_length; -char*name; +const char *name; AuthAddCFunc Add;/* new authorization data */ AuthCheckFunc Check; /* verify client authorization data */ AuthRstCFunc Reset; /* delete all authorization data entries */ @@ -236,7 +236,7 @@ int AuthorizationFromID ( XID id, unsigned short *name_lenp, - char**namep, + const char **namep, unsigned short *data_lenp, char**datap) { -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 11/25] WriteToClient: preserve constness of buf while extracting length value
Fixes gcc warning: io.c: In function 'WriteToClient': io.c:826:6: warning: cast discards qualifiers from pointer target type Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- os/io.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/os/io.c b/os/io.c index 955bf8b..ebb8216 100644 --- a/os/io.c +++ b/os/io.c @@ -823,7 +823,7 @@ WriteToClient (ClientPtr who, int count, const void *__buf) CARD32 replylen; unsigned long bytesleft; - replylen = ((xGenericReply *)buf)-length; + replylen = ((const xGenericReply *)buf)-length; if (who-swapped) swapl(replylen); bytesleft = (replylen * 4) + SIZEOF(xReply) - count - padBytes; -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 10/25] OsInit: store /dev/null in a const char *
It's only passed as the input side of a strcpy and as the filename to fopen, so doesn't need to be non-const. Fixes gcc warning: osinit.c: In function 'OsInit': osinit.c:154:28: warning: initialization discards qualifiers from pointer target type Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- os/osinit.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/os/osinit.c b/os/osinit.c index acea682..ff3c45d 100644 --- a/os/osinit.c +++ b/os/osinit.c @@ -151,7 +151,7 @@ void OsInit(void) { static Bool been_here = FALSE; -static char* devnull = /dev/null; +static const char* devnull = /dev/null; char fname[PATH_MAX]; if (!been_here) { -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 07/25] os/access.c: replace acmp acopy macros with memcmp memcpy calls
No need to cast to char * now that all supported platforms use C89-standard void * argument types, so just drop the casts from acmp acopy macros, which clears the gcc warnings for places const pointers were cast non-const: access.c: In function 'DefineSelf': access.c:786:3: warning: cast discards qualifiers from pointer target type access.c:795:6: warning: cast discards qualifiers from pointer target type access.c: In function 'NewHost': access.c:1293:9: warning: cast discards qualifiers from pointer target type access.c:1298:6: warning: cast discards qualifiers from pointer target type access.c:1309:5: warning: cast discards qualifiers from pointer target type Without the casts, acmp acopy are just a funny way to write memcmp memmove, so drop the macros and inline the calls, taking care to swap the first two arguments to memmove since it had swapped them. Since all the calls to memmove end up being to non-overlapping memory (mostly copying from an existing pointer to a newly allocated one), replace those with memcpy. And finally, don't actually call memcpy to copy 0 bytes from one place to another, since that's just a waste of a perfectly good function call. Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- os/access.c | 30 ++ 1 files changed, 14 insertions(+), 16 deletions(-) diff --git a/os/access.c b/os/access.c index 0800c7f..b609442 100644 --- a/os/access.c +++ b/os/access.c @@ -176,12 +176,10 @@ SOFTWARE. Bool defeatAccessControl = FALSE; -#define acmp(a1, a2, len) memcmp((char *)(a1), (char *)(a2), len) -#define acopy(a1, a2, len) memmove((char *)(a2), (char *)(a1), len) #define addrEqual(fam, address, length, host) \ ((fam) == (host)-family \ (length) == (host)-len \ - !acmp (address, (host)-addr, length)) + !memcmp (address, (host)-addr, length)) static int ConvertAddr(struct sockaddr * /*saddr*/, int * /*len*/, @@ -371,13 +369,13 @@ DefineSelf (int fd) switch (hp-h_addrtype) { case AF_INET: inetaddr = (struct sockaddr_in *) ((saddr.sa)); - acopy ( hp-h_addr, (inetaddr-sin_addr), hp-h_length); + memcpy ( (inetaddr-sin_addr), hp-h_addr, hp-h_length); len = sizeof(saddr.sa); break; #if defined(IPv6) defined(AF_INET6) case AF_INET6: inet6addr = (struct sockaddr_in6 *) ((saddr.sa)); - acopy ( hp-h_addr, (inet6addr-sin6_addr), hp-h_length); + memcpy ( (inet6addr-sin6_addr), hp-h_addr, hp-h_length); len = sizeof(saddr.in6); break; #endif @@ -398,7 +396,7 @@ DefineSelf (int fd) { host-family = family; host-len = len; - acopy ( addr, host-addr, len); + memcpy ( host-addr, addr, len); host-next = selfhosts; selfhosts = host; } @@ -448,7 +446,7 @@ DefineLocalHost: { host-family = FamilyLocalHost; host-len = 0; - acopy(, host-addr, 0); + /* Nothing to store in host-addr */ host-next = selfhosts; selfhosts = host; } @@ -585,7 +583,7 @@ DefineSelf (int fd) { host-family = family; host-len = len; - acopy(addr, host-addr, len); + memcpy(host-addr, addr, len); host-next = selfhosts; selfhosts = host; } @@ -717,7 +715,7 @@ DefineSelf (int fd) if (host != NULL) { host-family = family; host-len = len; - acopy(addr, host-addr, len); + memcpy(host-addr, addr, len); host-next = selfhosts; selfhosts = host; } @@ -792,7 +790,7 @@ DefineSelf (int fd) { host-family = FamilyLocalHost; host-len = 0; - acopy(, host-addr, 0); + /* Nothing to store in host-addr */ host-next = selfhosts; selfhosts = host; } @@ -821,7 +819,7 @@ AugmentSelf(pointer from, int len) return; host-family = family; host-len = len; -acopy(addr, host-addr, len); +memcpy(host-addr, addr, len); host-next = selfhosts; selfhosts = host; } @@ -1306,7 +1304,7 @@ NewHost (int family, return FALSE; host-family = family; host-len = len; -acopy(addr, host-addr, len); +memcpy(host-addr, addr, len); host-next = validhosts; validhosts = host; return TRUE; @@ -1400,7 +1398,7 @@ GetHosts ( ((xHostEntry *)ptr)-family = host-family; ((xHostEntry *)ptr)-length = len; ptr += sizeof(xHostEntry); - acopy (host-addr, ptr, len); + memcpy (ptr, host-addr, len); ptr += pad_to_int32(len); } } else { @@ -1763,7
[PATCH 04/25] verify_internal_event: preserve constness of data pointer
All we're using it for is ErrorF calls, so make it a const char * to stop gcc from warning: inpututils.c: In function 'verify_internal_event': inpututils.c:629:9: warning: cast discards qualifiers from pointer target type Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- dix/inpututils.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dix/inpututils.c b/dix/inpututils.c index 60f9fa0..5e2ab87 100644 --- a/dix/inpututils.c +++ b/dix/inpututils.c @@ -626,7 +626,7 @@ void verify_internal_event(const InternalEvent *ev) if (ev ev-any.header != ET_Internal) { int i; -unsigned char *data = (unsigned char*)ev; +const unsigned char *data = (const unsigned char*)ev; ErrorF(dix: invalid event type %d\n, ev-any.header); -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 06/25] xres.c: Preserve constness of string returned by LookupResourceName
MakeAtom now accepts a const char * so we don't need to cast down to char * anymore. Fixes gcc warning of: xres.c: In function 'ProcXResQueryClientResources': xres.c:155:6: warning: cast discards qualifiers from pointer target type Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- Xext/xres.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Xext/xres.c b/Xext/xres.c index b952728..232fbab 100644 --- a/Xext/xres.c +++ b/Xext/xres.c @@ -147,12 +147,12 @@ ProcXResQueryClientResources (ClientPtr client) if(num_types) { xXResType scratch; - char *name; + const char *name; for(i = 0; i lastResourceType; i++) { if(!counts[i]) continue; - name = (char *)LookupResourceName(i + 1); + name = LookupResourceName(i + 1); if (strcmp(name, XREGISTRY_UNKNOWN)) scratch.resource_type = MakeAtom(name, strlen(name), TRUE); else { -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 02/25] Fix deconstifying cast warning in xi2_get_type
Since we're just comparing values in the struct, cast it to a const xGenericEvent * to clear gcc warning of: events.c: In function 'xi2_get_type': events.c:193:5: warning: cast discards qualifiers from pointer target type Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- dix/events.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dix/events.c b/dix/events.c index 59caa91..5c0f9dd 100644 --- a/dix/events.c +++ b/dix/events.c @@ -190,7 +190,7 @@ core_get_type(const xEvent *event) static inline int xi2_get_type(const xEvent *event) { -xGenericEvent* e = (xGenericEvent*)event; +const xGenericEvent* e = (const xGenericEvent*)event; return (e-type != GenericEvent || e-extension != IReqCode) ? 0 : e-evtype; } -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 12/25] LockServer: store path to LOCKDIR literal string in a const char *
And instead of initializing to NULL, then resetting to LOCKDIR almost immediately (before ever using the NULL value), skip directly to setting it to LOCKDIR. tmppath variable is only used as input for generating the path name via calls to strlen, sprintf, etc. Fixes gcc warning of: utils.c: In function 'LockServer': utils.c:259:11: warning: assignment discards qualifiers from pointer target type Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- os/utils.c |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/os/utils.c b/os/utils.c index b49fd32..6461ed5 100644 --- a/os/utils.c +++ b/os/utils.c @@ -248,16 +248,14 @@ LockServer(void) { char tmp[PATH_MAX], pid_str[12]; int lfd, i, haslock, l_pid, t; - char *tmppath = NULL; + const char *tmppath = LOCK_DIR; int len; char port[20]; if (nolock) return; /* * Path names */ - tmppath = LOCK_DIR; - snprintf(port, sizeof(port), %d, atoi(display)); len = strlen(LOCK_PREFIX) strlen(LOCK_TMP_PREFIX) ? strlen(LOCK_PREFIX) : strlen(LOCK_TMP_PREFIX); -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 13/25] xdmcp.c: fix three small const warnings
xdmcp.c:63:36: warning: initialization discards qualifiers from pointer target type xdmcp.c: In function 'XdmcpRegisterConnection': xdmcp.c:482:8: warning: cast discards qualifiers from pointer target type xdmcp.c:482:8: warning: cast discards qualifiers from pointer target type xdmcp.c:482:8: warning: cast discards qualifiers from pointer target type xdmcp.c: In function 'get_mcast_options': xdmcp.c:1596:21: warning: initialization discards qualifiers from pointer target type Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- os/xdmcp.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/os/xdmcp.c b/os/xdmcp.c index 4644071..77f02da 100644 --- a/os/xdmcp.c +++ b/os/xdmcp.c @@ -60,7 +60,7 @@ #define X_INCLUDE_NETDB_H #include X11/Xos_r.h -static char *defaultDisplayClass = COMPILEDDISPLAYCLASS; +static const char *defaultDisplayClass = COMPILEDDISPLAYCLASS; static int xdmcpSocket, sessionSocket; static xdmcp_statesstate; @@ -479,7 +479,7 @@ XdmcpRegisterConnection ( if (SOCKADDR_FAMILY(FromAddress) == AF_INET6) { fromAddr = ((struct sockaddr_in6 *)FromAddress)-sin6_addr; } else if ((SOCKADDR_FAMILY(FromAddress) == AF_INET) - IN6_IS_ADDR_V4MAPPED((struct in6_addr *) address)) { + IN6_IS_ADDR_V4MAPPED((const struct in6_addr *) address)) { fromAddr = ((struct sockaddr_in *)FromAddress)-sin_addr; regAddr = ((struct sockaddr_in6 *)address)-sin6_addr.s6_addr[12]; regAddrlen = sizeof(struct in_addr); @@ -1593,7 +1593,7 @@ get_fromaddr_by_name( static int get_mcast_options(int argc, char **argv, int i) { -char *address = XDM_DEFAULT_MCAST_ADDR6; +const char *address = XDM_DEFAULT_MCAST_ADDR6; int hopcount = 1; struct addrinfo hints; char portstr[6]; -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 14/25] CompareISOLatin1Lowered: constify arguments
Allows callers to avoid deconstifying arguments when calling, fixing gcc warning: filter.c: In function 'PictureGetFilterId': filter.c:59:2: warning: cast discards qualifiers from pointer target type Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- dix/dixutils.c |4 ++-- include/dix.h |4 ++-- render/filter.c |3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dix/dixutils.c b/dix/dixutils.c index 1e31346..00bbde6 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -167,8 +167,8 @@ ISOLatin1ToLower (unsigned char source) int -CompareISOLatin1Lowered(unsigned char *s1, int s1len, - unsigned char *s2, int s2len) +CompareISOLatin1Lowered(const unsigned char *s1, int s1len, + const unsigned char *s2, int s2len) { unsigned char c1, c2; diff --git a/include/dix.h b/include/dix.h index cfbfa1f..2d8d315 100644 --- a/include/dix.h +++ b/include/dix.h @@ -175,9 +175,9 @@ extern _X_HIDDEN Bool CreateConnectionBlock(void); /* dixutils.c */ extern _X_EXPORT int CompareISOLatin1Lowered( -unsigned char * /*a*/, +const unsigned char * /*a*/, int alen, -unsigned char * /*b*/, +const unsigned char * /*b*/, int blen); extern _X_EXPORT int dixLookupWindow( diff --git a/render/filter.c b/render/filter.c index 0cbd47b..c513ee8 100644 --- a/render/filter.c +++ b/render/filter.c @@ -56,7 +56,8 @@ PictureGetFilterId (const char *filter, int len, Bool makeit) if (len 0) len = strlen (filter); for (i = 0; i nfilterNames; i++) - if (!CompareISOLatin1Lowered ((unsigned char *) filterNames[i], -1, (unsigned char *) filter, len)) + if (!CompareISOLatin1Lowered ((const unsigned char *) filterNames[i], -1, + (const unsigned char *) filter, len)) return i; if (!makeit) return -1; -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 15/25] x86emu: constify debug strings
Strings are all pointers to literal constants, just used as input to printf calls when debugging is enabled. Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- hw/xfree86/x86emu/debug.c|4 ++-- hw/xfree86/x86emu/fpu.c | 16 hw/xfree86/x86emu/ops2.c |4 ++-- hw/xfree86/x86emu/x86emu/debug.h |4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/hw/xfree86/x86emu/debug.c b/hw/xfree86/x86emu/debug.c index 04d0741..6dea9c7 100644 --- a/hw/xfree86/x86emu/debug.c +++ b/hw/xfree86/x86emu/debug.c @@ -163,13 +163,13 @@ void x86emu_inc_decoded_inst_len (int x) M.x86.enc_pos += x; } -void x86emu_decode_printf (char *x) +void x86emu_decode_printf (const char *x) { sprintf(M.x86.decoded_buf+M.x86.enc_str_pos,%s,x); M.x86.enc_str_pos += strlen(x); } -void x86emu_decode_printf2 (char *x, int y) +void x86emu_decode_printf2 (const char *x, int y) { char temp[100]; snprintf(temp,sizeof(temp),x,y); diff --git a/hw/xfree86/x86emu/fpu.c b/hw/xfree86/x86emu/fpu.c index b72de1e..fbc602d 100644 --- a/hw/xfree86/x86emu/fpu.c +++ b/hw/xfree86/x86emu/fpu.c @@ -52,7 +52,7 @@ void x86emuOp_esc_coprocess_d8(u8 X86EMU_UNUSED(op1)) #ifdef DEBUG -static char *x86emu_fpu_op_d9_tab[] = { +static const char *x86emu_fpu_op_d9_tab[] = { FLD\tDWORD PTR , ESC_D9\t, FST\tDWORD PTR , FSTP\tDWORD PTR , FLDENV\t, FLDCW\t, FSTENV\t, FSTCW\t, @@ -63,7 +63,7 @@ static char *x86emu_fpu_op_d9_tab[] = { FLDENV\t, FLDCW\t, FSTENV\t, FSTCW\t, }; -static char *x86emu_fpu_op_d9_tab1[] = { +static const char *x86emu_fpu_op_d9_tab1[] = { FLD\t, FLD\t, FLD\t, FLD\t, FLD\t, FLD\t, FLD\t, FLD\t, @@ -299,7 +299,7 @@ void x86emuOp_esc_coprocess_d9(u8 X86EMU_UNUSED(op1)) #ifdef DEBUG -char *x86emu_fpu_op_da_tab[] = { +static const char *x86emu_fpu_op_da_tab[] = { FIADD\tDWORD PTR , FIMUL\tDWORD PTR , FICOM\tDWORD PTR , FICOMP\tDWORD PTR , FISUB\tDWORD PTR , FISUBR\tDWORD PTR , FIDIV\tDWORD PTR , @@ -392,7 +392,7 @@ void x86emuOp_esc_coprocess_da(u8 X86EMU_UNUSED(op1)) #ifdef DEBUG -char *x86emu_fpu_op_db_tab[] = { +static const char *x86emu_fpu_op_db_tab[] = { FILD\tDWORD PTR , ESC_DB\t19, FIST\tDWORD PTR , FISTP\tDWORD PTR , ESC_DB\t1C, FLD\tTBYTE PTR , ESC_DB\t1E, FSTP\tTBYTE PTR , @@ -513,7 +513,7 @@ void x86emuOp_esc_coprocess_db(u8 X86EMU_UNUSED(op1)) } #ifdef DEBUG -char *x86emu_fpu_op_dc_tab[] = { +static const char *x86emu_fpu_op_dc_tab[] = { FADD\tQWORD PTR , FMUL\tQWORD PTR , FCOM\tQWORD PTR , FCOMP\tQWORD PTR , FSUB\tQWORD PTR , FSUBR\tQWORD PTR , FDIV\tQWORD PTR , @@ -631,7 +631,7 @@ void x86emuOp_esc_coprocess_dc(u8 X86EMU_UNUSED(op1)) #ifdef DEBUG -static char *x86emu_fpu_op_dd_tab[] = { +static const char *x86emu_fpu_op_dd_tab[] = { FLD\tQWORD PTR , ESC_DD\t29,, FST\tQWORD PTR , FSTP\tQWORD PTR , FRSTOR\t, ESC_DD\t2D,, FSAVE\t, FSTSW\t, @@ -734,7 +734,7 @@ void x86emuOp_esc_coprocess_dd(u8 X86EMU_UNUSED(op1)) #ifdef DEBUG -static char *x86emu_fpu_op_de_tab[] = +static const char *x86emu_fpu_op_de_tab[] = { FIADD\tWORD PTR , FIMUL\tWORD PTR , FICOM\tWORD PTR , FICOMP\tWORD PTR , @@ -856,7 +856,7 @@ void x86emuOp_esc_coprocess_de(u8 X86EMU_UNUSED(op1)) #ifdef DEBUG -static char *x86emu_fpu_op_df_tab[] = { +static const char *x86emu_fpu_op_df_tab[] = { /* mod == 00 */ FILD\tWORD PTR , ESC_DF\t39\n, FIST\tWORD PTR , FISTP\tWORD PTR , FBLD\tTBYTE PTR , FILD\tQWORD PTR , FBSTP\tTBYTE PTR , diff --git a/hw/xfree86/x86emu/ops2.c b/hw/xfree86/x86emu/ops2.c index 39bd041..501d5fc 100644 --- a/hw/xfree86/x86emu/ops2.c +++ b/hw/xfree86/x86emu/ops2.c @@ -110,7 +110,7 @@ Handles opcode 0x0f,0x80-0x8F static void x86emuOp2_long_jump(u8 op2) { s32 target; -char *name = NULL; +const char *name = NULL; int cond = 0; /* conditional jump to word offset. */ @@ -204,7 +204,7 @@ static void x86emuOp2_set_byte(u8 op2) int mod, rl, rh; uint destoffset; u8 *destreg; -char *name = NULL; +const char *name = NULL; int cond = 0; START_OF_INSTR(); diff --git a/hw/xfree86/x86emu/x86emu/debug.h b/hw/xfree86/x86emu/x86emu/debug.h index 47aacb6..5f78d05 100644 --- a/hw/xfree86/x86emu/x86emu/debug.h +++ b/hw/xfree86/x86emu/x86emu/debug.h @@ -189,8 +189,8 @@ extern C {/* Use C linkage when in C++ mode */ #endif extern void x86emu_inc_decoded_inst_len (int x); -extern void x86emu_decode_printf (char *x); -extern void x86emu_decode_printf2 (char *x, int y); +extern void x86emu_decode_printf (const char *x); +extern void x86emu_decode_printf2 (const char *x, int y); extern void x86emu_just_disassemble (void); extern void x86emu_single_step (void); extern void x86emu_end_instr (void); -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives:
[PATCH 16/25] DoShowOptions: preserve constness of options list as we walk it
Since all we do with the option list is walk down the list printing the names, there's no need to cast away its constness. Clears gcc warning: xf86Configure.c: In function 'DoShowOptions': xf86Configure.c:781:4: warning: cast discards qualifiers from pointer target type Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- hw/xfree86/common/xf86Configure.c |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c index 24f367e..994d46f 100644 --- a/hw/xfree86/common/xf86Configure.c +++ b/hw/xfree86/common/xf86Configure.c @@ -778,7 +778,8 @@ void DoShowOptions (void) { free(vlist); for (i = 0; i xf86NumDrivers; i++) { if (xf86DriverList[i]-AvailableOptions) { - OptionInfoPtr pOption = (OptionInfoPtr)(*xf86DriverList[i]-AvailableOptions)(0,0); + const OptionInfoRec *pOption = + (*xf86DriverList[i]-AvailableOptions)(0,0); if (! pOption) { ErrorF ((EE) Couldn't read option table for %s driver\n, xf86DriverList[i]-driverName @@ -790,7 +791,7 @@ void DoShowOptions (void) { initData = LoaderSymbol (pSymbol); if (initData) { XF86ModuleVersionInfo *vers = initData-vers; - OptionInfoPtr p; + const OptionInfoRec *p; ErrorF (Driver[%d]:%s[%s] {\n, i,xf86DriverList[i]-driverName,vers-vendor ); -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 17/25] Convert KdDoSwitchCmd to use asprintf instead of malloc/strcat/etc.
Also fix the reason argument to be const char * to clear several gcc warnings of: kdrive.c:151:2: warning: passing argument 1 of 'KdDoSwitchCmd' discards qualifiers from pointer target type kdrive.c:116:1: note: expected 'char *' but argument is of type 'const char *' Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- hw/kdrive/src/kdrive.c | 13 - 1 files changed, 4 insertions(+), 9 deletions(-) diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c index 8dd039e..2c64940 100644 --- a/hw/kdrive/src/kdrive.c +++ b/hw/kdrive/src/kdrive.c @@ -113,19 +113,14 @@ KdDisableScreen (ScreenPtr pScreen) } static void -KdDoSwitchCmd (char *reason) +KdDoSwitchCmd (const char *reason) { if (kdSwitchCmd) { - char*command = malloc(strlen (kdSwitchCmd) + - 1 + - strlen (reason) + - 1); - if (!command) + char*command; + + if (asprintf(command, %s %s, kdSwitchCmd, reason) == -1) return; - strcpy (command, kdSwitchCmd); - strcat (command, ); - strcat (command, reason); system (command); free(command); } -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 18/25] KdParseFindNext: Constify delim argument
It's only used as input to strchr to find the delimiters, never written to. Clears a bunch of gcc warnings of the form: kdrive.c:323:2: warning: passing argument 2 of 'KdParseFindNext' discards qualifiers from pointer target type kdrive.c:261:1: note: expected 'char *' but argument is of type 'const char *' Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- hw/kdrive/src/kdrive.c |2 +- hw/kdrive/src/kdrive.h |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c index 2c64940..f6cc351 100644 --- a/hw/kdrive/src/kdrive.c +++ b/hw/kdrive/src/kdrive.c @@ -253,7 +253,7 @@ BoolkdDumbDriver; Bool kdSoftCursor; char * -KdParseFindNext (char *cur, char *delim, char *save, char *last) +KdParseFindNext (char *cur, const char *delim, char *save, char *last) { while (*cur !strchr (delim, *cur)) { diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h index 9ac5a19..be884ab 100644 --- a/hw/kdrive/src/kdrive.h +++ b/hw/kdrive/src/kdrive.h @@ -424,7 +424,7 @@ KdKeyboardInfo * KdParseKeyboard (char *arg); char * -KdParseFindNext (char *cur, char *delim, char *save, char *last); +KdParseFindNext (char *cur, const char *delim, char *save, char *last); void KdParseRgba (char *rgba); -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 21/25] Remove duplicate declaration of xf86ValidateModesFlags in xf86Modes.h
Clears gcc warning in every file that includes xf86Modes.h: xf86Modes.h:102:1: warning: redundant redeclaration of 'xf86ValidateModesFlags' xf86Modes.h:72:1: note: previous declaration of 'xf86ValidateModesFlags' was here Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- hw/xfree86/modes/xf86Modes.h |4 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/hw/xfree86/modes/xf86Modes.h b/hw/xfree86/modes/xf86Modes.h index c72a935..89ec0d8 100644 --- a/hw/xfree86/modes/xf86Modes.h +++ b/hw/xfree86/modes/xf86Modes.h @@ -99,10 +99,6 @@ extern _X_EXPORT DisplayModePtr xf86PruneDuplicateModes(DisplayModePtr modes); extern _X_EXPORT void -xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList, - int flags); - -extern _X_EXPORT void xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList); extern _X_EXPORT DisplayModePtr -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 22/25] Remove duplicate declarations of KdAdd*Driver in kdrive.h
Clears gcc warnings in every file that includes kdrive.h: kdrive.h:507:1: warning: redundant redeclaration of 'KdAddPointerDriver' kdrive.h:225:6: note: previous declaration of 'KdAddPointerDriver' was here kdrive.h:510:1: warning: redundant redeclaration of 'KdAddKeyboardDriver' kdrive.h:284:6: note: previous declaration of 'KdAddKeyboardDriver' was here Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- hw/kdrive/src/kdrive.h |6 -- 1 files changed, 0 insertions(+), 6 deletions(-) diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h index be884ab..cda965d 100644 --- a/hw/kdrive/src/kdrive.h +++ b/hw/kdrive/src/kdrive.h @@ -503,12 +503,6 @@ KdInitInput(void); void KdCloseInput(void); -void -KdAddPointerDriver(KdPointerDriver *); - -void -KdAddKeyboardDriver(KdKeyboardDriver *); - Bool KdRegisterFd (int fd, void (*read) (int fd, void *closure), void *closure); -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 25/25] xf86 parser: convert Error to a varargs macro to clear gcc format warnings
Previously it always passed a format string with exactly one argument, using NULL when the format string needed none. Now pass the right number of arguments to clear gcc warnings of 'too many arguments for format'. Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- hw/xfree86/parser/Configint.h |4 +- hw/xfree86/parser/DRI.c|4 +- hw/xfree86/parser/Device.c |4 +- hw/xfree86/parser/Extensions.c |2 +- hw/xfree86/parser/Files.c |2 +- hw/xfree86/parser/Flags.c |4 +- hw/xfree86/parser/Input.c |4 +- hw/xfree86/parser/InputClass.c |4 +- hw/xfree86/parser/Layout.c | 28 +++--- hw/xfree86/parser/Module.c |4 +- hw/xfree86/parser/Monitor.c| 84 hw/xfree86/parser/Pointer.c|8 ++-- hw/xfree86/parser/Screen.c | 36 hw/xfree86/parser/Vendor.c |6 +- hw/xfree86/parser/Video.c |6 +- 15 files changed, 100 insertions(+), 100 deletions(-) diff --git a/hw/xfree86/parser/Configint.h b/hw/xfree86/parser/Configint.h index 82d7de4..3f84ff0 100644 --- a/hw/xfree86/parser/Configint.h +++ b/hw/xfree86/parser/Configint.h @@ -119,8 +119,8 @@ else\ }\ } -#define Error(a,b) do { \ - xf86parseError (a, b); CLEANUP (ptr); return NULL; \ +#define Error(...) do { \ + xf86parseError (__VA_ARGS__); CLEANUP (ptr); return NULL; \ } while (0) /* diff --git a/hw/xfree86/parser/DRI.c b/hw/xfree86/parser/DRI.c index f51f6b9..77846da 100644 --- a/hw/xfree86/parser/DRI.c +++ b/hw/xfree86/parser/DRI.c @@ -64,7 +64,7 @@ xf86parseDRISection (void) else if (token == NUMBER) ptr-dri_group = val.num; else - Error (GROUP_MSG, NULL); + Error (GROUP_MSG); break; case MODE: if (xf86getSubToken ((ptr-dri_comment)) != NUMBER) @@ -74,7 +74,7 @@ xf86parseDRISection (void) ptr-dri_mode = val.num; break; case EOF_TOKEN: - Error (UNEXPECTED_EOF_MSG, NULL); + Error (UNEXPECTED_EOF_MSG); break; case COMMENT: ptr-dri_comment = xf86addComment(ptr-dri_comment, val.str); diff --git a/hw/xfree86/parser/Device.c b/hw/xfree86/parser/Device.c index d71abc6..d99dbf7 100644 --- a/hw/xfree86/parser/Device.c +++ b/hw/xfree86/parser/Device.c @@ -245,7 +245,7 @@ xf86parseDeviceSection (void) ptr-dev_screen = val.num; break; case EOF_TOKEN: - Error (UNEXPECTED_EOF_MSG, NULL); + Error (UNEXPECTED_EOF_MSG); break; default: Error (INVALID_KEYWORD_MSG, xf86tokenString ()); @@ -254,7 +254,7 @@ xf86parseDeviceSection (void) } if (!has_ident) - Error (NO_IDENT_MSG, NULL); + Error (NO_IDENT_MSG); #ifdef DEBUG printf (Device section parsed\n); diff --git a/hw/xfree86/parser/Extensions.c b/hw/xfree86/parser/Extensions.c index 4003b52..662f526 100644 --- a/hw/xfree86/parser/Extensions.c +++ b/hw/xfree86/parser/Extensions.c @@ -62,7 +62,7 @@ xf86parseExtensionsSection (void) ptr-ext_option_lst = xf86parseOption(ptr-ext_option_lst); break; case EOF_TOKEN: - Error (UNEXPECTED_EOF_MSG, NULL); + Error (UNEXPECTED_EOF_MSG); break; case COMMENT: ptr-extensions_comment = diff --git a/hw/xfree86/parser/Files.c b/hw/xfree86/parser/Files.c index 0c71835..a95be9e 100644 --- a/hw/xfree86/parser/Files.c +++ b/hw/xfree86/parser/Files.c @@ -162,7 +162,7 @@ xf86parseFilesSection (void) ptr-file_xkbdir = val.str; break; case EOF_TOKEN: - Error (UNEXPECTED_EOF_MSG, NULL); + Error (UNEXPECTED_EOF_MSG); break; case OBSOLETE_TOKEN: xf86parseError (OBSOLETE_MSG, xf86tokenString ()); diff --git a/hw/xfree86/parser/Flags.c b/hw/xfree86/parser/Flags.c index 87fd3ed..c2a0406 100644 --- a/hw/xfree86/parser/Flags.c +++ b/hw/xfree86/parser/Flags.c @@ -160,7 +160,7 @@ xf86parseFlagsSection (void) break; case EOF_TOKEN: - Error (UNEXPECTED_EOF_MSG, NULL); + Error (UNEXPECTED_EOF_MSG); break; default: Error (INVALID_KEYWORD_MSG, xf86tokenString ()); @@ -440,7 +440,7 @@ xf86parseOption(XF86OptionPtr head) int token; if ((token = xf86getSubToken(comment)) != STRING) { - xf86parseError(BAD_OPTION_MSG, NULL); +
[PATCH 19/25] XkbFindSrvLedInfo: remove extraneous name-clashing sli variable
Variable is already defined outside the outer if statement, and there's no need to redefine inside the if statement. No point in setting sli before if (dev-kbdfeed-xkb_sli==NULL) check - if check is true, we immediately set it, if check is false, we immediately return without further reference or use of it. The one thing we do with it inside the inner if statement is store an allocation in it for a brief moment before writing to the final destination, which is immediately returned to the caller. In short, there's no benefit to the variable at all in this block, it just gives the optimizer more code to figure out how to omit. Fixes gcc warning: xkbLEDs.c: In function 'XkbFindSrvLedInfo': xkbLEDs.c:683:19: warning: declaration of 'sli' shadows a previous local xkbLEDs.c:679:18: warning: shadowed declaration is here Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- xkb/xkbLEDs.c |6 ++ 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c index 515e9b7..24fcd3b 100644 --- a/xkb/xkbLEDs.c +++ b/xkb/xkbLEDs.c @@ -680,11 +680,9 @@ XkbSrvLedInfoPtr sli; /* optimization to check for most common case */ if (((class==XkbDfltXIClass)(id==XkbDfltXIId))(dev-kbdfeed)) { - XkbSrvLedInfoPtrsli; - sli= dev-kbdfeed-xkb_sli; if (dev-kbdfeed-xkb_sli==NULL) { - sli= XkbAllocSrvLedInfo(dev,dev-kbdfeed,NULL,needed_parts); - dev-kbdfeed-xkb_sli= sli; + dev-kbdfeed-xkb_sli= + XkbAllocSrvLedInfo(dev,dev-kbdfeed,NULL,needed_parts); } return dev-kbdfeed-xkb_sli; } -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 23/25] xf86Priv.h: Add some noreturn attributes suggested by gcc
Both functions call exit() at the end and have no other return path. Also correct comment/heading to reflect commit 6450f6ca7ee0 moving DoShowOptions into xf86Configure.c. Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- hw/xfree86/common/xf86Priv.h |6 ++ 1 files changed, 2 insertions(+), 4 deletions(-) This overlaps with, but does not logically conflict with, Daniel's [PATCH 21/31] XFree86: _X_UNEXPORT, so whoever lands second will have to merge. diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h index 8c69859..e0b1809 100644 --- a/hw/xfree86/common/xf86Priv.h +++ b/hw/xfree86/common/xf86Priv.h @@ -125,10 +125,8 @@ extern _X_EXPORT const DisplayModeRec xf86DefaultModes[]; extern _X_EXPORT const int xf86NumDefaultModes; /* xf86Configure.c */ -extern _X_EXPORT void DoConfigure(void); - -/* xf86ShowOpts.c */ -extern _X_EXPORT void DoShowOptions(void); +extern _X_EXPORT void DoConfigure(void) _X_NORETURN; +extern _X_EXPORT void DoShowOptions(void) _X_NORETURN; /* xf86Events.c */ -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [REMINDER libX11] XIM: Allow modifier releases in compose sequences (#26705)
could you please add a line or two how to test the function ? what does not work (what keys to press) what works after the patch ? If you put following in your .XCompose: Shift_R o : odiaeresis Shift_L : BackSpace you can enter ö by pressing and releasing the right Shift key, and then pressing o, and you can create a backspace by pressing and releasing the left Shift key. Note that not all programs handle non-symbol keysyms like BackSpace created from the compose mechanism, but emacs, for example, does. Regards, Andreas ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH inputproto multitouch] Touch IDs must be at least unique per master device
Hi, On 9 December 2011 21:43, Chase Douglas chase.doug...@canonical.com wrote: XIAllowEvents with a master device and a touch ID must uniquely identify a touch sequence. If touch IDs were unique per slave device, multiple slave devices could have valid sequences with the same touch ID, and the sequences may both be grabbed through the same master device grab. FWIW, this was deliberate, to avoid having to either keep a shared allocation space for touch IDs, or to have differing touch IDs between MD and SD delivery. The idea was that the client should maintain a sourceid:touchid tuple, rather than deviceid:touchid. I'm completely ambivalent on this change though, I don't think it makes any odds really. Cheers, Daniel ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH 00/25] Noise abatement and eyesore rehabilitation
For the series: Reviewed-by: Jamey Sharp ja...@minilop.net Nice work. :-) On Sun, Dec 11, 2011 at 10:16:13AM -0800, Alan Coopersmith wrote: Removes 422 lines of warning messages from the xserver build when using gcc 4.5.2 on Solaris 11 with the latest xorg-macros set of warning flags, and does not introduce any new warnings. There's still plenty more to fix after this batch of course. Alan Coopersmith (25): CheckForEmptyMask does not need to declare int n twice Fix deconstifying cast warning in xi2_get_type Use const cast in BitIsOn macro to avoid angering gcc verify_internal_event: preserve constness of data pointer constify strings in resource name registry xres.c: Preserve constness of string returned by LookupResourceName os/access.c: replace acmp acopy macros with memcmp memcpy calls Constify string for authorization protocol names Constify the reason string throughout the authorization check framework OsInit: store /dev/null in a const char * WriteToClient: preserve constness of buf while extracting length value LockServer: store path to LOCKDIR literal string in a const char * xdmcp.c: fix three small const warnings CompareISOLatin1Lowered: constify arguments x86emu: constify debug strings DoShowOptions: preserve constness of options list as we walk it Convert KdDoSwitchCmd to use asprintf instead of malloc/strcat/etc. KdParseFindNext: Constify delim argument XkbFindSrvLedInfo: remove extraneous name-clashing sli variable _XkbFilterDeviceBtn: move variable declarations to match usage scope Remove duplicate declaration of xf86ValidateModesFlags in xf86Modes.h Remove duplicate declarations of KdAdd*Driver in kdrive.h xf86Priv.h: Add some noreturn attributes suggested by gcc Add some printf format attributes suggested by gcc xf86 parser: convert Error to a varargs macro to clear gcc format warnings Xext/security.c |5 +- Xext/xres.c |4 +- dix/cursor.c |2 +- dix/dispatch.c|5 +- dix/dixutils.c|4 +- dix/events.c |2 +- dix/inpututils.c |2 +- dix/registry.c|5 +- dix/resource.c|2 +- hw/kdrive/src/kdrive.c| 15 ++ hw/kdrive/src/kdrive.h|8 +--- hw/xfree86/common/xf86.h |2 +- hw/xfree86/common/xf86Config.c|2 +- hw/xfree86/common/xf86Configure.c |5 +- hw/xfree86/common/xf86Priv.h |6 +-- hw/xfree86/common/xf86Xinput.h|2 +- hw/xfree86/modes/xf86Modes.h |4 -- hw/xfree86/parser/Configint.h |4 +- hw/xfree86/parser/DRI.c |4 +- hw/xfree86/parser/Device.c|4 +- hw/xfree86/parser/Extensions.c|2 +- hw/xfree86/parser/Files.c |2 +- hw/xfree86/parser/Flags.c |4 +- hw/xfree86/parser/Input.c |4 +- hw/xfree86/parser/InputClass.c|4 +- hw/xfree86/parser/Layout.c| 28 ++-- hw/xfree86/parser/Module.c|4 +- hw/xfree86/parser/Monitor.c | 84 ++-- hw/xfree86/parser/Pointer.c |8 ++-- hw/xfree86/parser/Screen.c| 36 hw/xfree86/parser/Vendor.c|6 +- hw/xfree86/parser/Video.c |6 +- hw/xfree86/parser/configProcs.h |4 +- hw/xfree86/x86emu/debug.c |4 +- hw/xfree86/x86emu/fpu.c | 16 hw/xfree86/x86emu/ops2.c |4 +- hw/xfree86/x86emu/x86emu/debug.h |4 +- include/dix.h |4 +- include/inputstr.h|2 +- include/os.h |6 +- include/registry.h|2 +- include/resource.h|2 +- os/access.c | 30 ++--- os/auth.c |6 +- os/connection.c |4 +- os/io.c |2 +- os/mitauth.c |2 +- os/osdep.h|2 +- os/osinit.c |2 +- os/rpcauth.c |2 +- os/utils.c|4 +- os/xdmauth.c |4 +- os/xdmcp.c|6 +- render/filter.c |3 +- xkb/xkbActions.c |9 ++-- xkb/xkbLEDs.c |6 +-- 56 files changed, 194 insertions(+), 211 deletions(-) -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel signature.asc Description: Digital signature ___ xorg-devel@lists.x.org: X.Org
Re: [PATCH 00/25] Noise abatement and eyesore rehabilitation
On Sun, Dec 11, 2011 at 10:16:13AM -0800, Alan Coopersmith wrote: Removes 422 lines of warning messages from the xserver build when using gcc 4.5.2 on Solaris 11 with the latest xorg-macros set of warning flags, and does not introduce any new warnings. Reviewed-by: Peter Hutterer peter.hutte...@who-t.net for the series Cheers, Peter There's still plenty more to fix after this batch of course. Alan Coopersmith (25): CheckForEmptyMask does not need to declare int n twice Fix deconstifying cast warning in xi2_get_type Use const cast in BitIsOn macro to avoid angering gcc verify_internal_event: preserve constness of data pointer constify strings in resource name registry xres.c: Preserve constness of string returned by LookupResourceName os/access.c: replace acmp acopy macros with memcmp memcpy calls Constify string for authorization protocol names Constify the reason string throughout the authorization check framework OsInit: store /dev/null in a const char * WriteToClient: preserve constness of buf while extracting length value LockServer: store path to LOCKDIR literal string in a const char * xdmcp.c: fix three small const warnings CompareISOLatin1Lowered: constify arguments x86emu: constify debug strings DoShowOptions: preserve constness of options list as we walk it Convert KdDoSwitchCmd to use asprintf instead of malloc/strcat/etc. KdParseFindNext: Constify delim argument XkbFindSrvLedInfo: remove extraneous name-clashing sli variable _XkbFilterDeviceBtn: move variable declarations to match usage scope Remove duplicate declaration of xf86ValidateModesFlags in xf86Modes.h Remove duplicate declarations of KdAdd*Driver in kdrive.h xf86Priv.h: Add some noreturn attributes suggested by gcc Add some printf format attributes suggested by gcc xf86 parser: convert Error to a varargs macro to clear gcc format warnings Xext/security.c |5 +- Xext/xres.c |4 +- dix/cursor.c |2 +- dix/dispatch.c|5 +- dix/dixutils.c|4 +- dix/events.c |2 +- dix/inpututils.c |2 +- dix/registry.c|5 +- dix/resource.c|2 +- hw/kdrive/src/kdrive.c| 15 ++ hw/kdrive/src/kdrive.h|8 +--- hw/xfree86/common/xf86.h |2 +- hw/xfree86/common/xf86Config.c|2 +- hw/xfree86/common/xf86Configure.c |5 +- hw/xfree86/common/xf86Priv.h |6 +-- hw/xfree86/common/xf86Xinput.h|2 +- hw/xfree86/modes/xf86Modes.h |4 -- hw/xfree86/parser/Configint.h |4 +- hw/xfree86/parser/DRI.c |4 +- hw/xfree86/parser/Device.c|4 +- hw/xfree86/parser/Extensions.c|2 +- hw/xfree86/parser/Files.c |2 +- hw/xfree86/parser/Flags.c |4 +- hw/xfree86/parser/Input.c |4 +- hw/xfree86/parser/InputClass.c|4 +- hw/xfree86/parser/Layout.c| 28 ++-- hw/xfree86/parser/Module.c|4 +- hw/xfree86/parser/Monitor.c | 84 ++-- hw/xfree86/parser/Pointer.c |8 ++-- hw/xfree86/parser/Screen.c| 36 hw/xfree86/parser/Vendor.c|6 +- hw/xfree86/parser/Video.c |6 +- hw/xfree86/parser/configProcs.h |4 +- hw/xfree86/x86emu/debug.c |4 +- hw/xfree86/x86emu/fpu.c | 16 hw/xfree86/x86emu/ops2.c |4 +- hw/xfree86/x86emu/x86emu/debug.h |4 +- include/dix.h |4 +- include/inputstr.h|2 +- include/os.h |6 +- include/registry.h|2 +- include/resource.h|2 +- os/access.c | 30 ++--- os/auth.c |6 +- os/connection.c |4 +- os/io.c |2 +- os/mitauth.c |2 +- os/osdep.h|2 +- os/osinit.c |2 +- os/rpcauth.c |2 +- os/utils.c|4 +- os/xdmauth.c |4 +- os/xdmcp.c|6 +- render/filter.c |3 +- xkb/xkbActions.c |9 ++-- xkb/xkbLEDs.c |6 +-- 56 files changed, 194 insertions(+), 211 deletions(-) -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel ___ xorg-devel@lists.x.org: X.Org development Archives:
Re: [REMINDER libX11] XIM: Allow modifier releases in compose sequences (#26705)
I put it though some successful tests and have pushed it as d3b3570592e9b9e57f270a0bd86762fd205a2833 and resolved the bz. Does patchwork need any update, too? -JimC -- James Cloos cl...@jhcloos.com OpenPGP: 1024D/ED7DAEA6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH inputproto multitouch] Remove XI2.1 and XI2.2 warnings and errors
This is too much of a pain, anyone who includes XI headers needs to define this. And that affects input and output drivers as well as legacy clients that don't even need the new stuff. Removing the need for defines would be enough but then the warnings clog up the output and hide real warnings. Just ditch them and laugh at those that use an experimental branch and expect it to work. Signed-off-by: Peter Hutterer peter.hutte...@who-t.net --- XI2.h | 10 -- 1 files changed, 0 insertions(+), 10 deletions(-) diff --git a/XI2.h b/XI2.h index 5a8afb7..4368006 100644 --- a/XI2.h +++ b/XI2.h @@ -25,16 +25,6 @@ #ifndef _XI2_H_ #define _XI2_H_ -#warning XI 2.1 is not stable yet. -#warning Applications relying on this header will break as the protocol sees updates. -#ifndef XINPUT2_1_USE_UNSTABLE_PROTOCOL -#error Define XINPUT2_1_USE_UNSTABLE_PROTOCOL to disable this error -#endif -#warning XI 2.2 is not stable yet. -#warning Applications relying on this header will break as the protocol sees updates. -#ifndef XINPUT2_2_USE_UNSTABLE_PROTOCOL -#error Define XINPUT2_2_USE_UNSTABLE_PROTOCOL to disable this error -#endif #define XInput_2_0 7 /* DO NOT ADD TO THIS LIST. These are libXi-specific defines. See commit libXi-1.4.2-21-ge8531dd */ -- 1.7.7.1 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH] Xtranssock.c: avoid buffer overrun in SocketReopen
This function was constructing an address from a port string allocating a buffer according to the size of the string but then later copying the address according to sizeof(struct sockaddr). This patch ensures that we allocate a struct sockaddr buffer with enough space for the port string to be copied into sa_data[] and uses that combined length to determine how much should be copied at the end of the function. This fixes a crash when using xwayland which uses ListenOnOpenFD() that will call _XSERVTransReopenCOTSServer() with a short port string like :1. Signed-off-by: Robert Bragg rob...@linux.intel.com --- Xtranssock.c | 14 -- 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Xtranssock.c b/Xtranssock.c index 66f9862..dfa41cf 100644 --- a/Xtranssock.c +++ b/Xtranssock.c @@ -458,6 +458,7 @@ TRANS(SocketReopen) (int i _X_UNUSED, int type, int fd, char *port) XtransConnInfo ciptr; int portlen; struct sockaddr *addr; +size_t addrlen; prmsg (3,SocketReopen(%d,%d,%s)\n, type, fd, port); @@ -488,26 +489,27 @@ TRANS(SocketReopen) (int i _X_UNUSED, int type, int fd, char *port) ciptr-fd = fd; -if ((addr = calloc (1, portlen + 2)) == NULL) { +addrlen = portlen + offsetof(struct sockaddr, sa_data); +if ((addr = calloc (1, addrlen)) == NULL) { prmsg (1, SocketReopen: malloc(addr) failed\n); free (ciptr); return NULL; } ciptr-addr = (char *) addr; -ciptr-addrlen = portlen + 2; +ciptr-addrlen = addrlen; -if ((ciptr-peeraddr = calloc (1, portlen + 2)) == NULL) { +if ((ciptr-peeraddr = calloc (1, addrlen)) == NULL) { prmsg (1, SocketReopen: malloc(portaddr) failed\n); free (addr); free (ciptr); return NULL; } -ciptr-peeraddrlen = portlen + 2; +ciptr-peeraddrlen = addrlen; /* Initialize ciptr structure as if it were a normally-opened unix socket */ ciptr-flags = TRANS_LOCAL | TRANS_NOUNLINK; #ifdef BSD44SOCKETS -addr-sa_len = portlen + 1; +addr-sa_len = addrlen; #endif addr-sa_family = AF_UNIX; #ifdef HAS_STRLCPY @@ -516,7 +518,7 @@ TRANS(SocketReopen) (int i _X_UNUSED, int type, int fd, char *port) strncpy(addr-sa_data, port, portlen); #endif ciptr-family = AF_UNIX; -memcpy(ciptr-peeraddr, ciptr-addr, sizeof(struct sockaddr)); +memcpy(ciptr-peeraddr, ciptr-addr, addrlen); ciptr-port = rindex(addr-sa_data, ':'); if (ciptr-port == NULL) { if (is_numeric(addr-sa_data)) { -- 1.7.7.3 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH:xf86-input-synaptics] Revert: eventcomm: replace synaptics-custom TEST_BIT with server's BitIsOn.
This commit reverts 13543b156d78bc4d01a19844a5ee8f283269621b As seen in Debian's #648488, this switch causes a regression on PowerPC, especially seen on iBook G4 with appletouch. Take a defensive stance and revert back to a working state until things have been figured out and fixed properly. Since things have evolved and since that revert triggers a lot of conflicts, the following method was applied: - manual reintroduction of the 3 removed macros: OFF, LONG, TEST_BIT - coccinelle semantic patch to revert from BitIsOn to TEST_BIT Coccinelle semantic patch: @@ expression a,b; @@ -BitIsOn(a,b) +TEST_BIT(b,a) Bugzilla: http://bugs.debian.org/648488 Bugzilla: http://bugs.freedesktop.org/43728 Signed-off-by: Cyril Brulebois k...@debian.org --- src/eventcomm.c | 43 +++ 1 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/eventcomm.c b/src/eventcomm.c index 9cabd14..4939958 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -47,6 +47,9 @@ #define LONG_BITS (sizeof(long) * 8) #define NBITS(x) (((x) + LONG_BITS - 1) / LONG_BITS) +#define OFF(x) ((x) % LONG_BITS) +#define LONG(x) ((x) / LONG_BITS) +#define TEST_BIT(bit, array) ((array[LONG(bit)] OFF(bit)) 1) /** * Protocol-specific data. @@ -119,16 +122,16 @@ event_query_is_touchpad(int fd, BOOL test_grab) SYSCALL(rc = ioctl(fd, EVIOCGBIT(0, sizeof(evbits)), evbits)); if (rc 0) goto unwind; -if (!BitIsOn(evbits, EV_SYN) || - !BitIsOn(evbits, EV_ABS) || - !BitIsOn(evbits, EV_KEY)) +if (!TEST_BIT(EV_SYN, evbits) || + !TEST_BIT(EV_ABS, evbits) || + !TEST_BIT(EV_KEY, evbits)) goto unwind; SYSCALL(rc = ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(absbits)), absbits)); if (rc 0) goto unwind; -if (!BitIsOn(absbits, ABS_X) || - !BitIsOn(absbits, ABS_Y)) +if (!TEST_BIT(ABS_X, absbits) || + !TEST_BIT(ABS_Y, absbits)) goto unwind; SYSCALL(rc = ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybits)), keybits)); @@ -136,12 +139,12 @@ event_query_is_touchpad(int fd, BOOL test_grab) goto unwind; /* we expect touchpad either report raw pressure or touches */ -if (!BitIsOn(absbits, ABS_PRESSURE) !BitIsOn(keybits, BTN_TOUCH)) +if (!TEST_BIT(ABS_PRESSURE, absbits) !TEST_BIT(BTN_TOUCH, keybits)) goto unwind; /* all Synaptics-like touchpad report BTN_TOOL_FINGER */ -if (!BitIsOn(keybits, BTN_TOOL_FINGER)) +if (!TEST_BIT(BTN_TOOL_FINGER, keybits)) goto unwind; -if (BitIsOn(keybits, BTN_TOOL_PEN)) +if (TEST_BIT(BTN_TOOL_PEN, keybits)) goto unwind;/* Don't match wacom tablets */ ret = TRUE; @@ -266,8 +269,8 @@ event_query_axis_ranges(InputInfoPtr pInfo) SYSCALL(rc = ioctl(pInfo-fd, EVIOCGBIT(EV_ABS, sizeof(absbits)), absbits)); if (rc = 0) { - priv-has_pressure = (BitIsOn(absbits, ABS_PRESSURE) != 0); - priv-has_width = (BitIsOn(absbits, ABS_TOOL_WIDTH) != 0); + priv-has_pressure = (TEST_BIT(ABS_PRESSURE, absbits) != 0); + priv-has_width = (TEST_BIT(ABS_TOOL_WIDTH, absbits) != 0); } else xf86IDrvMsg(pInfo, X_ERROR, failed to query ABS bits (%s)\n, strerror(errno)); @@ -284,16 +287,16 @@ event_query_axis_ranges(InputInfoPtr pInfo) SYSCALL(rc = ioctl(pInfo-fd, EVIOCGBIT(EV_KEY, sizeof(keybits)), keybits)); if (rc = 0) { - priv-has_left = (BitIsOn(keybits, BTN_LEFT) != 0); - priv-has_right = (BitIsOn(keybits, BTN_RIGHT) != 0); - priv-has_middle = (BitIsOn(keybits, BTN_MIDDLE) != 0); - priv-has_double = (BitIsOn(keybits, BTN_TOOL_DOUBLETAP) != 0); - priv-has_triple = (BitIsOn(keybits, BTN_TOOL_TRIPLETAP) != 0); - - if ((BitIsOn(keybits, BTN_0) != 0) || - (BitIsOn(keybits, BTN_1) != 0) || - (BitIsOn(keybits, BTN_2) != 0) || - (BitIsOn(keybits, BTN_3) != 0)) + priv-has_left = (TEST_BIT(BTN_LEFT, keybits) != 0); + priv-has_right = (TEST_BIT(BTN_RIGHT, keybits) != 0); + priv-has_middle = (TEST_BIT(BTN_MIDDLE, keybits) != 0); + priv-has_double = (TEST_BIT(BTN_TOOL_DOUBLETAP, keybits) != 0); + priv-has_triple = (TEST_BIT(BTN_TOOL_TRIPLETAP, keybits) != 0); + + if ((TEST_BIT(BTN_0, keybits) != 0) || + (TEST_BIT(BTN_1, keybits) != 0) || + (TEST_BIT(BTN_2, keybits) != 0) || + (TEST_BIT(BTN_3, keybits) != 0)) priv-has_scrollbuttons = 1; } -- 1.7.7.3 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH inputproto multitouch] Remove XI2.1 and XI2.2 warnings and errors
On 12/11/2011 04:26 PM, Peter Hutterer wrote: This is too much of a pain, anyone who includes XI headers needs to define this. And that affects input and output drivers as well as legacy clients that don't even need the new stuff. Removing the need for defines would be enough but then the warnings clog up the output and hide real warnings. Just ditch them and laugh at those that use an experimental branch and expect it to work. Signed-off-by: Peter Hutterer peter.hutte...@who-t.net The warnings are nice, but I agree that these macros are probably not the best mechanism. Reviewed-by: Chase Douglas chase.doug...@canonical.com ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH inputproto multitouch] Touch IDs must be at least unique per master device
On 12/11/2011 11:41 AM, Daniel Stone wrote: Hi, On 9 December 2011 21:43, Chase Douglas chase.doug...@canonical.com wrote: XIAllowEvents with a master device and a touch ID must uniquely identify a touch sequence. If touch IDs were unique per slave device, multiple slave devices could have valid sequences with the same touch ID, and the sequences may both be grabbed through the same master device grab. FWIW, this was deliberate, to avoid having to either keep a shared allocation space for touch IDs, or to have differing touch IDs between MD and SD delivery. The idea was that the client should maintain a sourceid:touchid tuple, rather than deviceid:touchid. I think when we made the decision way back, we weren't allowing XIAllowTouchEvents to be called on master devices. Now, XIAllowEvents (with touch grabs) can be called on both slave and master devices. Let's say you've got a touchscreen and an MT trackpad, both attached to the core master pointer. You start the server and touch both devices at the same time, yielding idential touch IDs of '1'. Both touches are grabbed by the same client on the root window using the master device. The client now wants to accept one and reject the other. If they both have the same touch ID, it's impossible to determine which touch the client is making a request for with the given protocol. -- Chase ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH inputproto multitouch] Touch IDs must be at least unique per master device
On 12/10/2011 07:04 PM, Peter Hutterer wrote: On Fri, Dec 09, 2011 at 01:43:44PM -0800, Chase Douglas wrote: From: Chase Douglas cndougla@cndougla.(none) XIAllowEvents with a master device and a touch ID must uniquely identify a touch sequence. If touch IDs were unique per slave device, multiple slave devices could have valid sequences with the same touch ID, and the sequences may both be grabbed through the same master device grab. Signed-off-by: Chase Douglas chase.doug...@canonical.com --- specs/XI2proto.txt |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/specs/XI2proto.txt b/specs/XI2proto.txt index c467bb1..d7b733b 100644 --- a/specs/XI2proto.txt +++ b/specs/XI2proto.txt @@ -2151,7 +2151,7 @@ Touch tracking IDs are provided in the detail field of touch events. Its value is always provided in every touch event. Tracking IDs are represented as unsigned 32-bit values and increase in value for each new touch, wrapping back to 0 upon reaching the numerical limit of IDs. IDs are -unique per each slave touch device. +unique per each master device. how about unique per device. that effectively (in the implementation) means unique for the master but there's nothing particularly wrong with having two SDs use the same ID if it's wrapped correctly (no, we won't write the code for that, it's easier with server-wide IDs) That feels ambiguous to me, but on irc you pointed out that per each master device is bad because it doesn't cover the floating slave device use case. The X.org implementation will use globally unique touch IDs because it's easiest. It covers up potential issues with floating vs slave devices, and transitions between attached and floating. Thus, rather than make the protocol hard to comprehend by covering all the potential corner cases, lets just make the IDs globally unique. I'll send around a second version of the patch for review. also, we should add a note that IDs are not guaranteed to be sequentially, touch IDs may skip ahead by a few. clients _should_ know that implicitly but better to spell it out I guess. It does seem a bit obvious, but I can send a patch out for this too. -- Chase ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH 09/21] Xi: split updating button count and state into helper functions
On 12/08/2011 07:36 PM, Peter Hutterer wrote: Functional change: for a button mapped to 0, the motionHintWindow is not updated to the NullWindow anymore. Before it got updated unconditionally to the button mapping. I have no idea what the practical effect of this is, but I guess it's closer to the correct behaviour: pressing a button that's logically disabled now does not disrupt the motion hint delivery. Signed-off-by: Peter Hutterer peter.hutte...@who-t.net --- Xi/exevents.c | 41 + 1 files changed, 29 insertions(+), 12 deletions(-) diff --git a/Xi/exevents.c b/Xi/exevents.c index 1140554..dab467c 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -726,6 +726,32 @@ UpdateDeviceMotionMask(DeviceIntPtr device, unsigned short state, SetMaskForEvent(device-id, mask, MotionNotify); } +static void +IncreaseButtonCount(DeviceIntPtr dev, int key, CARD8 *buttons_down, +Mask *motion_mask, unsigned short *state) +{ +if (dev-valuator) +dev-valuator-motionHintWindow = NullWindow; + +(*buttons_down)++; +*motion_mask = DeviceButtonMotionMask; +if (dev-button-map[key] = 5) +*state |= (Button1Mask 1) dev-button-map[key]; +} + +static void +DecreaseButtonCount(DeviceIntPtr dev, int key, CARD8 *buttons_down, +Mask *motion_mask, unsigned short *state) +{ +if (dev-valuator) +dev-valuator-motionHintWindow = NullWindow; + +if (*buttons_down = 1 !--(*buttons_down)) +*motion_mask = 0; +if (dev-button-map[key] = 5) +*state = ~((Button1Mask 1) dev-button-map[key]); +} + /** * Update the device state according to the data in the event. * @@ -831,15 +857,11 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event) return DONT_PROCESS; set_button_down(device, key, BUTTON_PROCESSED); - if (device-valuator) - device-valuator-motionHintWindow = NullWindow; + if (!b-map[key]) return DONT_PROCESS; -b-buttonsDown++; - b-motionMask = DeviceButtonMotionMask; -if (b-map[key] = 5) - b-state |= (Button1Mask 1) b-map[key]; +IncreaseButtonCount(device, key, b-buttonsDown, b-motionMask, b-state); UpdateDeviceMotionMask(device, b-state, b-motionMask); } else if (event-type == ET_ButtonRelease) { if (!b) @@ -867,15 +889,10 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event) } } set_button_up(device, key, BUTTON_PROCESSED); - if (device-valuator) - device-valuator-motionHintWindow = NullWindow; if (!b-map[key]) return DONT_PROCESS; -if (b-buttonsDown = 1 !--b-buttonsDown) - b-motionMask = 0; - if (b-map[key] = 5) - b-state = ~((Button1Mask 1) b-map[key]); +DecreaseButtonCount(device, key, b-buttonsDown, b-motionMask, b-state); UpdateDeviceMotionMask(device, b-state, b-motionMask); } else if (event-type == ET_ProximityIn) device-proximity-in_proximity = TRUE; Why not just pass a pointer to the button class instead of pointers to three fields of the button class? -- Chase ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH 18/21] dix: move delivery stop condition out of event mask
On 12/08/2011 07:36 PM, Peter Hutterer wrote: Previously, this was only called if there was a mask match, so even if we had a no-propagate flag set or a stopAt window specified, if no mask triggered on the window we would recurse up to the root window and eventually deliver. Move this, so that the stopAt and do-not-propagate mask is honoured. Signed-off-by: Peter Hutterer peter.hutte...@who-t.net --- dix/events.c | 11 ++- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dix/events.c b/dix/events.c index 9fcd447..05590e2 100644 --- a/dix/events.c +++ b/dix/events.c @@ -2693,12 +2693,13 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab, break; } -if ((deliveries 0) || (pWin == stopAt) || +} + +if ((deliveries 0) || (pWin == stopAt) || (mask EVENT_DONT_PROPAGATE_MASK)) This line ^^ needs to be de-indented as well. It will make the diff more comprehensible too :). With that change: Reviewed-by: Chase Douglas chase.doug...@canonical.com ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH 16/21] dix: move grab matching code into a helper function
On 12/08/2011 07:36 PM, Peter Hutterer wrote: No functional changes. Signed-off-by: Peter Hutterer peter.hutte...@who-t.net --- dix/events.c | 81 +++--- 1 files changed, 60 insertions(+), 21 deletions(-) diff --git a/dix/events.c b/dix/events.c index 4d80358..9fcd447 100644 --- a/dix/events.c +++ b/dix/events.c @@ -3751,6 +3751,62 @@ CoreGrabInterferes(DeviceIntPtr device, GrabPtr grab) return interfering; } +enum MatchFlags { +NO_MATCH= 0x0, +CORE_MATCH = 0x1, +XI_MATCH= 0x2, +XI2_MATCH = 0x4, +}; + +/** + * Match the grab against the temporary grab on the given input level. + * Modifies the temporary grab pointer. + * + * @param grab The grab to match against + * @param tmp The temporary grab to use for matching + * @param level The input level we want to match on + * @param event_type Wire protocol event type + * + * @return The respective matched flag or 0 for no match + */ +static enum MatchFlags +MatchForType(const GrabPtr grab, GrabPtr tmp, enum InputLevel level, int event_type) +{ +enum MatchFlags match; +BOOL ignore_device = FALSE; +int grabtype; +int evtype; + +switch(level) +{ +case XI2: +grabtype = GRABTYPE_XI2; +evtype = GetXI2Type(event_type); +BUG_WARN(!evtype); +match = XI2_MATCH; +break; +case XI: +grabtype = GRABTYPE_XI; +evtype = GetXIType(event_type); +match = XI_MATCH; +break; +case CORE: +grabtype = GRABTYPE_CORE; +evtype = GetCoreType(event_type); +match = CORE_MATCH; +ignore_device = TRUE; +break; +} + +tmp-grabtype = grabtype; +tmp-type = evtype; Why use two variables on the stack when you could just set tmp-grabtype and tmp-type directly in the switch statement? There aren't any functional issues with the code. As such, it's good enough for me: Reviewed-by: Chase Douglas chase.doug...@canonical.com ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH 06/21] dix: split grab event conversion and conversion into a helper function
Subject message ^^ is wrong. Should it be split into conversion and delivery? Otherwise, it looks fine: Reviewed-by: Chase Douglas chase.doug...@canonical.com On 12/08/2011 07:36 PM, Peter Hutterer wrote: Effective functional change: XI2 events are checked with XACE now. DeliverOneGrabbedEvent is exported for future use by touch events. Signed-off-by: Peter Hutterer peter.hutte...@who-t.net --- dix/events.c | 144 include/dix.h |5 ++ 2 files changed, 77 insertions(+), 72 deletions(-) diff --git a/dix/events.c b/dix/events.c index 705b079..37039c6 100644 --- a/dix/events.c +++ b/dix/events.c @@ -4061,6 +4061,75 @@ unwind: return; } + +int +DeliverOneGrabbedEvent(InternalEvent *event, DeviceIntPtr dev, enum InputLevel level) +{ +SpritePtr pSprite = dev-spriteInfo-sprite; +int rc; +xEvent *xE = NULL; +int count = 0; +int deliveries = 0; +Mask mask; +GrabInfoPtr grabinfo = dev-deviceGrab; +GrabPtr grab = grabinfo-grab; +Mask filter; + +switch(level) +{ +case XI2: +rc = EventToXI2(event, xE); +count = 1; +if (rc == Success) +{ +int evtype = xi2_get_type(xE); +mask = xi2mask_isset(grab-xi2mask, dev, evtype); +filter = 1; +} +break; +case XI: +if (grabinfo-fromPassiveGrab grabinfo-implicitGrab) +mask = grab-deviceMask; +else +mask = grab-eventMask; +rc = EventToXI(event, xE, count); +if (rc == Success) +filter = GetEventFilter(dev, xE); +break; +case CORE: +rc = EventToCore(event, xE, count); +mask = grab-eventMask; +if (rc == Success) +filter = GetEventFilter(dev, xE); +break; +default: +BUG_WARN_MSG(1, Invalid input level %d\n, level); +return 0; +} + +if (rc == Success) +{ +FixUpEventFromWindow(pSprite, xE, grab-window, None, TRUE); +if (XaceHook(XACE_SEND_ACCESS, 0, dev, +grab-window, xE, count) || +XaceHook(XACE_RECEIVE_ACCESS, rClient(grab), +grab-window, xE, count)) +deliveries = 1; /* don't send, but pretend we did */ +else if (level != CORE || !IsInterferingGrab(rClient(grab), dev, xE)) +{ +deliveries = TryClientEvents(rClient(grab), dev, +xE, count, mask, filter, +grab); +} +} else +BUG_WARN_MSG(rc != BadMatch, %s: conversion to mode %d failed on %d with %d\n, +dev-name, level, event-any.type, rc); + +free(xE); +return deliveries; +} + + /** * Deliver an event from a device that is currently grabbed. Uses * DeliverDeviceEvents() for further delivery if a ownerEvents is set on the @@ -4080,10 +4149,6 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev, DeviceIntPtr dev; SpritePtr pSprite = thisDev-spriteInfo-sprite; BOOL sendCore = FALSE; -int rc, count = 0; -xEvent *xi = NULL; -xEvent *xi2 = NULL; -xEvent *core = NULL; grabinfo = thisDev-deviceGrab; grab = grabinfo-grab; @@ -4119,88 +4184,27 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev, } if (!deliveries) { -Mask mask; - /* XXX: In theory, we could pass the internal events through to * everything and only convert just before hitting the wire. We can't * do that yet, so DGE is the last stop for internal events. From here * onwards, we deal with core/XI events. */ -mask = grab-eventMask; - sendCore = (IsMaster(thisDev) thisDev-coreEvents); /* try core event */ if (sendCore grab-grabtype == GRABTYPE_CORE) { -rc = EventToCore(event, core, count); -if (rc == Success) -{ -FixUpEventFromWindow(pSprite, core, grab-window, None, TRUE); -if (XaceHook(XACE_SEND_ACCESS, 0, thisDev, -grab-window, core, count) || -XaceHook(XACE_RECEIVE_ACCESS, rClient(grab), -grab-window, core, count)) -deliveries = 1; /* don't send, but pretend we did */ -else if (!IsInterferingGrab(rClient(grab), thisDev, core)) -{ -deliveries = TryClientEvents(rClient(grab), thisDev, -core, count, mask, -GetEventFilter(thisDev, core), -grab); -} -} else -
Re: [PATCH 08/21] Xi: deduplicate button motion mask setting
On 12/08/2011 07:36 PM, Peter Hutterer wrote: No functional changes Signed-off-by: Peter Hutterer peter.hutte...@who-t.net --- Xi/exevents.c | 37 + 1 files changed, 25 insertions(+), 12 deletions(-) diff --git a/Xi/exevents.c b/Xi/exevents.c index b2e82ec..1140554 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -704,6 +704,29 @@ ChangeMasterDeviceClasses(DeviceIntPtr device, DeviceChangedEvent *dce) } /** + * Add state and motionMask to the filter for this event. The protocol + * supports some extra masks for moton when a button is down: + * ButtonXMotionMask and the DeviceButtonMotionMask to trigger only when at + * least one button (or that specific button is down). These masks need to + * be added to the filters for core/XI motion events. I don't comprehend this comment ^^. Functionally this is fine though. I'll assume you can clean up the comment without further review. Reviewed-by: Chase Douglas chase.doug...@canonical.com ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH 00/21] Base cleanup patches for touch support
On 12/08/2011 07:36 PM, Peter Hutterer wrote: This is the last batch of cleanup patches I have in my tree before the MT patches start. Most of it is just shuffling code around so we can re-use it easier, but there are a few actual changes hidden in there as well. As far as I can tell, the functional changes *should* be no-ops in reality, or they add XACE hooks which are desirable anyways. The rest are code shufflings that help all around. Unless I replied and did not give a Reviewed-by tag, you can add my tag to the commit: Reviewed-by: Chase Douglas chase.doug...@canonical.com (I think patch 9 was the only patch that did not get a reviewed-by tag.) ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH 4/5] dix: switch EventIsDeliverable to take the event type only
On 12/09/2011 11:54 PM, Peter Hutterer wrote: Signed-off-by: Peter Hutterer peter.hutte...@who-t.net Reviewed-by: Chase Douglas chase.doug...@canonical.com ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH] dix: add a MAXEVENTS define for the number of core + extension events
On 12/10/2011 06:55 PM, Peter Hutterer wrote: Not including GenericEvents Signed-off-by: Peter Hutterer peter.hutte...@who-t.net Reviewed-by: Chase Douglas chase.doug...@canonical.com ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH 0/5] More cleanups for multitouch
On 12/09/2011 11:54 PM, Peter Hutterer wrote: Some more little cleanups, no functional changes to speak of. Patches 1, 2, and 3 are there because touch X and Y axes may not be 0 and 1. This was the case in initial implementations that defined a separate touch valuator class that could have different orderings of axes from the normal pointer valuator classes. However, we removed that from the input proto and now touch and pointer valuators are one in the same. Thus, touch X and Y valuators will also be 0 and 1. I don't think these three patches are needed. -- Chase ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel