Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/x11/standalone/sync_filter.cpp
Show All 12 Lines | |||||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. | ||
16 | 16 | | |||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #include "sync_filter.h" | 20 | #include "sync_filter.h" | ||
21 | #include "client.h" | 21 | #include "x11client.h" | ||
22 | #include "workspace.h" | 22 | #include "workspace.h" | ||
23 | #include "xcbutils.h" | 23 | #include "xcbutils.h" | ||
24 | 24 | | |||
25 | namespace KWin | 25 | namespace KWin | ||
26 | { | 26 | { | ||
27 | 27 | | |||
28 | SyncFilter::SyncFilter() | 28 | SyncFilter::SyncFilter() | ||
29 | : X11EventFilter(QVector<int>{Xcb::Extensions::self()->syncAlarmNotifyEvent()}) | 29 | : X11EventFilter(QVector<int>{Xcb::Extensions::self()->syncAlarmNotifyEvent()}) | ||
30 | { | 30 | { | ||
31 | } | 31 | } | ||
32 | 32 | | |||
33 | bool SyncFilter::event(xcb_generic_event_t *event) | 33 | bool SyncFilter::event(xcb_generic_event_t *event) | ||
34 | { | 34 | { | ||
35 | auto e = reinterpret_cast< xcb_sync_alarm_notify_event_t* >(event); | 35 | auto e = reinterpret_cast< xcb_sync_alarm_notify_event_t* >(event); | ||
36 | auto client = workspace()->findClient( | 36 | auto client = workspace()->findClient( | ||
37 | [e] (const Client *c) { | 37 | [e] (const X11Client *c) { | ||
38 | const auto syncRequest = c->getSyncRequest(); | 38 | const auto syncRequest = c->getSyncRequest(); | ||
39 | return e->alarm == syncRequest.alarm && e->counter_value.hi == syncRequest.value.hi && e->counter_value.lo == syncRequest.value.lo; | 39 | return e->alarm == syncRequest.alarm && e->counter_value.hi == syncRequest.value.hi && e->counter_value.lo == syncRequest.value.lo; | ||
40 | } | 40 | } | ||
41 | ); | 41 | ); | ||
42 | if (client) { | 42 | if (client) { | ||
43 | client->handleSync(); | 43 | client->handleSync(); | ||
44 | } | 44 | } | ||
45 | return false; | 45 | return false; | ||
46 | } | 46 | } | ||
47 | 47 | | |||
48 | } | 48 | } |