Changeset View
Changeset View
Standalone View
Standalone View
src/server/plasmawindowmanagement_interface.cpp
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | |||||
67 | { | 67 | { | ||
68 | public: | 68 | public: | ||
69 | Private(PlasmaWindowManagementInterface *wm, PlasmaWindowInterface *q); | 69 | Private(PlasmaWindowManagementInterface *wm, PlasmaWindowInterface *q); | ||
70 | ~Private(); | 70 | ~Private(); | ||
71 | 71 | | |||
72 | void createResource(wl_resource *parent, uint32_t id); | 72 | void createResource(wl_resource *parent, uint32_t id); | ||
73 | void setTitle(const QString &title); | 73 | void setTitle(const QString &title); | ||
74 | void setAppId(const QString &appId); | 74 | void setAppId(const QString &appId); | ||
75 | void setPid(quint32 pid); | ||||
75 | void setThemedIconName(const QString &iconName); | 76 | void setThemedIconName(const QString &iconName); | ||
76 | void setIcon(const QIcon &icon); | 77 | void setIcon(const QIcon &icon); | ||
77 | void setVirtualDesktop(quint32 desktop); | 78 | void setVirtualDesktop(quint32 desktop); | ||
78 | void unmap(); | 79 | void unmap(); | ||
79 | void setState(org_kde_plasma_window_management_state flag, bool set); | 80 | void setState(org_kde_plasma_window_management_state flag, bool set); | ||
80 | void setParentWindow(PlasmaWindowInterface *parent); | 81 | void setParentWindow(PlasmaWindowInterface *parent); | ||
81 | void setGeometry(const QRect &geometry); | 82 | void setGeometry(const QRect &geometry); | ||
82 | wl_resource *resourceForParent(PlasmaWindowInterface *parent, wl_resource *child) const; | 83 | wl_resource *resourceForParent(PlasmaWindowInterface *parent, wl_resource *child) const; | ||
Show All 21 Lines | 95 | private: | |||
104 | static void getIconCallback(wl_client *client, wl_resource *resource, int32_t fd); | 105 | static void getIconCallback(wl_client *client, wl_resource *resource, int32_t fd); | ||
105 | static Private *cast(wl_resource *resource) { | 106 | static Private *cast(wl_resource *resource) { | ||
106 | return reinterpret_cast<Private*>(wl_resource_get_user_data(resource)); | 107 | return reinterpret_cast<Private*>(wl_resource_get_user_data(resource)); | ||
107 | } | 108 | } | ||
108 | 109 | | |||
109 | PlasmaWindowInterface *q; | 110 | PlasmaWindowInterface *q; | ||
110 | QString m_title; | 111 | QString m_title; | ||
111 | QString m_appId; | 112 | QString m_appId; | ||
113 | quint32 m_pid = 0; | ||||
112 | QString m_themedIconName; | 114 | QString m_themedIconName; | ||
113 | QIcon m_icon; | 115 | QIcon m_icon; | ||
114 | quint32 m_virtualDesktop = 0; | 116 | quint32 m_virtualDesktop = 0; | ||
115 | quint32 m_state = 0; | 117 | quint32 m_state = 0; | ||
116 | wl_listener listener; | 118 | wl_listener listener; | ||
117 | static const struct org_kde_plasma_window_interface s_interface; | 119 | static const struct org_kde_plasma_window_interface s_interface; | ||
118 | }; | 120 | }; | ||
119 | 121 | | |||
▲ Show 20 Lines • Show All 204 Lines • ▼ Show 20 Line(s) | 321 | { | |||
324 | } | 326 | } | ||
325 | wl_resource_set_implementation(resource, &s_interface, this, unbind); | 327 | wl_resource_set_implementation(resource, &s_interface, this, unbind); | ||
326 | resources << resource; | 328 | resources << resource; | ||
327 | 329 | | |||
328 | org_kde_plasma_window_send_virtual_desktop_changed(resource, m_virtualDesktop); | 330 | org_kde_plasma_window_send_virtual_desktop_changed(resource, m_virtualDesktop); | ||
329 | if (!m_appId.isEmpty()) { | 331 | if (!m_appId.isEmpty()) { | ||
330 | org_kde_plasma_window_send_app_id_changed(resource, m_appId.toUtf8().constData()); | 332 | org_kde_plasma_window_send_app_id_changed(resource, m_appId.toUtf8().constData()); | ||
331 | } | 333 | } | ||
334 | if (m_pid != 0) { | ||||
335 | org_kde_plasma_window_send_pid_changed(resource, m_pid); | ||||
336 | } | ||||
332 | if (!m_title.isEmpty()) { | 337 | if (!m_title.isEmpty()) { | ||
333 | org_kde_plasma_window_send_title_changed(resource, m_title.toUtf8().constData()); | 338 | org_kde_plasma_window_send_title_changed(resource, m_title.toUtf8().constData()); | ||
334 | } | 339 | } | ||
335 | org_kde_plasma_window_send_state_changed(resource, m_state); | 340 | org_kde_plasma_window_send_state_changed(resource, m_state); | ||
336 | if (!m_themedIconName.isEmpty()) { | 341 | if (!m_themedIconName.isEmpty()) { | ||
337 | org_kde_plasma_window_send_themed_icon_name_changed(resource, m_themedIconName.toUtf8().constData()); | 342 | org_kde_plasma_window_send_themed_icon_name_changed(resource, m_themedIconName.toUtf8().constData()); | ||
338 | } else { | 343 | } else { | ||
339 | if (wl_resource_get_version(resource) >= ORG_KDE_PLASMA_WINDOW_ICON_CHANGED_SINCE_VERSION) { | 344 | if (wl_resource_get_version(resource) >= ORG_KDE_PLASMA_WINDOW_ICON_CHANGED_SINCE_VERSION) { | ||
Show All 24 Lines | 366 | { | |||
364 | } | 369 | } | ||
365 | m_appId = appId; | 370 | m_appId = appId; | ||
366 | const QByteArray utf8 = m_appId.toUtf8(); | 371 | const QByteArray utf8 = m_appId.toUtf8(); | ||
367 | for (auto it = resources.constBegin(); it != resources.constEnd(); ++it) { | 372 | for (auto it = resources.constBegin(); it != resources.constEnd(); ++it) { | ||
368 | org_kde_plasma_window_send_app_id_changed(*it, utf8.constData()); | 373 | org_kde_plasma_window_send_app_id_changed(*it, utf8.constData()); | ||
369 | } | 374 | } | ||
370 | } | 375 | } | ||
371 | 376 | | |||
377 | void PlasmaWindowInterface::Private::setPid(quint32 pid) | ||||
378 | { | ||||
379 | if (m_pid == pid) { | ||||
380 | return; | ||||
381 | } | ||||
382 | m_pid = pid; | ||||
383 | for (auto it = resources.constBegin(); it != resources.constEnd(); ++it) { | ||||
384 | org_kde_plasma_window_send_pid_changed(*it, pid); | ||||
385 | } | ||||
386 | } | ||||
387 | | ||||
372 | void PlasmaWindowInterface::Private::setThemedIconName(const QString &iconName) | 388 | void PlasmaWindowInterface::Private::setThemedIconName(const QString &iconName) | ||
373 | { | 389 | { | ||
374 | if (m_themedIconName == iconName) { | 390 | if (m_themedIconName == iconName) { | ||
375 | return; | 391 | return; | ||
376 | } | 392 | } | ||
377 | m_themedIconName = iconName; | 393 | m_themedIconName = iconName; | ||
378 | const QByteArray utf8 = m_themedIconName.toUtf8(); | 394 | const QByteArray utf8 = m_themedIconName.toUtf8(); | ||
379 | for (auto it = resources.constBegin(); it != resources.constEnd(); ++it) { | 395 | for (auto it = resources.constBegin(); it != resources.constEnd(); ++it) { | ||
▲ Show 20 Lines • Show All 270 Lines • ▼ Show 20 Line(s) | |||||
650 | 666 | | |||
651 | PlasmaWindowInterface::~PlasmaWindowInterface() = default; | 667 | PlasmaWindowInterface::~PlasmaWindowInterface() = default; | ||
652 | 668 | | |||
653 | void PlasmaWindowInterface::setAppId(const QString &appId) | 669 | void PlasmaWindowInterface::setAppId(const QString &appId) | ||
654 | { | 670 | { | ||
655 | d->setAppId(appId); | 671 | d->setAppId(appId); | ||
656 | } | 672 | } | ||
657 | 673 | | |||
674 | void PlasmaWindowInterface::setPid(quint32 pid) | ||||
675 | { | ||||
676 | d->setPid(pid); | ||||
677 | } | ||||
678 | | ||||
658 | void PlasmaWindowInterface::setTitle(const QString &title) | 679 | void PlasmaWindowInterface::setTitle(const QString &title) | ||
659 | { | 680 | { | ||
660 | d->setTitle(title); | 681 | d->setTitle(title); | ||
661 | } | 682 | } | ||
662 | 683 | | |||
663 | void PlasmaWindowInterface::setVirtualDesktop(quint32 desktop) | 684 | void PlasmaWindowInterface::setVirtualDesktop(quint32 desktop) | ||
664 | { | 685 | { | ||
665 | d->setVirtualDesktop(desktop); | 686 | d->setVirtualDesktop(desktop); | ||
▲ Show 20 Lines • Show All 126 Lines • Show Last 20 Lines |