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 netwm_h
00028 #define netwm_h
00029
00030 #include <kdeui_export.h>
00031 #include <QtGui/QWidget>
00032 #ifdef Q_WS_X11
00033 #include <X11/Xlib.h>
00034 #include <X11/Xutil.h>
00035 #include <X11/Xatom.h>
00036 #include <fixx11h.h>
00037
00038 #include "netwm_def.h"
00039
00040
00041 struct NETRootInfoPrivate;
00042 struct NETWinInfoPrivate;
00043 template <class Z> class NETRArray;
00044
00045
00058 class KDEUI_EXPORT NETRootInfo : public NET {
00059 public:
00063
00064 enum { PROTOCOLS, WINDOW_TYPES, STATES, PROTOCOLS2, ACTIONS,
00065 PROPERTIES_SIZE };
00066
00098 NETRootInfo(Display *display, Window supportWindow, const char *wmName,
00099 const unsigned long properties[], int properties_size,
00100 int screen = -1, bool doActivate = true);
00101
00102
00123 NETRootInfo(Display *display, const unsigned long properties[], int properties_size,
00124 int screen = -1, bool doActivate = true);
00125
00132 NETRootInfo(Display *display, unsigned long properties, int screen = -1,
00133 bool doActivate = true);
00134
00140 NETRootInfo(const NETRootInfo &rootinfo);
00141
00145 virtual ~NETRootInfo();
00146
00152 Display *x11Display() const;
00153
00159 Window rootWindow() const;
00160
00166 Window supportWindow() const;
00167
00173 const char *wmName() const;
00174
00180 int screenNumber() const;
00181
00187 bool isSupported( NET::Property property ) const;
00191 bool isSupported( NET::Property2 property ) const;
00195 bool isSupported( NET::WindowType type ) const;
00199 bool isSupported( NET::State state ) const;
00200
00204 bool isSupported( NET::Action action ) const;
00205
00215 const unsigned long* supportedProperties() const;
00216
00221 const unsigned long* passedProperties() const;
00222
00230 const Window *clientList() const;
00231
00239 int clientListCount() const;
00240
00249 const Window *clientListStacking() const;
00250
00258 int clientListStackingCount() const;
00259
00274 NETSize desktopGeometry(int desktop) const;
00275
00287 NETPoint desktopViewport(int desktop) const;
00288
00296 NETRect workArea(int desktop) const;
00297
00305 const char *desktopName(int desktop) const;
00306
00314 const Window *virtualRoots( ) const;
00315
00323 int virtualRootsCount() const;
00324
00328 NET::Orientation desktopLayoutOrientation() const;
00329
00334 QSize desktopLayoutColumnsRows() const;
00335
00339 NET::DesktopLayoutCorner desktopLayoutCorner() const;
00340
00352 int numberOfDesktops( bool ignore_viewport = false ) const;
00353
00365 int currentDesktop( bool ignore_viewport = false ) const;
00366
00372 Window activeWindow() const;
00373
00382 void activate();
00383
00391 void setClientList(const Window *windows, unsigned int count);
00392
00401 void setClientListStacking(const Window *windows, unsigned int count);
00402
00413 void setCurrentDesktop(int desktop, bool ignore_viewport = false);
00414
00429 void setDesktopGeometry(int desktop, const NETSize &geometry);
00430
00442 void setDesktopViewport(int desktop, const NETPoint &viewport);
00443
00453 void setNumberOfDesktops(int numberOfDesktops);
00454
00466 void setDesktopName(int desktop, const char *desktopName);
00467
00478 void setActiveWindow(Window window, NET::RequestSource src,
00479 Time timestamp, Window active_window);
00480
00487 void setActiveWindow(Window window);
00488
00496 void setWorkArea(int desktop, const NETRect &workArea);
00497
00505 void setVirtualRoots(const Window *windows, unsigned int count);
00506
00511 void setDesktopLayout(NET::Orientation orientation, int columns, int rows,
00512 NET::DesktopLayoutCorner corner);
00513
00517 void setShowingDesktop( bool showing );
00521 bool showingDesktop() const;
00522
00527 const NETRootInfo &operator=(const NETRootInfo &rootinfo);
00528
00536 void closeWindowRequest(Window window);
00537
00553 void moveResizeRequest(Window window, int x_root, int y_root,
00554 Direction direction);
00555
00569 void moveResizeWindowRequest(Window window, int flags, int x, int y, int width, int height );
00570
00574 void restackRequest(Window window, RequestSource source, Window above, int detail, Time timestamp);
00575
00580 void sendPing( Window window, Time timestamp );
00581
00589 void takeActivity( Window window, Time timestamp, long flags );
00590
00605 void event( XEvent* event, unsigned long* properties, int properties_size );
00606
00618 unsigned long event(XEvent *event);
00619
00620
00621 protected:
00628 virtual void addClient(Window window) { Q_UNUSED(window); }
00629
00636 virtual void removeClient(Window window) { Q_UNUSED(window); }
00637
00645 virtual void changeNumberOfDesktops(int numberOfDesktops) { Q_UNUSED(numberOfDesktops); }
00646
00656 virtual void changeDesktopGeometry(int desktop, const NETSize &geom) { Q_UNUSED(desktop); Q_UNUSED(geom); }
00657
00667 virtual void changeDesktopViewport(int desktop, const NETPoint &viewport) { Q_UNUSED(desktop); Q_UNUSED(viewport); }
00668
00676 virtual void changeCurrentDesktop(int desktop) { Q_UNUSED(desktop); }
00677
00684 virtual void closeWindow(Window window) { Q_UNUSED(window); }
00685
00699 virtual void moveResize(Window window, int x_root, int y_root,
00700 unsigned long direction) { Q_UNUSED(window); Q_UNUSED(x_root); Q_UNUSED(y_root); Q_UNUSED(direction); }
00701
00708 virtual void gotPing( Window window, Time timestamp ) { Q_UNUSED(window); Q_UNUSED(timestamp); }
00719 virtual void changeActiveWindow(Window window,NET::RequestSource src,
00720 Time timestamp, Window active_window ) { Q_UNUSED(window); Q_UNUSED(src); Q_UNUSED(timestamp); Q_UNUSED(active_window);}
00721
00734 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); }
00735
00747 virtual void restackWindow(Window window, RequestSource source,
00748 Window above, int detail, Time timestamp) { Q_UNUSED(window); Q_UNUSED(source); Q_UNUSED(above); Q_UNUSED(detail); Q_UNUSED(timestamp); }
00756 virtual void gotTakeActivity(Window window, Time timestamp, long flags ) { Q_UNUSED(window); Q_UNUSED(timestamp); Q_UNUSED(flags); }
00757
00765 virtual void changeShowingDesktop(bool showing) { Q_UNUSED(showing); }
00766
00767 private:
00768 void update( const unsigned long[] );
00769 void setSupported();
00770 void setDefaultProperties();
00771 void updateSupportedProperties( Atom atom );
00772
00773 protected:
00777 virtual void virtual_hook( int id, void* data );
00778 private:
00779 NETRootInfoPrivate *p;
00780 };
00781
00795 class KDEUI_EXPORT NETWinInfo : public NET {
00796 public:
00800
00801 enum { PROTOCOLS, PROTOCOLS2,
00802 PROPERTIES_SIZE };
00825 NETWinInfo(Display *display, Window window, Window rootWindow,
00826 const unsigned long properties[], int properties_size,
00827 Role role = Client);
00828
00835 NETWinInfo(Display *display, Window window,
00836 Window rootWindow, unsigned long properties,
00837 Role role = Client);
00838
00844 NETWinInfo(const NETWinInfo & wininfo);
00845
00849 virtual ~NETWinInfo();
00850
00855 const NETWinInfo &operator=(const NETWinInfo &wintinfo);
00856
00864 bool hasNETSupport() const;
00865
00870 const unsigned long* passedProperties() const;
00871
00877 NETRect iconGeometry() const;
00878
00885 unsigned long state() const;
00886
00891 NETExtendedStrut extendedStrut() const;
00892
00899 NETStrut strut() const;
00900
00914 WindowType windowType( unsigned long supported_types ) const;
00915
00921 bool hasWindowType() const;
00922
00928 const char *name() const;
00929
00935 const char *visibleName() const;
00936
00946 const char *iconName() const;
00947
00957 const char *visibleIconName() const;
00958
00972 int desktop( bool ignore_viewport = false ) const;
00973
00979 int pid() const;
00980
00986 Bool handledIcons() const;
00987
00994 MappingState mappingState() const;
00995
01005 void setIcon(NETIcon icon, Bool replace = True);
01006
01012 void setIconGeometry(NETRect geometry);
01013
01019 void setExtendedStrut(const NETExtendedStrut& extended_strut );
01020
01027 void setStrut(NETStrut strut);
01028
01037 void setState(unsigned long state, unsigned long mask);
01038
01045 void setWindowType(WindowType type);
01046
01052 void setName(const char *name);
01053
01060 void setVisibleName(const char *visibleName);
01061
01067 void setIconName(const char *name);
01068
01075 void setVisibleIconName(const char *name);
01076
01089 void setDesktop(int desktop, bool ignore_viewport = false);
01090
01096 void setPid(int pid);
01097
01103 void setHandledIcons(Bool handled);
01104
01110 void setFrameExtents(NETStrut strut);
01111
01117 NETStrut frameExtents() const;
01118
01130 NETIcon icon(int width = -1, int height = -1) const;
01131
01137 const int* iconSizes() const;
01138
01146 void setUserTime( Time time );
01147
01151 Time userTime() const;
01152
01156 void setStartupId( const char* startup_id );
01157
01161 const char* startupId() const;
01162
01166 void setOpacity( unsigned long opacity );
01167
01171 unsigned long opacity() const;
01172
01176 void setAllowedActions( unsigned long actions );
01177
01181 unsigned long allowedActions() const;
01182
01187 Window transientFor() const;
01188
01192 Window groupLeader() const;
01193
01198 const char* windowClassClass() const;
01199
01204 const char* windowClassName() const;
01205
01209 const char* windowRole() const;
01210
01214 const char* clientMachine() const;
01215
01224 void kdeGeometry(NETRect &frame, NETRect &window);
01225
01239 void event( XEvent* event, unsigned long* properties, int properties_size );
01240
01252 unsigned long event(XEvent *event);
01253
01260 static const int OnAllDesktops;
01261
01262 protected:
01270 virtual void changeDesktop(int desktop) { Q_UNUSED(desktop); }
01271
01281 virtual void changeState(unsigned long state, unsigned long mask) { Q_UNUSED(state); Q_UNUSED(mask); }
01282
01283 private:
01284 void update( const unsigned long[] );
01285 void updateWMState();
01286 void setIconInternal(NETRArray<NETIcon>& icons, int& icon_count, Atom property, NETIcon icon, Bool replace);
01287 NETIcon iconInternal(NETRArray<NETIcon>& icons, int icon_count, int width, int height) const;
01288
01289 protected:
01293 virtual void virtual_hook( int id, void* data );
01294 private:
01295 NETWinInfoPrivate *p;
01296 friend class NETWinInfo2;
01297 };
01298
01299
01306 class KDEUI_EXPORT NETWinInfo2 : public NETWinInfo {
01307 public:
01308 NETWinInfo2(Display *display, Window window, Window rootWindow,
01309 const unsigned long properties[], int properties_size,
01310 Role role = Client);
01311
01312 NETWinInfo2(Display *display, Window window,
01313 Window rootWindow, unsigned long properties,
01314 Role role = Client);
01315
01332 void setFullscreenMonitors(NETFullscreenMonitors topology);
01333
01339 NETFullscreenMonitors fullscreenMonitors() const;
01340
01341 protected:
01342 friend class NETWinInfo;
01351 virtual void changeFullscreenMonitors(NETFullscreenMonitors topology) { Q_UNUSED(topology); }
01352 };
01353
01354
01355
01356 #endif
01357 #endif // netwm_h