00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef __net_wm_h
00028 #define __net_wm_h
00029
00030 #include "kdelibs_export.h"
00031 #include <qwidget.h>
00032 #ifdef Q_WS_X11
00033 #include <X11/Xlib.h>
00034 #include <X11/Xutil.h>
00035 #include <X11/Xatom.h>
00036
00037 #include "netwm_def.h"
00038
00039
00040 struct NETRootInfoPrivate;
00041 struct NETWinInfoPrivate;
00042
00043
00057 class KDECORE_EXPORT NETRootInfo : public NET {
00058 public:
00063
00064 enum { PROTOCOLS, WINDOW_TYPES, STATES, PROTOCOLS2, ACTIONS,
00065 PROPERTIES_SIZE };
00066
00100 NETRootInfo(Display *display, Window supportWindow, const char *wmName,
00101 const unsigned long properties[], int properties_size,
00102 int screen = -1, bool doActivate = true);
00103
00110 NETRootInfo(Display *display, Window supportWindow, const char *wmName,
00111 unsigned long properties, int screen = -1, bool doActivate = true) KDE_DEPRECATED;
00112
00135 NETRootInfo(Display *display, const unsigned long properties[], int properties_size,
00136 int screen = -1, bool doActivate = true);
00137
00144 NETRootInfo(Display *display, unsigned long properties, int screen = -1,
00145 bool doActivate = true);
00146
00152 NETRootInfo(const NETRootInfo &rootinfo);
00153
00157 virtual ~NETRootInfo();
00158
00164 Display *x11Display() const;
00165
00171 Window rootWindow() const;
00172
00178 Window supportWindow() const;
00179
00185 const char *wmName() const;
00186
00192 int screenNumber() const;
00193
00200 bool isSupported( NET::Property property ) const;
00205 bool isSupported( NET::Property2 property ) const;
00210 bool isSupported( NET::WindowType type ) const;
00215 bool isSupported( NET::State state ) const;
00216
00221 bool isSupported( NET::Action action ) const;
00222
00234 const unsigned long* supportedProperties() const;
00235
00242
00243 const unsigned long* passedProperties() const;
00244
00260 unsigned long supported() const KDE_DEPRECATED;
00261
00269 const Window *clientList() const;
00270
00278 int clientListCount() const;
00279
00288 const Window *clientListStacking() const;
00289
00297 int clientListStackingCount() const;
00298
00306 const Window *kdeSystemTrayWindows() const;
00307
00315 int kdeSystemTrayWindowsCount() const;
00316
00327 NETSize desktopGeometry(int desktop) const;
00328
00336 NETPoint desktopViewport(int desktop) const;
00337
00345 NETRect workArea(int desktop) const;
00346
00354 const char *desktopName(int desktop) const;
00355
00363 const Window *virtualRoots( ) const;
00364
00372 int virtualRootsCount() const;
00373
00379 int numberOfDesktops() const;
00380
00386 int currentDesktop() const;
00387
00393 Window activeWindow() const;
00394
00403 void activate();
00404
00412
00413 void setClientList(Window *windows, unsigned int count);
00414
00423 void setClientListStacking(Window *windows, unsigned int count);
00424
00432 void setKDESystemTrayWindows(Window *windows, unsigned int count);
00433
00439 void setCurrentDesktop(int desktop);
00440
00451 void setDesktopGeometry(int desktop, const NETSize &geometry);
00452
00460 void setDesktopViewport(int desktop, const NETPoint &viewport);
00461
00467 void setNumberOfDesktops(int numberOfDesktops);
00468
00476 void setDesktopName(int desktop, const char *desktopName);
00477
00490 void setActiveWindow(Window window, NET::RequestSource src,
00491 Time timestamp, Window active_window);
00492
00499 void setActiveWindow(Window window);
00500
00508 void setWorkArea(int desktop, const NETRect &workArea);
00509
00517 void setVirtualRoots(Window *windows, unsigned int count);
00518
00523 const NETRootInfo &operator=(const NETRootInfo &rootinfo);
00524
00532 void closeWindowRequest(Window window);
00533
00549 void moveResizeRequest(Window window, int x_root, int y_root,
00550 Direction direction);
00551
00567 void moveResizeWindowRequest(Window window, int flags, int x, int y, int width, int height );
00568
00573 void restackRequest(Window window, RequestSource source, Window above, int detail, Time timestamp);
00578 void restackRequest(Window window, Window above, int detail);
00579
00595 void event( XEvent* event, unsigned long* properties, int properties_size );
00596
00608 unsigned long event(XEvent *event);
00609
00610
00611 protected:
00618 virtual void addClient(Window window) { Q_UNUSED(window); }
00619
00626 virtual void removeClient(Window window) { Q_UNUSED(window); }
00627
00635 virtual void addSystemTrayWin(Window window) { Q_UNUSED(window); }
00636
00644 virtual void removeSystemTrayWin(Window window) { Q_UNUSED(window); }
00645
00653 virtual void changeNumberOfDesktops(int numberOfDesktops) { Q_UNUSED(numberOfDesktops); }
00654
00664 virtual void changeDesktopGeometry(int desktop, const NETSize &geom) { Q_UNUSED(desktop); Q_UNUSED(geom); }
00665
00675 virtual void changeDesktopViewport(int desktop, const NETPoint &viewport) { Q_UNUSED(desktop); Q_UNUSED(viewport); }
00676
00684 virtual void changeCurrentDesktop(int desktop) { Q_UNUSED(desktop); }
00685
00695 virtual KDE_DEPRECATED void changeActiveWindow(Window window) { Q_UNUSED(window); }
00696
00703 virtual void closeWindow(Window window) { Q_UNUSED(window); }
00704
00718 virtual void moveResize(Window window, int x_root, int y_root,
00719 unsigned long direction) { Q_UNUSED(window); Q_UNUSED(x_root); Q_UNUSED(y_root); Q_UNUSED(direction); }
00720
00721
00722 private:
00723 void update( const unsigned long[] );
00724 void setSupported();
00725 void setDefaultProperties();
00726 void updateSupportedProperties( Atom atom );
00727 Role role;
00728
00729 protected:
00730 virtual void virtual_hook( int id, void* data );
00731 private:
00732 NETRootInfoPrivate *p;
00733 friend class NETRootInfo2;
00734 friend class NETRootInfo3;
00735 };
00736
00743 class KDECORE_EXPORT NETRootInfo2
00744 : public NETRootInfo
00745 {
00746 public:
00747 NETRootInfo2(Display *display, Window supportWindow, const char *wmName,
00748 unsigned long properties[], int properties_size,
00749 int screen = -1, bool doActivate = true);
00754 void sendPing( Window window, Time timestamp );
00755 protected:
00756 friend class NETRootInfo;
00763 virtual void gotPing( Window window, Time timestamp ) { Q_UNUSED(window); Q_UNUSED(timestamp); }
00774 virtual void changeActiveWindow(Window window,NET::RequestSource src,
00775 Time timestamp, Window active_window ) { Q_UNUSED(window); Q_UNUSED(src); Q_UNUSED(timestamp); Q_UNUSED(active_window);}
00785 virtual void restackWindow(Window window, Window above, int detail) { Q_UNUSED(window); Q_UNUSED(above); Q_UNUSED(detail); }
00786
00799 virtual void moveResizeWindow(Window window, int flags, int x, int y, int width, int height) { Q_UNUSED(window); Q_UNUSED(flags); Q_UNUSED(x); Q_UNUSED(y); Q_UNUSED(width); Q_UNUSED(height); }
00800
00801
00802 };
00803
00810 class KDECORE_EXPORT NETRootInfo3
00811 : public NETRootInfo2
00812 {
00813 public:
00814 NETRootInfo3(Display *display, Window supportWindow, const char *wmName,
00815 unsigned long properties[], int properties_size,
00816 int screen = -1, bool doActivate = true);
00824 void takeActivity( Window window, Time timestamp, long flags );
00825 protected:
00826 friend class NETRootInfo;
00838 virtual void restackWindow(Window window, RequestSource source,
00839 Window above, int detail, Time timestamp) { Q_UNUSED(window); Q_UNUSED(source); Q_UNUSED(above); Q_UNUSED(detail); Q_UNUSED(timestamp); }
00847 virtual void gotTakeActivity(Window window, Time timestamp, long flags ) { Q_UNUSED(window); Q_UNUSED(timestamp); Q_UNUSED(flags); }
00848
00849 };
00850
00865 class KDECORE_EXPORT NETWinInfo : public NET {
00866 public:
00871
00872 enum { PROTOCOLS, PROTOCOLS2,
00873 PROPERTIES_SIZE };
00898 NETWinInfo(Display *display, Window window, Window rootWindow,
00899 const unsigned long properties[], int properties_size,
00900 Role role = Client);
00901
00908 NETWinInfo(Display *display, Window window,
00909 Window rootWindow, unsigned long properties,
00910 Role role = Client);
00911
00917 NETWinInfo(const NETWinInfo & wininfo);
00918
00922 virtual ~NETWinInfo();
00923
00928 const NETWinInfo &operator=(const NETWinInfo &wintinfo);
00929
00938 bool hasNETSupport() const;
00939
00946
00947 const unsigned long* passedProperties() const;
00948
00958 unsigned long properties() const KDE_DEPRECATED;
00959
00965 NETRect iconGeometry() const;
00966
00973 unsigned long state() const;
00974
00979 NETExtendedStrut extendedStrut() const;
00980
00987 NETStrut strut() const;
00988
01003 WindowType windowType( unsigned long supported_types ) const;
01004
01012 WindowType windowType() const KDE_DEPRECATED;
01013
01019 const char *name() const;
01020
01026 const char *visibleName() const;
01027
01037 const char *iconName() const;
01038
01048 const char *visibleIconName() const;
01049
01057 int desktop() const;
01058
01064 int pid() const;
01065
01071 Bool handledIcons() const;
01072
01079 Window kdeSystemTrayWinFor() const;
01080
01087 MappingState mappingState() const;
01088
01098 void setIcon(NETIcon icon, Bool replace = True);
01099
01105 void setIconGeometry(NETRect geometry);
01106
01112 void setExtendedStrut(const NETExtendedStrut& extended_strut );
01113
01120 void setStrut(NETStrut strut);
01121
01132 void setState(unsigned long state, unsigned long mask);
01133
01140 void setWindowType(WindowType type);
01141
01147 void setName(const char *name);
01148
01155 void setVisibleName(const char *visibleName);
01156
01162 void setIconName(const char *name);
01163
01170 void setVisibleIconName(const char *name);
01171
01179 void setDesktop(int desktop);
01180
01186 void setPid(int pid);
01187
01193 void setHandledIcons(Bool handled);
01194
01200 void setKDESystemTrayWinFor(Window window);
01201
01208 void setKDEFrameStrut(NETStrut strut);
01209
01221 NETIcon icon(int width = -1, int height = -1) const;
01222
01223
01224
01225
01226
01227
01228
01229
01230
01231 void setUserTime( Time time );
01232
01237 Time userTime() const;
01238
01239
01240
01241
01242
01243 void setStartupId( const char* startup_id );
01244
01249 const char* startupId() const;
01250
01255 void setAllowedActions( unsigned long actions );
01256
01261 unsigned long allowedActions() const;
01262
01263
01264
01265
01266
01267
01268 Window transientFor() const;
01269
01274 Window groupLeader() const;
01275
01281 const char* windowClassClass() const;
01282
01288 const char* windowClassName() const;
01289
01294 const char* windowRole() const;
01295
01300 const char* clientMachine() const;
01301
01310 void kdeGeometry(NETRect &frame, NETRect &window);
01311
01327 void event( XEvent* event, unsigned long* properties, int properties_size );
01328
01340 unsigned long event(XEvent *event);
01341
01348 static const int OnAllDesktops;
01349
01350
01351 protected:
01359 virtual void changeDesktop(int desktop) { Q_UNUSED(desktop); }
01360
01370 virtual void changeState(unsigned long state, unsigned long mask) { Q_UNUSED(state); Q_UNUSED(mask); }
01371
01372 private:
01373 void update( const unsigned long[] );
01374 void updateWMState();
01375 Role role;
01376
01377 protected:
01378 virtual void virtual_hook( int id, void* data );
01379 private:
01380 NETWinInfoPrivate *p;
01381 };
01382
01383
01384
01385
01386 #endif
01387 #endif // __net_wm_h