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 "kdemacros.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 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
00562
void moveResizeWindowRequest(Window window,
int flags,
int x,
int y,
int width,
int height );
00563
00567
void restackRequest(Window window, Window above,
int detail);
00568
00584
void event( XEvent* event,
unsigned long* properties,
int properties_size );
00585
00597
unsigned long event(XEvent *event);
00598
00599
00600 protected:
00607
00608 virtual
void addClient(Window) { }
00609
00616
00617
virtual void removeClient(Window) { }
00618
00626
00627
virtual void addSystemTrayWin(Window) { }
00628
00636
00637
virtual void removeSystemTrayWin(Window) { }
00638
00646
00647
virtual void changeNumberOfDesktops(
int) { }
00648
00658
00659
virtual void changeDesktopGeometry(
int,
const NETSize &) { }
00660
00670
00671
virtual void changeDesktopViewport(
int,
const NETPoint &) { }
00672
00680
00681
virtual void changeCurrentDesktop(
int) { }
00682
00692
00693
virtual KDE_DEPRECATED
void changeActiveWindow(Window) { }
00694
00701
00702
virtual void closeWindow(Window) { }
00703
00717
00718
00719
virtual void moveResize(Window,
int,
int,
unsigned long) { }
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 };
00735
00742
class NETRootInfo2
00743 :
public NETRootInfo
00744 {
00745
public:
00746 NETRootInfo2(Display *display, Window supportWindow,
const char *wmName,
00747
unsigned long properties[],
int properties_size,
00748
int screen = -1,
bool doActivate =
true);
00753
void sendPing( Window window, Time timestamp );
00754
protected:
00755
friend class NETRootInfo;
00762
00763
virtual void gotPing( Window, Time ) {};
00774
00775
00776
virtual void changeActiveWindow(Window,NET::RequestSource,Time,Window) { }
00786
00787
virtual void restackWindow(Window, Window,
int) { }
00788
00796
00797
virtual void moveResizeWindow( Window,
int,
int,
int,
int,
int ) { }
00798
00799
00800 };
00801
00816
class NETWinInfo :
public NET {
00817
public:
00822
00823
enum { PROTOCOLS, PROTOCOLS2,
00824 PROPERTIES_SIZE };
00849 NETWinInfo(Display *display, Window window, Window rootWindow,
00850
const unsigned long properties[],
int properties_size,
00851 Role role = Client);
00852
00859 NETWinInfo(Display *display, Window window,
00860 Window rootWindow,
unsigned long properties,
00861 Role role = Client);
00862
00868 NETWinInfo(
const NETWinInfo & wininfo);
00869
00873
virtual ~NETWinInfo();
00874
00879
const NETWinInfo &operator=(
const NETWinInfo &wintinfo);
00880
00889
bool hasNETSupport() const;
00890
00897
00898 const
unsigned long* passedProperties() const;
00899
00909
unsigned long properties() const KDE_DEPRECATED;
00910
00916
NETRect iconGeometry() const;
00917
00924
unsigned long state() const;
00925
00931
NETStrut strut() const;
00932
00947 WindowType windowType(
unsigned long supported_types ) const;
00948
00956 WindowType windowType() const KDE_DEPRECATED;
00957
00963 const
char *name() const;
00964
00970 const
char *visibleName() const;
00971
00981 const
char *iconName() const;
00982
00992 const
char *visibleIconName() const;
00993
01001
int desktop() const;
01002
01008
int pid() const;
01009
01015 Bool handledIcons() const;
01016
01023 Window kdeSystemTrayWinFor() const;
01024
01031 MappingState mappingState() const;
01032
01042
void setIcon(
NETIcon icon, Bool replace = True);
01043
01049
void setIconGeometry(
NETRect geometry);
01050
01056
void setStrut(
NETStrut strut);
01057
01068
void setState(
unsigned long state,
unsigned long mask);
01069
01076
void setWindowType(WindowType type);
01077
01083
void setName(const
char *name);
01084
01091
void setVisibleName(const
char *visibleName);
01092
01098
void setIconName(const
char *name);
01099
01106
void setVisibleIconName(const
char *name);
01107
01115
void setDesktop(
int desktop);
01116
01122
void setPid(
int pid);
01123
01129
void setHandledIcons(Bool handled);
01130
01136
void setKDESystemTrayWinFor(Window window);
01137
01144
void setKDEFrameStrut(
NETStrut strut);
01145
01157
NETIcon icon(
int width = -1,
int height = -1) const;
01158
01159
01160
01161
01162
01163
01164
01165
01166
01167
void setUserTime( Time time );
01168
01173 Time userTime() const;
01174
01175
01176
01177
01178
01179
void setStartupId( const
char* startup_id );
01180
01185 const
char* startupId() const;
01186
01191
void setAllowedActions(
unsigned long actions );
01192
01197
unsigned long allowedActions() const;
01198
01199
01200
01201
01202
01203
01204 Window transientFor() const;
01205
01210 Window groupLeader() const;
01211
01220
void kdeGeometry(
NETRect &frame,
NETRect &window);
01221
01237
void event( XEvent* event,
unsigned long* properties,
int properties_size );
01238
01250
unsigned long event(XEvent *event);
01251
01258 static const
int OnAllDesktops;
01259
01260
01261 protected:
01269
01270 virtual
void changeDesktop(
int) { }
01271
01281
virtual void changeState(
unsigned long ,
unsigned long ) { }
01282
01283
private:
01284
void update(
const unsigned long[] );
01285
void updateWMState();
01286 Role role;
01287
01288
protected:
01289
virtual void virtual_hook(
int id,
void* data );
01290
private:
01291
NETWinInfoPrivate *p;
01292 };
01293
01294
01295
01296
01297
#endif
01298
#endif // __net_wm_h