summaryrefslogtreecommitdiff
path: root/Xi/xibarriers.c
AgeCommit message (Collapse)AuthorFilesLines
2014-01-12Replace 'pointer' type with 'void *'Keith Packard1-2/+2
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-05-07Xi: free barrier code at reset timePeter Hutterer1-0/+12
==29423== 16 bytes in 1 blocks are definitely lost in loss record 73 of 328 ==29423== at 0x4A06B6F: calloc (vg_replace_malloc.c:593) ==29423== by 0x5987C0: XIBarrierInit (xibarriers.c:908) ==29423== by 0x58F370: XInputExtensionInit (extinit.c:1300) ==29423== by 0x4F33C3: InitExtensions (miinitext.c:337) ==29423== by 0x4997DB: main (main.c:208) Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2013-03-04Xi: force dtime to 0 on the first BarrierHitPeter Hutterer1-1/+4
dtime to the previous event is 0 on the first BarrierHit event. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net> Signed-off-by: Keith Packard <keithp@keithp.com>
2013-03-04xibarriers: Remove accidental use of the comma operatorJasper St. Pierre1-2/+2
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-18Xi: if a MD is removed, send a barrier leave event (if applicable)Peter Hutterer1-1/+29
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2012-12-18Xi: don't store the window pointer in barriers, store the window IDPeter Hutterer1-5/+5
When a client shuts down and resources are being freed, the window may have been freed already, so accessing it to get the window ID is bad. Plus, we never care about the window anyway other than for stuffing it into the event. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2012-12-18Xi: fix per-device barrier handlingPeter Hutterer1-49/+186
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2012-12-17Xi: fill in barrier root x/y after clamping to RandR outputsPeter Hutterer1-0/+4
x/y for barrier events should contain the actual pointer position. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2012-12-17Pass the event list through to the pointer barrier code to return itPeter Hutterer1-3/+12
Instead of having the pointer barrier code enqueue events separately from GetPointerEvents, pass the event list through and let it add to it. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2012-12-17barriers: Support line and ray barriersJasper St. Pierre1-6/+40
This allows clients to add barriers that extend to the edge of the screen. Clients are encouraged to use these instead of precise coordinates in these cases to help prevent pointer leaks. Signed-off-by: Jasper St. Pierre <jstpierre@mecheye.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-17barriers: Replace complex intersection test with simpler mathJasper St. Pierre1-51/+27
Since barriers are axis-aligned, we can do the intersection test with simple interpolation rather than line-segment intersection. This also helps us out in the future when we want the barriers to extend to be rays and lines rather than just segments. Signed-off-by: Jasper St. Pierre <jstpierre@mecheye.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-17barriers: Send an XI_BarrierLeave event when a barrier is destroyedJasper St. Pierre1-0/+44
This ensures that we always complete an event sequence. Signed-off-by: Jasper St. Pierre <jstpierre@mecheye.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-17barriers: Clean up codeJasper St. Pierre1-4/+4
Rename a variable. This is to make the diff in the next commit cleaner. Signed-off-by: Jasper St. Pierre <jstpierre@mecheye.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-17barriers: Send a BarrierLeave event when we leave the hitboxJasper St. Pierre1-0/+17
Additionally, add flags when the pointer is released. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2012-12-17barriers: Increment event ID on hit box leaveJasper St. Pierre1-3/+11
We eventually want to send a new notify event on hitbox leave, which signifies the dawn of a new barrier event ID, so it's convenient if we can put the code here. Signed-off-by: Jasper St. Pierre <jstpierre@mecheye.net> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2012-12-17barriers: Add a couple pixels of elbow room for the hit detectionJasper St. Pierre1-5/+35
Pointers (and the hands that drive them) aren't very precise, and the slightest amount of nudging to either side might be enough to reset the event ID, making clients think they have an entirely new hit. Allow for a slightly bigger "hit box" before these barriers get reset. Signed-off-by: Jasper St. Pierre <jstpierre@mecheye.net> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2012-12-17barriers: Add support for edge cases when releasing barriersJasper St. Pierre1-3/+4
If we release a barrier, we want to ensure that we block all other barriers afterwards, rather than capping the limit to the two nearest barriers. Signed-off-by: Jasper St. Pierre <jstpierre@mecheye.net> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2012-12-17barriers: Don't allow releasing the pointer on other client's barriersPeter Hutterer1-0/+3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2012-12-17barriers: Don't allow destroying other client's barriersPeter Hutterer1-0/+3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2012-12-17Add support for XI2.3: Pointer barrier events and releases.Jasper St. Pierre1-0/+107
This adds support for clients that would like to get a notification every time a barrier is hit, and allows clients to temporarily release a barrier so that pointers can go through them, without having to destroy and recreate barriers. Based on work by Chris Halse Rogers <chris.halse.rogers@canonical.com> Signed-off-by: Jasper St. Pierre <jstpierre@mecheye.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-17barriers: Reindent the constrainment hookJasper St. Pierre1-28/+29
This is to make future diffs much cleaner. Best viewed with -w. Signed-off-by: Jasper St. Pierre <jstpierre@mecheye.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-17barriers: Switch to finding the nearest barrier clientJasper St. Pierre1-7/+9
When we add events, we eventually want to add more state to the PointerBarrierClient, so return one of these instead of the dummy public structure that's not very interesting. Signed-off-by: Jasper St. Pierre <jstpierre@mecheye.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-17barriers: Switch to an explicit hook for barrier constrainmentJasper St. Pierre1-40/+16
Rather than riding on the ConstrainCursorHarder hook, which has several issues, move to an explicit hook, which will help us with some RANDR interaction issues. Signed-off-by: Jasper St. Pierre <jstpierre@mecheye.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-17barriers: Don't loop over the server to destroy a barrierJasper St. Pierre1-14/+2
This is completely pointless as far as I can tell. Signed-off-by: Jasper St. Pierre <jstpierre@mecheye.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-17cursor: Move pointer barrier code over to XIJasper St. Pierre1-0/+548
In order to send events to specific windows associated with the barrier, we need to move the code that handles barriers to somewhere where it's easier to construct and send events. Rather than duplicating XSync with its XSyncSelectAlarm, re-use the existing XI infrastructure. For now, just move a bunch of code over, rename some things, and initialize the new structures, but still consider it a separate codebase. Pointer barrier requests are still handled by XFixes, so this is a weird intermediate state. It's unknown whether we'll add explicit requests to pointer barriers inside XI. Signed-off-by: Jasper St. Pierre <jstpierre@mecheye.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>