summaryrefslogtreecommitdiff
path: root/dix/cursor.c
AgeCommit message (Collapse)AuthorFilesLines
2016-07-15dix: Work around non-premultiplied ARGB cursor dataMichel Dänzer1-0/+23
Some games incorrectly use non-premultiplied ARGB cursor data, presumably because that's what Windows uses. On some hardware (and with SWcursor), this breaks areas of the cursor which are supposed to be transparent (and presumably also translucent areas, but that's less noticeable). This change checks for pixels with alpha == 0 and any non-alpha component != 0. If any such pixel is found, the data is assumed to be non-premultiplied and fixed up by multiplying the RGB components with the alpha component. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92309 Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-06-30cursor: drop ARGB_CURSORDave Airlie1-8/+0
I doubt anyone builds with this turned off or has done for a long time. It helps my eyes bleed slightly less when reading the code, I've left the define in place as some drivers use it. Reviewed-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-11-12Drop trailing whitespacesPeter Hutterer1-4/+4
sed -i "s/[ ]\+$//g" **/*.(c|h) happy reviewing... git diff -w is an empty diff. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-01-12Replace 'pointer' type with 'void *'Keith Packard1-5/+5
This lets us stop using the 'pointer' typedef in Xdefs.h as 'pointer' is used throughout the X server for other things, and having duplicate names generates compiler warnings. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2013-09-10dix: FIXES is not optionalAdam Jackson1-6/+0
It's already not optional at configure time, this just makes it so at build time too. Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-05-26dix: remove logspam in RefCursor()Peter Hutterer1-5/+1
This shouldn't have been in the patch Reported-by: Colin Harrison <colin.harrison@virgin.net> 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>
2013-05-15Abstract cursor refcountingPeter Hutterer1-1/+32
Too many callers relied on the refcnt being handled correctly. Use a simple wrapper to handle that case. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-03-21Introduce a consistent coding styleKeith Packard1-213/+181
This is strictly the application of the script 'x-indent-all.sh' from util/modular. Compared to the patch that Daniel posted in January, I've added a few indent flags: -bap -psl -T PrivatePtr -T pmWait -T _XFUNCPROTOBEGIN -T _XFUNCPROTOEND -T _X_EXPORT The typedefs were needed to make the output of sdksyms.sh match the previous output, otherwise, the code is formatted badly enough that sdksyms.sh generates incorrect output. The generated code was compared with the previous version and found to be essentially identical -- "assert" line numbers and BUILD_TIME were the only differences found. The comparison was done with this script: dir1=$1 dir2=$2 for dir in $dir1 $dir2; do (cd $dir && find . -name '*.o' | while read file; do dir=`dirname $file` base=`basename $file .o` dump=$dir/$base.dump objdump -d $file > $dump done) done find $dir1 -name '*.dump' | while read dump; do otherdump=`echo $dump | sed "s;$dir1;$dir2;"` diff -u $dump $otherdump done Signed-off-by: Keith Packard <keithp@keithp.com> Acked-by: Daniel Stone <daniel@fooishbar.org> Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-12-12CheckForEmptyMask does not need to declare int n twiceAlan Coopersmith1-1/+1
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.coopersmith@oracle.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-19Eliminate MAXSCREENS-sized CursorScreenKey array.Jamey Sharp1-1/+1
Use new per-screen privates API instead. Commit by Jamey Sharp and Josh Triplett. Signed-off-by: Jamey Sharp <jamey@minilop.net> Signed-off-by: Josh Triplett <josh@joshtriplett.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-04-07dix: don't free stranger pointers inside AllocARGBCursorTiago Vignatti1-4/+1
This seems a good convention to follow: if pointers are allocate outside a given function, then free there as well when a failure occurs. AllocARGBCursor and its callers were mixing up the freeing of resources and causing a particular double free inside TileScreenSaver (srcbits and mskbits). Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> Reviewed-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>
2010-06-10Remove unnecessary parentheses around return values in functionsMikhail Gusarov1-2/+2
This patch was generated by the following Perl code: perl -i -pe 's/([^_])return\s*\(\s*([^(]+?)\s*\)s*;(\s+(\n))?/$1return $2;$4/g;' Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-05Change the devPrivates API to require dixRegisterPrivateKeyKeith Packard1-16/+19
This patch only changes the API, not the implementation of the devPrivates infrastructure. This will permit a new devPrivates implementation to be layed into the server without requiring simultaneous changes in every devPrivates user. Signed-off-by: Keith Packard <keithp@keithp.com> Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com>
2010-05-19Return an appropriately-typed error from dixLookupResourceByType.Jamey Sharp1-2/+2
Rather than always returning BadValue, associate an error status like BadWindow with a resource type like RT_WINDOW, and return the appropriate one for the requested type. This patch only touches the core protocol resource types. Others still return BadValue and need to be mapped appropriately. dixLookupResourceByType can now return BadImplementation, if the caller asked for a resource type that has not been allocated in the server. Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Adam Jackson <ajax@redhat.com>
2010-05-13Replace X-allocation functions with their C89 counterpartsMikhail Gusarov1-21/+21
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-01-27dix/configure: remove null root cursor optionTiago Vignatti1-17/+0
The default behavior of the server is to start with an invisible root cursor. Be such cursor invisible or inexistent (null), in the end it doesn't matter - for the user. The content on screen will be the same. Besides, there's no difference, in terms of performance, whether such cursor is invisible or simply null. The paths that both take inside the server are roughly the same. Therefore create a null root cursor becomes irrelevant. Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> Acked-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-01-25dix: move cursor realize code to its own functionTiago Vignatti1-118/+85
The semantic remains, only code was moved: reuse chunk of code to realize cursor on both AllocARGBCursor and AllocGlyphCursor. Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2009-11-04dix: Fixes a memory leak when a cursor resource is released.Rami Ylimaki1-1/+2
Just open and close a client that creates cursors in order to reproduce. In the problem case bits->refcnt is -1 and therefore bits->devPrivates is never released. Signed-off-by: Rami Ylimaki <ext-rami.ylimaki@nokia.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2009-04-29Fix most remaining deprecated resource lookups.Eamon Walsh1-2/+3
Callsites updated to use dixLookupResourceBy{Type,Class}. TODO: Audit access modes to make sure they reflect the usage.
2009-03-09Replace dixLookupResource by dixLookupResourceBy{Type,Class}Keith Packard1-4/+4
dixLookupResource attempted to automatically detect whether the caller wanted a lookup by-type or by-class, unfortunately, it guessed wrong for RT_NONE. Instead of trying to make the guess better, this patch just reverts the unification and creates separate functions for each operation.
2009-01-22Remove a bunch of useless casts.Adam Jackson1-2/+2
We've had void * for twenty years now people let's try to act like we know how it works.
2008-12-03Rework symbol visibility for easier maintenancePaulo Cesar Pereira de Andrade1-4/+4
Save in a few special cases, _X_EXPORT should not be used in C source files. Instead, it should be used in headers, and the proper C source include that header. Some special cases are symbols that need to be shared between modules, but not expected to be used by external drivers, and symbols that are accessible via LoaderSymbol/dlopen. This patch also adds conditionally some new sdk header files, depending on extensions enabled. These files were added to match pattern for other extensions/modules, that is, have the headers "deciding" symbol visibility in the sdk. These headers are: o Xext/panoramiXsrv.h, Xext/panoramiX.h o fbpict.h (unconditionally) o vidmodeproc.h o mioverlay.h (unconditionally, used only by xaa) o xfixes.h (unconditionally, symbols required by dri2) LoaderSymbol and similar functions now don't have different prototypes, in loaderProcs.h and xf86Module.h, so that both headers can be included, without the need of defining IN_LOADER. xf86NewInputDevice() device prototype readded to xf86Xinput.h, but not exported (and with a comment about it).
2008-11-29Export symbols defined in the sdk.Paulo Cesar Pereira de Andrade1-3/+3
This is the biggest "visibility" patch. Instead of doing a "export" symbol on demand, export everything in the sdk, so that if some module fails due to an unresolved symbol, it is because it is using a symbol not in the sdk. Most exported symbols shouldn't really be made visible, neither advertised in the sdk, as they are only used by a single shared object. Symbols in the sdk (or referenced in sdk macros), but not defined anywhere include: XkbBuildCoreState() XkbInitialMap XkbXIUnsupported XkbCheckActionVMods() XkbSendCompatNotify() XkbDDXFakePointerButton() XkbDDXApplyConfig() _XkbStrCaseCmp() _XkbErrMessages[] _XkbErrCode _XkbErrLocation _XkbErrData XkbAccessXDetailText() XkbNKNDetailMaskText() XkbLookupGroupAndLevel() XkbInitAtoms() XkbGetOrderedDrawables() XkbFreeOrderedDrawables() XkbConvertXkbComponents() XkbWriteXKBSemantics() XkbWriteXKBLayout() XkbWriteXKBKeymap() XkbWriteXKBFile() XkbWriteCFile() XkbWriteXKMFile() XkbWriteToServer() XkbMergeFile() XkmFindTOCEntry() XkmReadFileSection() XkmReadFileSectionName() InitExtInput() xf86CheckButton() xf86SwitchCoreDevice() RamDacSetGamma() RamDacRestoreDACValues() xf86Bpp xf86ConfigPix24 xf86MouseCflags[] xf86SupportedMouseTypes[] xf86NumMouseTypes xf86ChangeBusIndex() xf86EntityEnter() xf86EntityLeave() xf86WrapperInit() xf86RingBell() xf86findOptionBoolean() xf86debugListOptions() LoadSubModuleLocal() LoaderSymbolLocal() getInt10Rec() xf86CurrentScreen xf86ReallocatePciResources() xf86NewSerialNumber() xf86RandRSetInitialMode() fbCompositeSolidMask_nx1xn fbCompositeSolidMask_nx8888x0565C fbCompositeSolidMask_nx8888x8888C fbCompositeSolidMask_nx8x0565 fbCompositeSolidMask_nx8x0888 fbCompositeSolidMask_nx8x8888 fbCompositeSrc_0565x0565 fbCompositeSrc_8888x0565 fbCompositeSrc_8888x0888 fbCompositeSrc_8888x8888 fbCompositeSrcAdd_1000x1000 fbCompositeSrcAdd_8000x8000 fbCompositeSrcAdd_8888x8888 fbGeneration fbIn fbOver fbOver24 fbOverlayGeneration fbRasterizeEdges fbRestoreAreas fbSaveAreas composeFunctions VBEBuildVbeModeList() VBECalcVbeModeIndex() TIramdac3030CalculateMNPForClock() shadowBufPtr shadowFindBuf() miRRGetScreenInfo() RRSetScreenConfig() RRModePruneUnused() PixmanImageFromPicture() extern int miPointerGetMotionEvents() miClipPicture() miRasterizeTriangle() fbPush1toN() fbInitializeBackingStore() ddxBeforeReset() SetupSprite() InitSprite() DGADeliverEvent() SPECIAL CASES o defined as _X_INTERNAL xf86NewInputDevice() o defined as static fbGCPrivateKey fbOverlayScreenPrivateKey fbScreenPrivateKey fbWinPrivateKey o defined in libXfont.so, but declared in xorg/dixfont.h GetGlyphs() QueryGlyphExtents() QueryTextExtents() ParseGlyphCachingMode() InitGlyphCaching() SetGlyphCachingMode()
2008-01-03Merge branch 'master' into mpxPeter Hutterer1-44/+64
Conflicts: XTrap/xtrapddmi.c Xext/security.c Xext/xprint.c Xext/xtest.c Xext/xvdisp.c Xi/exevents.c Xi/grabdevb.c Xi/grabdevk.c Xi/opendev.c Xi/ungrdev.c Xi/ungrdevb.c Xi/ungrdevk.c dix/cursor.c dix/devices.c dix/dixutils.c dix/events.c dix/getevents.c dix/main.c dix/window.c hw/xfree86/ramdac/xf86Cursor.c include/dix.h include/input.h include/inputstr.h mi/midispcur.c mi/miinitext.c mi/misprite.c render/animcur.c xfixes/cursor.c xkb/xkbAccessX.c
2007-09-24dix: fix "possible use of uninitialized variable" warning.Peter Hutterer1-1/+1
The device passed through to UnrealizeCursor isn't used anyway, so setting it to NULL is enough.
2007-09-05xace: add new fields to resource access hook to allow parent resource objectsEamon Walsh1-3/+4
to be passed in at create time. Also added a missing devPrivates initializer.
2007-08-30devPrivates rework: convert CursorRec and CursorBits over to new interface.Eamon Walsh1-1/+13
2007-08-15xace: add hooks + new access codes: core protocol cursor requestsEamon Walsh1-43/+49
2007-08-12Merge branch 'master' into mpxPeter Hutterer1-3/+19
Conflicts: Xi/exevents.c dix/devices.c dix/getevents.c include/dix.h mi/mieq.c
2007-08-01DIX: Clean up null root cursor handlingDaniel Stone1-3/+19
Move the null root cursor handling out of main() and into CreateRootCursor.
2007-04-04Unrealize cursor only once, not per device.Peter Hutterer1-5/+1
2007-03-30dix: Fix wrong cursor refcount.Peter Hutterer1-36/+11
Calloc cursor struct to ensure devPrivates are zeroed out and don't increase the refcnt for devices automatically when allocating a new cursor. Use new DeviceIsPointerType() to detect if device is a pointer _before_ device has been activated and can thus be identified and set up grab functions accordingly. This way we can increase the refcnt when we get a pointer grab.
2007-03-29dix: Try to get closer to the correct refcnt for cursors.Peter Hutterer1-3/+5
This commit introduces a memory leak, as the refcnt never seems to get down to 0 and thus cursors will not be freed. Solves the problems with GNOME segfaulting every 30 seconds though.
2007-03-22Xi: add GetClientPointer and GetPointerPairing requests.Peter Hutterer1-1/+0
dix: use PickKeyboard for ProcSetInputFocus and ProcGetInputFocus instead of the core keyboard.
2007-03-19Merge branch 'master' into mpxPeter Hutterer1-4/+4
Conflicts: dix/devices.c dix/events.c mi/misprite.c
2007-03-09Xi: Add SetClientPointer request handling.Peter Hutterer1-0/+1
2007-03-08dix: Check if client has a grab on any other device before mouse/kbdPeter Hutterer1-1/+0
event is delivered to the client. Client's don't cope well with receiving core events from other devices when having a grab on a pointer or keyboard.
2007-03-08dix: remove 'register' keyword for all variables.Peter Hutterer1-4/+4
2007-03-07Xi: Don't deactivate core grabs from non-core button/key releases.Peter Hutterer1-0/+32
dix: set coreGrab flag for grabs caused by GrabPointer and button presses. remove virtual core devices from device list, only real devices are in the list now. Auto-pair each keyboard with a real pointer if one is available, provides multiple keyboards automatically after startup if devices are configured. fix GuessFreePointerDevice() to do what it's supposed to do. mi: fix: call miPointerMove from miPointerWarpCursor. fix: remove unused id field from miCursorInfoRec don't update sprite for virtual core pointer.
2007-01-12mi: Quick fix to stop segfault on non-core keyboards.Peter Hutterer1-1/+0
2006-12-20xfree86: Changing "IsMPDevice" to "SharedPointer" option. Devices will defaultPeter Hutterer1-3/+0
to MP devices. Xi: Adding QueryDevicePointer request/reply Adding WarpDevicePointer request/reply
2006-12-19Merge branch 'master' of git://anongit.freedesktop.org/git/xorg/xserverPeter Hutterer1-2/+2
2006-12-18mi: removing MPX ifdefsPeter Hutterer1-11/+9
global sprite renaming in mipointer and misprite fixed: multiple remove cursor call in miSpriteInstallColormap fixed: wrong core pointer usage in miSpriteStoreColors dix: bugfix in CheckCursorConfinement removing MPX ifdefs removing MPX event generation (using Xi solely now) bugfix GrabDevice: uninitialized field in grab struct caused segfault xfree86: removing MPX fdefs Xi: removing MPX protocol events
2006-12-14Naming change: Security*Access -> Dix*AccessEamon Walsh1-2/+2
2006-12-14mi: removing MPX ifdefsPeter Hutterer1-32/+5
global sprite renaming in mipointer and misprite fixed: multiple remove cursor call in miSpriteInstallColormap fixed: wrong core pointer usage in miSpriteStoreColors dix: bugfix in CheckCursorConfinement removing MPX ifdefs removing MPX event generation (using Xi solely now)
2006-11-28mi: Bugfix: FreeCursor ignores negative refcounts.Peter Hutterer1-1/+4
mieq: Bugfix: Motion notifies did overwrite DeviceMotionNotifies
2006-11-23mi: closing memory leak, miPointer is freed in miPointerCloseScreenPeter Hutterer1-25/+118
bugfix: uninitialized pPointer in miPointerGetPosition ifndef MPX adding DeviceIntPtr parameter to ScreenRec's cursor functions. cleanup of miPointer code to use same scheme in each function dix: MPHasCursor() function determines checking whether to invoke cursor rendering. animcur: adding DeviceIntPtr parameter to cursor functions but animcur relies on the core pointer right now. xfixes: adding DeviceIntPtr parameter to cursor functions but xfixes relies on the core pointer right now. rac: adding DeviceIntPtr parameter to cursor functions but RAC relies on the core pointer right now. ramdac: adding DeviceIntPtr parameter to cursor functions but ramdac relies on the core pointer right now.
2006-07-21Remove RCS tags. Fix Xprint makefile braindamage.Adam Jackson1-2/+0
2006-02-15Mark everything in dixsym.c as _X_EXPORT.Adam Jackson1-1/+1
2005-07-03Add Xtrans definitions (FONT_t, TRANS_CLIENT) to clean up warnings.Daniel Stone1-0/+4
Add XSERV_t, TRANS_SERVER, TRANS_REOPEN to quash warnings. Add #include <dix-config.h> or <xorg-config.h>, as appropriate, to all source files in the xserver/xorg tree, predicated on defines of HAVE_{DIX,XORG}_CONFIG_H. Change all Xfont includes to <X11/fonts/foo.h>.