summaryrefslogtreecommitdiff
path: root/dix
AgeCommit message (Collapse)AuthorFilesLines
2010-05-14Bugfix for "Pre-validate ChangeGC XIDs": off-by-one in loop index.Jamey Sharp1-1/+1
Signed-off-by: Jamey Sharp <jamey@minilop.net> Tested-by: Colin Harrison <colin.harrison@virgin.net>
2010-05-13Merge remote branch 'jamey/cleanups'Keith Packard10-441/+289
2010-05-13Eliminate boilerplate around client->noClientException.Jamey Sharp5-249/+139
Just let Dispatch() check for a noClientException, rather than making every single dispatch procedure take care of it. Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-05-13Quit using clientErrorValue in dix/colormap.c.Jamey Sharp3-34/+16
And that's it! No more clientErrorValue kludge. Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-13Quit using clientErrorValue in dix/gc.c.Jamey Sharp2-25/+33
Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-13Define GCAllBits as the union of all valid CreateGC masks.Jamey Sharp1-4/+4
Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-13Replace dixChangeGC with calls directly to the right variant.Jamey Sharp5-60/+39
Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-13Pre-validate ChangeGC XIDs.Jamey Sharp1-81/+64
In order to execute a wire-level ChangeGC request, we need to look up the resources named by any XIDs in the value-list. Various places in the server already have pointers to the resources they want to set into the GC, though, so over time the interface has evolved to accept either XIDs or pointers, with several different function call signatures used in different eras. This patch makes the existing code require pointers to resources rather than XIDs, and adds a simple wrapper that looks up any XIDs. The old dixChangeGC API is preserved by delegating to whichever implementation is appropriate. This affects error-handling: If any of the XIDs are invalid, then the GC is unchanged, and its ChangeGC callback is not invoked. This change is allowed by the protocol spec, which says, "The order in which components are verified and altered is server-dependent. If an error is generated, a subset of the components may have been altered." Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-13dixChangeGC callers: Use ChangeGCVal instead of XID almost everywhere.Jamey Sharp3-17/+23
The exceptions are ProcChangeGC and CreateGC. Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-13Remove devPrivates init and delete callback lists.Keith Packard1-40/+0
XSELinux was the only consumer of these interfaces and it no longer needs them. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
2010-05-12CreateGC: Pass current client on to ChangeGC.Jamey Sharp1-1/+1
Otherwise we can't check that the XIDs this GC is being initialized with are accessible to this client. Signed-off-by: Jamey Sharp <jamey@minilop.net> Cc: Eamon Walsh <ewalsh@tycho.nsa.gov> Reviewed-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2010-05-12Kill ChangeGC in favor of dixChangeGC.Jamey Sharp3-17/+8
This doesn't change any behavior, but it isn't clear whether NullClient is correct in all cases. As ajax says, > For most of these changes, I think it's correct to use NullClient, > since they are server-initiated changes and should not fail for (eg) > xace reasons. ... At any rate, you're certainly not changing any > semantics by leaving them all as NullClient, so this patch can't be > more wrong than before. The call in CreateGC is particularly questionable. Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Adam Jackson <ajax@redhat.com>
2010-05-12Kill DoChangeGC in favor of dixChangeGC.Jamey Sharp1-43/+3
This doesn't change any behavior, but it isn't clear whether NullClient is correct in all cases. As ajax says, > For most of these changes, I think it's correct to use NullClient, > since they are server-initiated changes and should not fail for (eg) > xace reasons. ... At any rate, you're certainly not changing any > semantics by leaving them all as NullClient, so this patch can't be > more wrong than before. Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-12doPolyText needs UseAccess to each font, not ReadAccess.Jamey Sharp1-1/+1
In commit 42d6112ec21949a336ee8b34469f2695273ee2d6, Eamon changed dixChangeGC to require DixUseAccess on any GCFont XID. I think doPolyText needs to require the same level of access. Otherwise dixChangeGC could fail when it does the same lookup, which doPolyText doesn't check for. Signed-off-by: Jamey Sharp <jamey@minilop.net> Cc: Eamon Walsh <ewalsh@tycho.nsa.gov> Reviewed-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2010-05-12Merge remote branch 'dottedmag/for-keithp'Keith Packard1-18/+24
2010-05-13Misc coding style cleanupMikhail Gusarov1-4/+4
Use a[b] instead of *(a+b), fix whitespace. Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-13Remove useless castsMikhail Gusarov1-12/+13
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-13Fix code style: extra whitespace before ()Mikhail Gusarov1-1/+1
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-13Fix warning: it's safe to pass atom strings > XA_LAST_PREDEFINED to free(3)Mikhail Gusarov1-2/+7
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-12SetFontPath: set client->errorValue on failure.Jamey Sharp2-9/+5
Previously the callers were only setting errorValue on Success, when it's ignored, and leaving it alone on failure, when it's sent to the client. Since SetFontPath takes the ClientPtr, let it set client->errorValue instead of letting the callers continue to get it wrong. Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-13Use lowercase variant of XNFalloc and XstrdupMikhail Gusarov1-1/+1
Using one variant of function/macro makes it easier to fix the code later. Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-13Replace X-allocation functions with their C89 counterpartsMikhail Gusarov25-447/+447
The only remaining X-functions used in server are XNF*, the rest is converted to plain alloc/calloc/realloc/free/strdup. X* functions are still exported from server and x* macros are still defined in header file, so both ABI and API are not affected by this change. Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-11dix: Update element count in FreeResource*()Kristian Høgsberg1-1/+9
FreeResource() keeps clientTable[cid].elements up to date with the number of resources allocated to the client. The other free resource functions (FreeResourceByType(), FreeClientNeverRetainResources() and FreeClientResources()) don't maintain this invariant. Typically, the only consequence is that the element count is too high and we end up allocating the hash table bigger than necessary. However, FreeResource() also relies on the element count to restart the search if the list of resources has been changed during a resource destruction callback. Since FreeResourceByType() doesn't update the count, if we call that from a resource destruction callback from FreeResource(), the loop isn't restarted and we end up following an invalid next pointer. Furthermore, LookupClientResourceComplex() and FreeClientNeverRetainResources() don't use the element count to detect if a callback deleted a resource and may end up following an invalid next pointer if the resource system is called into recursively. Signed-off-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-10Simplify error-handling in dixChangeGC.Jamey Sharp1-71/+46
Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-07Introduce dixLookupFontable for "FONT or GC" parameters.Jamey Sharp2-22/+22
Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Julien Cristau <jcristau@debian.org> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-03Fix cursor ref counting mistakes with sprites and xf86Cursor.cKeith Packard2-5/+17
A few cursor value assignments weren't getting correctly ref counted, causing leaks of cursor objects. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-02dix: wrap variables with #ifdef when panoramix is not usedTiago Vignatti2-3/+2
this shut up some warnings. Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-04-30Replace some input devPrivates with regular struct fieldsKeith Packard3-51/+17
In the process, fixes a memory leak in CloseDevice, and an unchecked memory allocation in InitializePredictableAccelerationProperties. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
2010-04-30Merge remote branch 'vignatti/for-keith'Keith Packard1-1/+0
2010-04-26Merge remote branch 'jamey/for-keith'Keith Packard1-1/+0
2010-04-26dix: Default DPMS timeout values to match screensaver valuesAdam Jackson1-3/+1
These have the same default, but if you specify something different with -s on the command line, only the screensaver time is changed. As DPMS is usually what's desired, change it to match. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-04-26ProcGrabButton: remove redundant error check.Jamey Sharp1-1/+0
If dixLookupResourceByType did not return Success, it will have set the pointer to NULL, so the second if will always be true. Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2010-04-26dix and others: remove unused arraySize field from ScreenInfoTiago Vignatti1-1/+0
Bizarre. This seems to never be used before. I left the field in ScreenInfo, with another name. So, stop looking at it. Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
2010-04-15Merge remote branch 'whot/for-keith'Keith Packard1-1/+5
2010-04-16dix: fix cursor screen check for xinerama setups.Tim Yamin1-1/+5
The de-duplication of CheckPhysLimits 942eae6868b8b0f343b6a added a condition that is invalid for a Xinerama setup. pScreen is invalid for the Xinerama case, so comparing it to anything is a bad idea. Signed-off-by: Tim Yamin <plasm@roo.me.uk> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-04-15dix: Fix crash in DeliverGrabbedEvents.Peter Hutterer1-1/+1
If both devices are synchronously grabbed, first with a GrabPointer, then with a GrabKeyboard (GrabModeSync on both), sync.other of each device points to the grab of the respective other device. If the keyboard is then thawed through a AllowSome request, the VCK's sync.other is reset to NULL. Subsequently, an event on the VCP would crash the server when dereferencing sync.other on the VCP. The check's purpose is to compare if the other device is grabbed by the same client, which should be checked by accessing (dev->deviceGrab->grab->resource). A check of the server-1.3 sources confirms that. XTS test case: Xlib13 XAllowEvents 20. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-04-07dix: be more verbose when we run out of opcodesPaulo Ricardo Zanoni1-1/+4
If we run out of opcodes, nothing is print on the log, making the problem hard to debug. In the current Xserver, if you enable some extensions like multibuffer (+2 events) and use nvidia binary driver (+5 events) you can run out of opcode numbers. Signed-off-by: Paulo Ricardo Zanoni <pzanoni@mandriva.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-03-22New header for XF86Bigfont server functionsYaakov Selkowitz1-2/+1
Xext/xf86bigfont.c contains three non-static functions which are called elsewhere in the server. This creates a new header containing these declarations in order to fix several warnings: xf86bigfont.c:285: warning: no previous prototype for `XF86BigfontFreeFontShm' dixfonts.c:502: warning: implicit declaration of function `XF86BigfontFreeFontS$ dixfonts.c:502: warning: nested extern declaration of `XF86BigfontFreeFontShm' log.c:436: warning: implicit declaration of function `XF86BigfontCleanup' log.c:436: warning: nested extern declaration of `XF86BigfontCleanup' Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net> Reviewed-by: Julien Cristau <jcristau@debian.org>
2010-03-21Merge commit 'fa5103a02bd509e4a102afdad2ab26cb22210367'Keith Packard1-0/+3
2010-03-21dix: if owner-events is true for passive grabs, add the window mask (#25400)Peter Hutterer1-0/+36
A client requesting a GrabModeSync button grab, owner-events true, with only the ButtonRelease mask set would never receive the press event even if the grab window had the ButtonPress mask set. The protocol requires that if owner-events is true, then the delivery mask is the combination of the grab mask + the window event mask. X.Org Bug 25400 <http://bugs.freedesktop.org/show_bug.cgi?id=25400> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Tested-by: Jim Ramsay <i.am@jimramsay.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-03-16Cygwin/X: Tidy up some cosmetic issues in log stringsJon TURNEY1-1/+1
Tidy up some cosmetic issues in log strings: - Add missing '\n' - Fix some strings starting with '\n' - Remove '\f' from some log strings These all just look daft in a log with timestamps. Also clarify log message about screen origin coordinates Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2010-03-16Add a ConfigNotify hook.Francisco Jerez1-0/+3
Executed from the ConfigureWindow request, right before sending ConfigureNotify to the clients. This commit breaks the ScreenRec ABI. Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2010-03-12Record: Avoid duplicates from replaying frozen eventsDaniel Stone1-27/+1
Reintroduce a check which used to be there in the old ProcessKeyboardEvent/ProcessPointerEvent codepath, which avoids us recording events subject to a grab twice: once when it's first processed in EnqueueEvent, and then again when it's thawed and being replayed. This required a tiny amount of code motion to expose syncEvents. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-03-11Revert "dix: Use DeliverGrabbedEvent for implicit passive grabs (#25400)"Peter Hutterer1-1/+62
Several users have pointed out that this commit introduces regressions, most notably perhaps fluxbox which essentially stops working after a few clicks. This reverts commit cf72b5437d2d620521279077a29c5df6d0fbb576. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-03-10dix: Clip only into axis ranges if we're in absolute mode. (#26543)Peter Hutterer1-2/+3
An absolute device in relative mode may provide valuators outside of the axis range. Clipping back into the range prevents screen crossings in a multi-screen (Xinerama) setup as the required screen edge for crossing is never met: miPointerSetPosition crosses the screen conditional to the X coordinate being equal to the screen width or _less than_ 0. While the former can be met when clipping into the coordinate range and scaling, the latter cannot, resulting in a mouse pointer that gets stuck on the rightmost screen. This patch only applies axis clipping for valuators in mode Absolute. If relative, we allow the values to get above/below the axis ranges. Doesn't matter, miPointerSetPosition will reset the values to the allowed range even if no screen was crossed. This leads to interesting values provided to clients, the valuator range of the device resets once a screen is crossed and essentially reflects the position of the cursor on the screen - scaled into the valuator range. The values themselves are valid given the range though. In theory, the XI1 specs require that a relative device has a min/max range of 0/0. This doesn't really go well with devices that actually can switch mode between relative and absolute since they would have to reset their axis range when switching. If multiple XI clients are in use, we have no method of notifying them about the changes, so other clients may continue to use the wrong axis ranges (note: XI1 wasn't really designed to have multiple clients use a device). Expecting all relative devices to have this min/max of 0 is unrealistic at this point. So pick what is possibly the lesser of all evils, pass the beer and despair. X.Org Bug 26543 <http://bugs.freedesktop.org/show_bug.cgi?id=26543> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-03-03dix: Use DeliverGrabbedEvent for implicit passive grabs (#25400)Peter Hutterer1-62/+1
A client requesting a GrabModeSync button grab, owner-events true, with only the ButtonRelease mask set would never receive the press event even if the grab window had the ButtonPress mask set. The protocol requires that if owner-events is true, then the delivery mask is the combination of the grab mask + the window event mask. DeliverGrabbedEvents does this already for us, checking first the delivery based on owner_events and then based on the grab mask. AFAICT, the device cannot enter the states FREEZE_BOTH_NEXT_EVENT or FREEZE_NEXT_EVENT that would be handled by DGE in any possible path here. Bonus point - CheckPassiveGrabsOnWindows suddenly becomes a lot lesss complicated. X.Org Bug 25400 <http://bugs.freedesktop.org/show_bug.cgi?id=25400> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-02-24Merge remote branch 'whot/for-keith'Keith Packard2-13/+0
2010-02-23dix: try to ring the bell even if the current device doesn't have one. (#24503)Peter Hutterer1-8/+0
Evdev devices do not have the bell proc set, but XTEST devices do. By exiting early, the bell only rings if the last keyboard used was the XTEST keyboard and hence the bell proc is still set on the master but not if an evdev keyboard was used last. The better approach here is to try to ring the bell on all devices attached to this master device in case one or more actually do produce an audible sound. That's also XKB's behaviour if XkbUseCoreKbd is specified as device identifier. X.Org Bug 24503 <http://bugs.freedesktop.org/show_bug.cgi?id=24503> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Adam Jackson <ajax@redhat.com>
2010-02-23dix: remove now-erroneous comment about frozen slave devices.Peter Hutterer1-5/+0
A direct grab on a slave device through XI2 detaches it, regardless of whether the grab is sync or async. So this comment doesn't apply to XI2 anyway. For XI1, aside from your life being miserable already, it doesn't matter as XI1 does not have a concept of attachment. You can freeze a device and if you don't freeze _all_ other devices at the same time, the master device can still happily send events to the client. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Adam Jackson <ajax@redhat.com>
2010-02-22Don't print a failure message when XACE denies an input event delivery.Eamon Walsh1-25/+25
A denial is normal and the behavior should be to drop the event. Having the log message creates excessive log spam. Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov> Reviewed-by: Keith Packard <keithp@keithp.com>