utils.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef KWIN_UTILS_H
00013 #define KWIN_UTILS_H
00014
00015 #include <qvaluelist.h>
00016 #include <qwidget.h>
00017 #include <kmanagerselection.h>
00018 #include <netwm_def.h>
00019
00020 namespace KWinInternal
00021 {
00022
00023 const int SUPPORTED_WINDOW_TYPES_MASK = NET::NormalMask | NET::DesktopMask | NET::DockMask
00024 | NET::ToolbarMask | NET::MenuMask | NET::DialogMask | NET::OverrideMask | NET::TopMenuMask
00025 | NET::UtilityMask | NET::SplashMask;
00026
00027 const long ClientWinMask = KeyPressMask | KeyReleaseMask |
00028 ButtonPressMask | ButtonReleaseMask |
00029 KeymapStateMask |
00030 ButtonMotionMask |
00031 PointerMotionMask |
00032 EnterWindowMask | LeaveWindowMask |
00033 FocusChangeMask |
00034 ExposureMask |
00035 StructureNotifyMask |
00036 SubstructureRedirectMask;
00037
00038 const QPoint invalidPoint( INT_MIN, INT_MIN );
00039
00040 class Client;
00041 class Group;
00042 class Options;
00043
00044 typedef QValueList< Client* > ClientList;
00045 typedef QValueList< const Client* > ConstClientList;
00046
00047 typedef QValueList< Group* > GroupList;
00048 typedef QValueList< const Group* > ConstGroupList;
00049
00050 extern Options* options;
00051
00052 enum Layer
00053 {
00054 UnknownLayer = -1,
00055 FirstLayer = 0,
00056 DesktopLayer = FirstLayer,
00057 BelowLayer,
00058 NormalLayer,
00059 DockLayer,
00060 AboveLayer,
00061 ActiveLayer,
00062 NumLayers
00063 };
00064
00065
00066 inline void operator++( Layer& lay )
00067 {
00068 lay = static_cast< Layer >( lay + 1 );
00069 }
00070
00071
00072 enum ActivityFlags
00073 {
00074 ActivityFocus = 1 << 0,
00075 ActivityFocusForce = 1 << 1,
00076 ActivityRaise = 1 << 2
00077 };
00078
00079
00080
00081
00082
00083 enum allowed_t { Allowed };
00084
00085
00086 enum ForceGeometry_t { NormalGeometrySet, ForceGeometrySet };
00087
00088
00089 enum clientAreaOption
00090 {
00091 PlacementArea,
00092 MovementArea,
00093 MaximizeArea,
00094 MaximizeFullArea,
00095 FullScreenArea,
00096
00097 WorkArea,
00098 FullArea,
00099 ScreenArea
00100 };
00101
00102 enum ShadeMode
00103 {
00104 ShadeNone,
00105 ShadeNormal,
00106 ShadeHover,
00107 ShadeActivated
00108 };
00109
00110 class Shape
00111 {
00112 public:
00113 static bool available() { return kwin_has_shape; }
00114 static bool hasShape( WId w);
00115 static int shapeEvent();
00116 static void init();
00117 private:
00118 static int kwin_has_shape;
00119 static int kwin_shape_event;
00120 };
00121
00122 class Motif
00123 {
00124 public:
00125 static void readFlags( WId w, bool& noborder, bool& resize, bool& move,
00126 bool& minimize, bool& maximize, bool& close );
00127 struct MwmHints
00128 {
00129 ulong flags;
00130 ulong functions;
00131 ulong decorations;
00132 long input_mode;
00133 ulong status;
00134 };
00135 enum {
00136 MWM_HINTS_FUNCTIONS = (1L << 0),
00137 MWM_HINTS_DECORATIONS = (1L << 1),
00138
00139 MWM_FUNC_ALL = (1L << 0),
00140 MWM_FUNC_RESIZE = (1L << 1),
00141 MWM_FUNC_MOVE = (1L << 2),
00142 MWM_FUNC_MINIMIZE = (1L << 3),
00143 MWM_FUNC_MAXIMIZE = (1L << 4),
00144 MWM_FUNC_CLOSE = (1L << 5)
00145 };
00146 };
00147
00148 class KWinSelectionOwner
00149 : public KSelectionOwner
00150 {
00151 Q_OBJECT
00152 public:
00153 KWinSelectionOwner( int screen );
00154 protected:
00155 virtual bool genericReply( Atom target, Atom property, Window requestor );
00156 virtual void replyTargets( Atom property, Window requestor );
00157 virtual void getAtoms();
00158 private:
00159 Atom make_selection_atom( int screen );
00160 static Atom xa_version;
00161 };
00162
00163
00164 QCString getStringProperty(WId w, Atom prop, char separator=0);
00165 void updateXTime();
00166 void grabXServer();
00167 void ungrabXServer();
00168
00169
00170 #ifndef UrgencyHint
00171 #define UrgencyHint XUrgencyHint
00172 #endif
00173
00174
00175 #define KWIN_CHECK_PREDICATE( name, check ) \
00176 struct name \
00177 { \
00178 inline bool operator()( const Client* cl ) { return check; }; \
00179 }
00180
00181 #define KWIN_COMPARE_PREDICATE( name, type, check ) \
00182 struct name \
00183 { \
00184 typedef type type_helper; \
00185 inline name( const type_helper& compare_value ) : value( compare_value ) {}; \
00186 inline bool operator()( const Client* cl ) { return check; }; \
00187 const type_helper& value; \
00188 }
00189
00190 #define KWIN_PROCEDURE( name, action ) \
00191 struct name \
00192 { \
00193 inline void operator()( Client* cl ) { action; }; \
00194 }
00195
00196 KWIN_CHECK_PREDICATE( TruePredicate, cl == cl );
00197
00198 template< typename T >
00199 Client* findClientInList( const ClientList& list, T predicate )
00200 {
00201 for ( ClientList::ConstIterator it = list.begin(); it != list.end(); ++it)
00202 {
00203 if ( predicate( const_cast< const Client* >( *it)))
00204 return *it;
00205 }
00206 return NULL;
00207 }
00208
00209 inline
00210 int timestampCompare( Time time1, Time time2 )
00211 {
00212 if( time1 == time2 )
00213 return 0;
00214 return ( time1 - time2 ) < 1000000000 ? 1 : -1;
00215 }
00216
00217 inline
00218 Time timestampDiff( Time time1, Time time2 )
00219 {
00220 return time2 - time1;
00221 }
00222
00223 bool isLocalMachine( const QCString& host );
00224
00225 }
00226
00227 #endif
This file is part of the documentation for kwin Library Version 3.3.0.