~ubuntu-branches/ubuntu/quantal/xorg-server/quantal-updates

« back to all changes in this revision

Viewing changes to dix/touch.c

  • Committer: Package Import Robot
  • Author(s): Chase Douglas
  • Date: 2012-03-07 15:36:20 UTC
  • Revision ID: package-import@ubuntu.com-20120307153620-v2789zwz1n3irs3b
Tags: 2:1.11.4-0ubuntu5
* Update to 1.12 input stack 
* Drop input patches that have been merged upstream:
  - 600-Revert-dix-deduplicate-callers-of-DeliverDeviceEvent.patch
  - 601-Store-window-pointer-in-touch-listener-record.patch
  - 602-Factor-out-TouchEnd-generation-and-delivery.patch
  - 603-Export-TouchEventRejected-as-TouchRejected.patch
  - 604-Move-AllowTouch-to-dix-touch.c-and-rename-to-TouchAc.patch
  - 605-Check-for-proper-window-ID-when-processing-touch-all.patch
  - 606-Implement-early-touch-reject.patch
  - 607-Implement-touch-early-accept.patch
  - 608-dix-fix-an-out-of-memory-crash.patch
  - 609-Xi-handle-new-XIAllowEvents-request-in-inputproto-2..patch
  - 610-Fix-scrolling.patch
  - 611-Fix-touch-punt-crash.patch
  - 612-Fix-vcp-touches-corruption.patch
  - 613-Keep-vcp-touch-class.patch
* Fix indirect touch grab handling (LP: #929408)
  - Add temporary patch 501_touch_accept_end.patch
  - Add temporary patch 502_indirect_touch_window_set.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 
35
35
#include "eventstr.h"
36
36
#include "exevents.h"
 
37
#include "exglobals.h"
37
38
#include "inpututils.h"
38
39
#include "eventconvert.h"
39
40
#include "windowstr.h"
697
698
 */
698
699
void
699
700
TouchAddListener(TouchPointInfoPtr ti, XID resource, enum InputLevel level,
700
 
                 enum TouchListenerType type, enum TouchListenerState state)
 
701
                 enum TouchListenerType type, enum TouchListenerState state,
 
702
                 WindowPtr window)
701
703
{
702
704
    ti->listeners[ti->num_listeners].listener = resource;
703
705
    ti->listeners[ti->num_listeners].level = level;
704
706
    ti->listeners[ti->num_listeners].state = state;
705
707
    ti->listeners[ti->num_listeners].type = type;
 
708
    ti->listeners[ti->num_listeners].window = window;
706
709
    ti->num_listeners++;
707
710
}
708
711
 
753
756
    }
754
757
 
755
758
    TouchAddListener(ti, grab->resource, grab->grabtype,
756
 
                     type, LISTENER_AWAITING_BEGIN);
 
759
                     type, LISTENER_AWAITING_BEGIN, grab->window);
757
760
    ti->num_grabs++;
758
761
}
759
762
 
814
817
                TouchEventHistoryAllocate(ti);
815
818
 
816
819
            TouchAddListener(ti, iclients->resource, XI2,
817
 
                             type, LISTENER_AWAITING_BEGIN);
 
820
                             type, LISTENER_AWAITING_BEGIN, win);
818
821
            return TRUE;
819
822
        }
820
823
    }
830
833
 
831
834
            TouchEventHistoryAllocate(ti);
832
835
            TouchAddListener(ti, iclients->resource, XI,
833
 
                             LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN);
 
836
                             LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN,
 
837
                             win);
834
838
            return TRUE;
835
839
        }
836
840
    }
845
849
        {
846
850
            TouchEventHistoryAllocate(ti);
847
851
            TouchAddListener(ti, win->drawable.id, CORE,
848
 
                             LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN);
 
852
                             LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN,
 
853
                             win);
849
854
            return TRUE;
850
855
        }
851
856
 
857
862
 
858
863
            TouchEventHistoryAllocate(ti);
859
864
            TouchAddListener(ti, iclients->resource, CORE,
860
 
                             type, LISTENER_AWAITING_BEGIN);
 
865
                             type, LISTENER_AWAITING_BEGIN, win);
861
866
            return TRUE;
862
867
        }
863
868
    }
980
985
 
981
986
    FreeEventList(events, GetMaximumEventsNum());
982
987
}
 
988
 
 
989
int
 
990
TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
 
991
                  uint32_t touchid, Window grab_window, XID *error)
 
992
{
 
993
    TouchPointInfoPtr ti;
 
994
    int nev, i;
 
995
    InternalEvent *events = InitEventList(GetMaximumEventsNum());
 
996
 
 
997
    if (!events)
 
998
        return BadAlloc;
 
999
 
 
1000
    if (!dev->touch)
 
1001
    {
 
1002
        *error = dev->id;
 
1003
        return BadDevice;
 
1004
    }
 
1005
 
 
1006
    ti = TouchFindByClientID(dev, touchid);
 
1007
    if (!ti)
 
1008
    {
 
1009
        *error = touchid;
 
1010
        return BadValue;
 
1011
    }
 
1012
 
 
1013
    for (i = 0; i < ti->num_listeners; i++)
 
1014
    {
 
1015
        if (CLIENT_ID(ti->listeners[i].listener) == client->index &&
 
1016
            ti->listeners[i].window->drawable.id == grab_window)
 
1017
            break;
 
1018
    }
 
1019
    if (i == ti->num_listeners)
 
1020
        return BadAccess;
 
1021
 
 
1022
    if (i > 0)
 
1023
    {
 
1024
        if (mode == XIRejectTouch)
 
1025
            TouchRejected(dev, ti, ti->listeners[i].listener, NULL);
 
1026
        else
 
1027
            ti->listeners[i].state = LISTENER_EARLY_ACCEPT;
 
1028
 
 
1029
        return Success;
 
1030
    }
 
1031
 
 
1032
    nev = GetTouchOwnershipEvents(events, dev, ti, mode,
 
1033
                                  ti->listeners[0].listener, 0);
 
1034
    if (nev == 0)
 
1035
        return BadAlloc;
 
1036
    for (i = 0; i < nev; i++)
 
1037
        mieqProcessDeviceEvent(dev, events + i, NULL);
 
1038
 
 
1039
    ProcessInputEvents();
 
1040
 
 
1041
    FreeEventList(events, GetMaximumEventsNum());
 
1042
    return Success;
 
1043
}