~unity-team/qtmir/qtmir.api

« back to all changes in this revision

Viewing changes to src/platforms/mirserver/eventbuilder.h

  • Committer: Nick Dedekind
  • Date: 2017-03-24 09:44:29 UTC
  • mfrom: (579.7.28 qtmir.storage)
  • Revision ID: nick.dedekind@canonical.com-20170324094429-muce29a5k536yudz
merged parent

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2016 Canonical, Ltd.
 
2
 * Copyright (C) 2016-2017 Canonical, Ltd.
3
3
 *
4
4
 * This program is free software: you can redistribute it and/or modify it under
5
5
 * the terms of the GNU Lesser General Public License version 3, as published by
46
46
 
47
47
    /* Stores information that cannot be carried by QInputEvents so that it can be fully
48
48
       reconstructed later given the same qtTimestamp */
49
 
    void store(const MirPointerEvent *mirPointerEvent, ulong qtTimestamp);
 
49
    void store(const MirInputEvent *mirInputEvent, ulong qtTimestamp);
50
50
 
51
51
    /*
52
52
        Builds a MirEvent version of the given QInputEvent using also extra data from the
58
58
    mir::EventUPtr reconstructMirEvent(QHoverEvent *qtEvent);
59
59
 
60
60
    /*
61
 
        Makes a MirEvent version of the given QInputEvent
 
61
        Makes a MirEvent version of the given QInputEvent using also extra data from the
 
62
        MirInputEvent that caused it.
 
63
 
 
64
        See also: store()
62
65
     */
63
66
    mir::EventUPtr makeMirEvent(QWheelEvent *qtEvent);
64
67
    mir::EventUPtr makeMirEvent(QKeyEvent *qtEvent);
69
72
private:
70
73
    class EventInfo {
71
74
    public:
72
 
        void store(const MirPointerEvent *mirPointerEvent, ulong qtTimestamp);
 
75
        void store(const MirInputEvent *mirInputEvent, ulong qtTimestamp);
73
76
        ulong qtTimestamp;
 
77
        MirInputDeviceId deviceId;
 
78
        std::vector<uint8_t> cookie;
74
79
        float relativeX{0};
75
80
        float relativeY{0};
76
81
    };
85
90
 
86
91
      When MirInputEvents are dispatched through a QML scene, not all of its information can be carried
87
92
      by QInputEvents. Some information is lost. Thus further on, if we want to transform a QInputEvent back into
88
 
      its original MirInputEvent so that it can be consumed by a mir::scene::Surface, we have to reach out to
89
 
      this EventRegistry to get the missing bits.
 
93
      its original MirInputEvent so that it can be consumed by a mir::scene::Surface and properly handled by mir clients
 
94
      we have to reach out to this EventRegistry to get the missing bits.
90
95
 
91
96
      Given the objective of this EventRegistry (MirInputEvent reconstruction after having gone through QQuickWindow input dispatch
92
97
      as a QInputEvent), it stores information only about the most recent MirInputEvents.