Changeset View
Changeset View
Standalone View
Standalone View
libkwineffects/kwineffects.cpp
Show First 20 Lines • Show All 802 Lines • ▼ Show 20 Line(s) | 792 | { | |||
---|---|---|---|---|---|
803 | d->x11Client = !d->waylandClient; | 803 | d->x11Client = !d->waylandClient; | ||
804 | d->popupWindow = parent->property("popupWindow").value<bool>(); | 804 | d->popupWindow = parent->property("popupWindow").value<bool>(); | ||
805 | } | 805 | } | ||
806 | 806 | | |||
807 | EffectWindow::~EffectWindow() | 807 | EffectWindow::~EffectWindow() | ||
808 | { | 808 | { | ||
809 | } | 809 | } | ||
810 | 810 | | |||
811 | #define WINDOW_HELPER( rettype, prototype, propertyname ) \ | | |||
812 | rettype EffectWindow::prototype ( ) const \ | | |||
813 | { \ | | |||
814 | return parent()->property( propertyname ).value< rettype >(); \ | | |||
815 | } | | |||
816 | | ||||
817 | WINDOW_HELPER(double, opacity, "opacity") | | |||
818 | WINDOW_HELPER(bool, hasAlpha, "alpha") | | |||
819 | WINDOW_HELPER(int, x, "x") | | |||
820 | WINDOW_HELPER(int, y, "y") | | |||
821 | WINDOW_HELPER(int, width, "width") | | |||
822 | WINDOW_HELPER(int, height, "height") | | |||
823 | WINDOW_HELPER(QPoint, pos, "pos") | | |||
824 | WINDOW_HELPER(QSize, size, "size") | | |||
825 | WINDOW_HELPER(int, screen, "screen") | | |||
826 | WINDOW_HELPER(QRect, geometry, "geometry") | | |||
827 | WINDOW_HELPER(QRect, expandedGeometry, "visibleRect") | | |||
828 | WINDOW_HELPER(QRect, rect, "rect") | | |||
829 | WINDOW_HELPER(int, desktop, "desktop") | | |||
830 | WINDOW_HELPER(bool, isDesktop, "desktopWindow") | | |||
831 | WINDOW_HELPER(bool, isDock, "dock") | | |||
832 | WINDOW_HELPER(bool, isToolbar, "toolbar") | | |||
833 | WINDOW_HELPER(bool, isMenu, "menu") | | |||
834 | WINDOW_HELPER(bool, isNormalWindow, "normalWindow") | | |||
835 | WINDOW_HELPER(bool, isDialog, "dialog") | | |||
836 | WINDOW_HELPER(bool, isSplash, "splash") | | |||
837 | WINDOW_HELPER(bool, isUtility, "utility") | | |||
838 | WINDOW_HELPER(bool, isDropdownMenu, "dropdownMenu") | | |||
839 | WINDOW_HELPER(bool, isPopupMenu, "popupMenu") | | |||
840 | WINDOW_HELPER(bool, isTooltip, "tooltip") | | |||
841 | WINDOW_HELPER(bool, isNotification, "notification") | | |||
842 | WINDOW_HELPER(bool, isOnScreenDisplay, "onScreenDisplay") | | |||
843 | WINDOW_HELPER(bool, isComboBox, "comboBox") | | |||
844 | WINDOW_HELPER(bool, isDNDIcon, "dndIcon") | | |||
845 | WINDOW_HELPER(bool, isDeleted, "deleted") | | |||
846 | WINDOW_HELPER(bool, hasOwnShape, "shaped") | | |||
847 | WINDOW_HELPER(QString, windowRole, "windowRole") | | |||
848 | WINDOW_HELPER(QStringList, activities, "activities") | | |||
849 | WINDOW_HELPER(bool, skipsCloseAnimation, "skipsCloseAnimation") | | |||
850 | WINDOW_HELPER(KWayland::Server::SurfaceInterface *, surface, "surface") | | |||
851 | | ||||
852 | QString EffectWindow::windowClass() const | | |||
853 | { | | |||
854 | return parent()->property("resourceName").toString() + QLatin1Char(' ') + parent()->property("resourceClass").toString(); | | |||
855 | } | | |||
856 | | ||||
857 | QRect EffectWindow::contentsRect() const | | |||
858 | { | | |||
859 | return QRect(parent()->property("clientPos").toPoint(), parent()->property("clientSize").toSize()); | | |||
860 | } | | |||
861 | | ||||
862 | NET::WindowType EffectWindow::windowType() const | | |||
863 | { | | |||
864 | return static_cast<NET::WindowType>(parent()->property("windowType").toInt()); | | |||
865 | } | | |||
866 | | ||||
867 | bool EffectWindow::isOnActivity(QString activity) const | 811 | bool EffectWindow::isOnActivity(QString activity) const | ||
868 | { | 812 | { | ||
869 | const QStringList activities = parent()->property("activities").toStringList(); | 813 | const QStringList _activities = activities(); | ||
870 | return activities.isEmpty() || activities.contains(activity); | 814 | return _activities.isEmpty() || _activities.contains(activity); | ||
871 | } | 815 | } | ||
872 | 816 | | |||
873 | bool EffectWindow::isOnAllActivities() const | 817 | bool EffectWindow::isOnAllActivities() const | ||
874 | { | 818 | { | ||
875 | return parent()->property("activities").toStringList().isEmpty(); | 819 | return activities().isEmpty(); | ||
876 | } | 820 | } | ||
877 | 821 | | |||
878 | #undef WINDOW_HELPER | | |||
879 | | ||||
880 | #define WINDOW_HELPER_DEFAULT( rettype, prototype, propertyname, defaultValue ) \ | | |||
881 | rettype EffectWindow::prototype ( ) const \ | | |||
882 | { \ | | |||
883 | const QVariant variant = parent()->property( propertyname ); \ | | |||
884 | if (!variant.isValid()) { \ | | |||
885 | return defaultValue; \ | | |||
886 | } \ | | |||
887 | return variant.value< rettype >(); \ | | |||
888 | } | | |||
889 | | ||||
890 | WINDOW_HELPER_DEFAULT(bool, isMinimized, "minimized", false) | | |||
891 | WINDOW_HELPER_DEFAULT(bool, isMovable, "moveable", false) | | |||
892 | WINDOW_HELPER_DEFAULT(bool, isMovableAcrossScreens, "moveableAcrossScreens", false) | | |||
893 | WINDOW_HELPER_DEFAULT(QString, caption, "caption", QString()) | | |||
894 | WINDOW_HELPER_DEFAULT(bool, keepAbove, "keepAbove", true) | | |||
895 | WINDOW_HELPER_DEFAULT(bool, keepBelow, "keepBelow", false) | | |||
896 | WINDOW_HELPER_DEFAULT(bool, isModal, "modal", false) | | |||
897 | WINDOW_HELPER_DEFAULT(QSize, basicUnit, "basicUnit", QSize(1, 1)) | | |||
898 | WINDOW_HELPER_DEFAULT(bool, isUserMove, "move", false) | | |||
899 | WINDOW_HELPER_DEFAULT(bool, isUserResize, "resize", false) | | |||
900 | WINDOW_HELPER_DEFAULT(QRect, iconGeometry, "iconGeometry", QRect()) | | |||
901 | WINDOW_HELPER_DEFAULT(bool, isSpecialWindow, "specialWindow", true) | | |||
902 | WINDOW_HELPER_DEFAULT(bool, acceptsFocus, "wantsInput", true) // We don't actually know... | | |||
903 | WINDOW_HELPER_DEFAULT(QIcon, icon, "icon", QIcon()) | | |||
904 | WINDOW_HELPER_DEFAULT(bool, isSkipSwitcher, "skipSwitcher", false) | | |||
905 | WINDOW_HELPER_DEFAULT(bool, isCurrentTab, "isCurrentTab", true) | | |||
906 | WINDOW_HELPER_DEFAULT(bool, decorationHasAlpha, "decorationHasAlpha", false) | | |||
907 | WINDOW_HELPER_DEFAULT(bool, isFullScreen, "fullScreen", false) | | |||
908 | WINDOW_HELPER_DEFAULT(bool, isUnresponsive, "unresponsive", false) | | |||
909 | | ||||
910 | #undef WINDOW_HELPER_DEFAULT | | |||
911 | | ||||
912 | #define WINDOW_HELPER_SETTER( prototype, propertyname, args, value ) \ | 822 | #define WINDOW_HELPER_SETTER( prototype, propertyname, args, value ) \ | ||
913 | void EffectWindow::prototype ( args ) \ | 823 | void EffectWindow::prototype ( args ) \ | ||
914 | {\ | 824 | {\ | ||
915 | const QVariant variant = parent()->property( propertyname ); \ | 825 | const QVariant variant = parent()->property( propertyname ); \ | ||
916 | if (variant.isValid()) { \ | 826 | if (variant.isValid()) { \ | ||
917 | parent()->setProperty( propertyname, value ); \ | 827 | parent()->setProperty( propertyname, value ); \ | ||
918 | } \ | 828 | } \ | ||
919 | } | 829 | } | ||
▲ Show 20 Lines • Show All 1174 Lines • Show Last 20 Lines |