Changeset View
Changeset View
Standalone View
Standalone View
applets/appmenu/plugin/appmenumodel.cpp
Show First 20 Lines • Show All 197 Lines • ▼ Show 20 Line(s) | 136 | if (KWindowSystem::isPlatformX11()) { | |||
---|---|---|---|---|---|
198 | 198 | | |||
199 | if (updateMenuFromWindowIfHasMenu(id)) { | 199 | if (updateMenuFromWindowIfHasMenu(id)) { | ||
200 | return; | 200 | return; | ||
201 | } | 201 | } | ||
202 | 202 | | |||
203 | // monitor whether an app menu becomes available later | 203 | // monitor whether an app menu becomes available later | ||
204 | // this can happen when an app starts, shows its window, and only later announces global menu (e.g. Firefox) | 204 | // this can happen when an app starts, shows its window, and only later announces global menu (e.g. Firefox) | ||
205 | qApp->installNativeEventFilter(this); | 205 | qApp->installNativeEventFilter(this); | ||
206 | m_currentWindowId = id; | 206 | m_delayedMenuWindowId = id; | ||
207 | 207 | | |||
208 | //no menu found, set it to unavailable | 208 | //no menu found, set it to unavailable | ||
209 | setMenuAvailable(false); | 209 | setMenuAvailable(false); | ||
210 | emit modelNeedsUpdate(); | 210 | emit modelNeedsUpdate(); | ||
211 | } | 211 | } | ||
212 | #endif | 212 | #endif | ||
213 | 213 | | |||
214 | } | 214 | } | ||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Line(s) | 315 | if (!KWindowSystem::isPlatformX11() || eventType != "xcb_generic_event_t") { | |||
316 | return false; | 316 | return false; | ||
317 | } | 317 | } | ||
318 | 318 | | |||
319 | #if HAVE_X11 | 319 | #if HAVE_X11 | ||
320 | auto e = static_cast<xcb_generic_event_t *>(message); | 320 | auto e = static_cast<xcb_generic_event_t *>(message); | ||
321 | const uint8_t type = e->response_type & ~0x80; | 321 | const uint8_t type = e->response_type & ~0x80; | ||
322 | if (type == XCB_PROPERTY_NOTIFY) { | 322 | if (type == XCB_PROPERTY_NOTIFY) { | ||
323 | auto *event = reinterpret_cast<xcb_property_notify_event_t *>(e); | 323 | auto *event = reinterpret_cast<xcb_property_notify_event_t *>(e); | ||
324 | if (event->window == m_currentWindowId) { | 324 | if (event->window == m_delayedMenuWindowId) { | ||
325 | 325 | | |||
326 | auto serviceNameAtom = s_atoms.value(s_x11AppMenuServiceNamePropertyName); | 326 | auto serviceNameAtom = s_atoms.value(s_x11AppMenuServiceNamePropertyName); | ||
327 | auto objectPathAtom = s_atoms.value(s_x11AppMenuObjectPathPropertyName); | 327 | auto objectPathAtom = s_atoms.value(s_x11AppMenuObjectPathPropertyName); | ||
328 | 328 | | |||
329 | if (serviceNameAtom != XCB_ATOM_NONE && objectPathAtom != XCB_ATOM_NONE) { // shouldn't happen | 329 | if (serviceNameAtom != XCB_ATOM_NONE && objectPathAtom != XCB_ATOM_NONE) { // shouldn't happen | ||
330 | if (event->atom == serviceNameAtom || event->atom == objectPathAtom) { | 330 | if (event->atom == serviceNameAtom || event->atom == objectPathAtom) { | ||
331 | // see if we now have a menu | 331 | // see if we now have a menu | ||
332 | onActiveWindowChanged(KWindowSystem::activeWindow()); | 332 | onActiveWindowChanged(KWindowSystem::activeWindow()); | ||
Show All 11 Lines |