Changeset View
Changeset View
Standalone View
Standalone View
utils.cpp
Show First 20 Lines • Show All 166 Lines • ▼ Show 20 Line(s) | 166 | if (button == XCB_BUTTON_INDEX_4) | |||
---|---|---|---|---|---|
167 | return Qt::XButton1; | 167 | return Qt::XButton1; | ||
168 | if (button == XCB_BUTTON_INDEX_5) | 168 | if (button == XCB_BUTTON_INDEX_5) | ||
169 | return Qt::XButton2; | 169 | return Qt::XButton2; | ||
170 | return Qt::NoButton; | 170 | return Qt::NoButton; | ||
171 | } | 171 | } | ||
172 | 172 | | |||
173 | Qt::MouseButtons x11ToQtMouseButtons(int state) | 173 | Qt::MouseButtons x11ToQtMouseButtons(int state) | ||
174 | { | 174 | { | ||
175 | Qt::MouseButtons ret = nullptr; | 175 | Qt::MouseButtons ret = {}; | ||
176 | if (state & XCB_KEY_BUT_MASK_BUTTON_1) | 176 | if (state & XCB_KEY_BUT_MASK_BUTTON_1) | ||
177 | ret |= Qt::LeftButton; | 177 | ret |= Qt::LeftButton; | ||
178 | if (state & XCB_KEY_BUT_MASK_BUTTON_2) | 178 | if (state & XCB_KEY_BUT_MASK_BUTTON_2) | ||
179 | ret |= Qt::MidButton; | 179 | ret |= Qt::MidButton; | ||
180 | if (state & XCB_KEY_BUT_MASK_BUTTON_3) | 180 | if (state & XCB_KEY_BUT_MASK_BUTTON_3) | ||
181 | ret |= Qt::RightButton; | 181 | ret |= Qt::RightButton; | ||
182 | if (state & XCB_KEY_BUT_MASK_BUTTON_4) | 182 | if (state & XCB_KEY_BUT_MASK_BUTTON_4) | ||
183 | ret |= Qt::XButton1; | 183 | ret |= Qt::XButton1; | ||
184 | if (state & XCB_KEY_BUT_MASK_BUTTON_5) | 184 | if (state & XCB_KEY_BUT_MASK_BUTTON_5) | ||
185 | ret |= Qt::XButton2; | 185 | ret |= Qt::XButton2; | ||
186 | return ret; | 186 | return ret; | ||
187 | } | 187 | } | ||
188 | 188 | | |||
189 | Qt::KeyboardModifiers x11ToQtKeyboardModifiers(int state) | 189 | Qt::KeyboardModifiers x11ToQtKeyboardModifiers(int state) | ||
190 | { | 190 | { | ||
191 | Qt::KeyboardModifiers ret = nullptr; | 191 | Qt::KeyboardModifiers ret = {}; | ||
192 | if (state & XCB_KEY_BUT_MASK_SHIFT) | 192 | if (state & XCB_KEY_BUT_MASK_SHIFT) | ||
193 | ret |= Qt::ShiftModifier; | 193 | ret |= Qt::ShiftModifier; | ||
194 | if (state & XCB_KEY_BUT_MASK_CONTROL) | 194 | if (state & XCB_KEY_BUT_MASK_CONTROL) | ||
195 | ret |= Qt::ControlModifier; | 195 | ret |= Qt::ControlModifier; | ||
196 | if (state & KKeyServer::modXAlt()) | 196 | if (state & KKeyServer::modXAlt()) | ||
197 | ret |= Qt::AltModifier; | 197 | ret |= Qt::AltModifier; | ||
198 | if (state & KKeyServer::modXMeta()) | 198 | if (state & KKeyServer::modXMeta()) | ||
199 | ret |= Qt::MetaModifier; | 199 | ret |= Qt::MetaModifier; | ||
200 | return ret; | 200 | return ret; | ||
201 | } | 201 | } | ||
202 | 202 | | |||
203 | } // namespace | 203 | } // namespace | ||
204 | 204 | | |||
205 | #ifndef KCMRULES | 205 | #ifndef KCMRULES | ||
206 | #endif | 206 | #endif |