• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

  • tdecore
netwm.h
1 /*
2 
3  Copyright (c) 2000 Troll Tech AS
4  Copyright (c) 2003 Lubos Lunak <l.lunak@kde.org>
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23 
24 */
25 
26 
27 #ifndef __net_wm_h
28 #define __net_wm_h
29 
30 #include "tdelibs_export.h"
31 #include <tqwidget.h>
32 #ifdef TQ_WS_X11
33 #include <X11/Xlib.h>
34 #include <X11/Xutil.h>
35 #include <X11/Xatom.h>
36 
37 #include "netwm_def.h"
38 
39 // forward declaration
40 struct NETRootInfoPrivate;
41 struct NETWinInfoPrivate;
42 template <class Z> class NETRArray;
43 
44 
58 class TDECORE_EXPORT NETRootInfo : public NET {
59 public:
64  // update also NETRootInfoPrivate::properties[] size when extending this
65  enum { PROTOCOLS, WINDOW_TYPES, STATES, PROTOCOLS2, ACTIONS,
66  PROPERTIES_SIZE };
67 
101  NETRootInfo(Display *display, Window supportWindow, const char *wmName,
102  const unsigned long properties[], int properties_size,
103  int screen = -1, bool doActivate = true);
104 
111  NETRootInfo(Display *display, Window supportWindow, const char *wmName,
112  unsigned long properties, int screen = -1, bool doActivate = true) TDE_DEPRECATED;
113 
136  NETRootInfo(Display *display, const unsigned long properties[], int properties_size,
137  int screen = -1, bool doActivate = true);
138 
145  NETRootInfo(Display *display, unsigned long properties, int screen = -1,
146  bool doActivate = true);
147 
153  NETRootInfo(const NETRootInfo &rootinfo);
154 
158  virtual ~NETRootInfo();
159 
165  Display *x11Display() const;
166 
172  Window rootWindow() const;
173 
179  Window supportWindow() const;
180 
186  const char *wmName() const;
187 
193  int screenNumber() const;
194 
201  bool isSupported( NET::Property property ) const;
206  bool isSupported( NET::Property2 property ) const;
211  bool isSupported( NET::WindowType type ) const;
216  bool isSupported( NET::State state ) const;
217 
222  bool isSupported( NET::Action action ) const;
223 
235  const unsigned long* supportedProperties() const;
236 
243  // KDE4 better name?
244  const unsigned long* passedProperties() const;
245 
261  unsigned long supported() const TDE_DEPRECATED;
262 
270  const Window *clientList() const;
271 
279  int clientListCount() const;
280 
289  const Window *clientListStacking() const;
290 
298  int clientListStackingCount() const;
299 
307  const Window *kdeSystemTrayWindows() const;
308 
316  int kdeSystemTrayWindowsCount() const;
317 
328  NETSize desktopGeometry(int desktop) const;
329 
337  NETPoint desktopViewport(int desktop) const;
338 
346  NETRect workArea(int desktop) const;
347 
355  const char *desktopName(int desktop) const;
356 
364  const Window *virtualRoots( ) const;
365 
373  int virtualRootsCount() const;
374 
378  NET::Orientation desktopLayoutOrientation() const;
379 
384  TQSize desktopLayoutColumnsRows() const;
385 
389  NET::DesktopLayoutCorner desktopLayoutCorner() const;
390 
396  int numberOfDesktops() const;
397 
403  int currentDesktop() const;
404 
410  Window activeWindow() const;
411 
420  void activate();
421 
429  // KDE4 'const Window*', also in the others below
430  void setClientList(Window *windows, unsigned int count);
431 
440  void setClientListStacking(Window *windows, unsigned int count);
441 
449  void setKDESystemTrayWindows(Window *windows, unsigned int count);
450 
456  void setCurrentDesktop(int desktop);
457 
468  void setDesktopGeometry(int desktop, const NETSize &geometry);
469 
477  void setDesktopViewport(int desktop, const NETPoint &viewport);
478 
484  void setNumberOfDesktops(int numberOfDesktops);
485 
493  void setDesktopName(int desktop, const char *desktopName);
494 
507  void setActiveWindow(Window window, NET::RequestSource src,
508  Time timestamp, Window active_window);
509 
516  void setActiveWindow(Window window);
517 
525  void setWorkArea(int desktop, const NETRect &workArea);
526 
534  void setVirtualRoots(Window *windows, unsigned int count);
535 
540  void setDesktopLayout(NET::Orientation orientation, int columns, int rows,
541  NET::DesktopLayoutCorner corner);
542 
547  void setShowingDesktop( bool showing );
552  bool showingDesktop() const;
553 
558  const NETRootInfo &operator=(const NETRootInfo &rootinfo);
559 
567  void closeWindowRequest(Window window);
568 
584  void moveResizeRequest(Window window, int x_root, int y_root,
585  Direction direction);
586 
602  void moveResizeWindowRequest(Window window, int flags, int x, int y, int width, int height );
603 
608  void restackRequest(Window window, RequestSource source, Window above, int detail, Time timestamp);
613  void restackRequest(Window window, Window above, int detail);
614 
630  void event( XEvent* event, unsigned long* properties, int properties_size );
631 
643  unsigned long event(XEvent *event);
644 
645 
646 protected:
653  virtual void addClient(Window window) { Q_UNUSED(window); }
654 
661  virtual void removeClient(Window window) { Q_UNUSED(window); }
662 
670  virtual void addSystemTrayWin(Window window) { Q_UNUSED(window); }
671 
679  virtual void removeSystemTrayWin(Window window) { Q_UNUSED(window); }
680 
688  virtual void changeNumberOfDesktops(int numberOfDesktops) { Q_UNUSED(numberOfDesktops); }
689 
699  virtual void changeDesktopGeometry(int desktop, const NETSize &geom) { Q_UNUSED(desktop); Q_UNUSED(geom); }
700 
710  virtual void changeDesktopViewport(int desktop, const NETPoint &viewport) { Q_UNUSED(desktop); Q_UNUSED(viewport); }
711 
719  virtual void changeCurrentDesktop(int desktop) { Q_UNUSED(desktop); }
720 
730  virtual TDE_DEPRECATED void changeActiveWindow(Window window) { Q_UNUSED(window); }
731 
738  virtual void closeWindow(Window window) { Q_UNUSED(window); }
739 
753  virtual void moveResize(Window window, int x_root, int y_root,
754  unsigned long direction) { Q_UNUSED(window); Q_UNUSED(x_root); Q_UNUSED(y_root); Q_UNUSED(direction); }
755 
756 
757 private:
758  void update( const unsigned long[] );
759  void setSupported();
760  void setDefaultProperties();
761  void updateSupportedProperties( Atom atom );
762  Role role;
763 
764 protected:
765  virtual void virtual_hook( int id, void* data );
766 private:
767  NETRootInfoPrivate *p;
768  friend class NETRootInfo2;
769  friend class NETRootInfo3;
770 };
771 
778 class TDECORE_EXPORT NETRootInfo2
779  : public NETRootInfo
780 {
781 public:
782  NETRootInfo2(Display *display, Window supportWindow, const char *wmName,
783  unsigned long properties[], int properties_size,
784  int screen = -1, bool doActivate = true);
788  NETRootInfo2(Display *display, const unsigned long properties[], int properties_size,
789  int screen = -1, bool doActivate = true);
794  void sendPing( Window window, Time timestamp );
795 protected:
796  friend class NETRootInfo;
803  virtual void gotPing( Window window, Time timestamp ) { Q_UNUSED(window); Q_UNUSED(timestamp); }
814  virtual void changeActiveWindow(Window window,NET::RequestSource src,
815  Time timestamp, Window active_window ) { Q_UNUSED(window); Q_UNUSED(src); Q_UNUSED(timestamp); Q_UNUSED(active_window);}
825  virtual void restackWindow(Window window, Window above, int detail) { Q_UNUSED(window); Q_UNUSED(above); Q_UNUSED(detail); }
826 
839  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); }
840 
841 // no private data, use NETRootInfoPrivate
842 };
843 
850 class TDECORE_EXPORT NETRootInfo3
851  : public NETRootInfo2
852 {
853 public:
854  NETRootInfo3(Display *display, Window supportWindow, const char *wmName,
855  unsigned long properties[], int properties_size,
856  int screen = -1, bool doActivate = true);
860  NETRootInfo3(Display *display, const unsigned long properties[], int properties_size,
861  int screen = -1, bool doActivate = true);
869  void takeActivity( Window window, Time timestamp, long flags );
870 protected:
871  friend class NETRootInfo;
883  virtual void restackWindow(Window window, RequestSource source,
884  Window above, int detail, Time timestamp) { Q_UNUSED(window); Q_UNUSED(source); Q_UNUSED(above); Q_UNUSED(detail); Q_UNUSED(timestamp); }
892  virtual void gotTakeActivity(Window window, Time timestamp, long flags ) { Q_UNUSED(window); Q_UNUSED(timestamp); Q_UNUSED(flags); }
893 // no private data, use NETRootInfoPrivate
894 };
895 
902 class TDECORE_EXPORT NETRootInfo4
903  : public NETRootInfo3
904 {
905 public:
906  NETRootInfo4(Display *display, Window supportWindow, const char *wmName,
907  unsigned long properties[], int properties_size,
908  int screen = -1, bool doActivate = true);
909  NETRootInfo4(Display *display, const unsigned long properties[], int properties_size,
910  int screen = -1, bool doActivate = true);
911 
912 protected:
913  friend class NETRootInfo;
921  virtual void changeShowingDesktop(bool showing) { Q_UNUSED(showing); }
922 // no private data, use NETRootInfoPrivate
923 };
924 
939 class TDECORE_EXPORT NETWinInfo : public NET {
940 public:
945  // update also NETWinInfoPrivate::properties[] size when extending this
946  enum { PROTOCOLS, PROTOCOLS2,
947  PROPERTIES_SIZE };
972  NETWinInfo(Display *display, Window window, Window rootWindow,
973  const unsigned long properties[], int properties_size,
974  Role role = Client);
975 
982  NETWinInfo(Display *display, Window window,
983  Window rootWindow, unsigned long properties,
984  Role role = Client);
985 
991  NETWinInfo(const NETWinInfo & wininfo);
992 
996  virtual ~NETWinInfo();
997 
1002  const NETWinInfo &operator=(const NETWinInfo &wintinfo);
1003 
1012  bool hasNETSupport() const;
1013 
1020  // KDE4 better name?
1021  const unsigned long* passedProperties() const;
1022 
1032  unsigned long properties() const TDE_DEPRECATED;
1033 
1039  NETRect iconGeometry() const;
1040 
1047  unsigned long state() const;
1048 
1053  NETExtendedStrut extendedStrut() const;
1054 
1061  NETStrut strut() const;
1062 
1077  WindowType windowType( unsigned long supported_types ) const;
1078 
1086  WindowType windowType() const TDE_DEPRECATED;
1087 
1093  const char *name() const;
1094 
1100  const char *visibleName() const;
1101 
1111  const char *iconName() const;
1112 
1122  const char *visibleIconName() const;
1123 
1131  int desktop() const;
1132 
1138  int pid() const;
1139 
1145  Bool handledIcons() const;
1146 
1153  Window kdeSystemTrayWinFor() const;
1154 
1161  MappingState mappingState() const;
1162 
1172  void setIcon(NETIcon icon, Bool replace = True);
1173 
1179  void setIconGeometry(NETRect geometry);
1180 
1186  void setExtendedStrut(const NETExtendedStrut& extended_strut );
1187 
1194  void setStrut(NETStrut strut);
1195 
1206  void setState(unsigned long state, unsigned long mask);
1207 
1214  void setWindowType(WindowType type);
1215 
1221  void setName(const char *name);
1222 
1229  void setVisibleName(const char *visibleName);
1230 
1236  void setIconName(const char *name);
1237 
1244  void setVisibleIconName(const char *name);
1245 
1253  void setDesktop(int desktop);
1254 
1260  void setPid(int pid);
1261 
1267  void setHandledIcons(Bool handled);
1268 
1274  void setKDESystemTrayWinFor(Window window);
1275 
1282  void setFrameExtents(NETStrut strut);
1283 
1290  void setKDEFrameStrut(NETStrut strut);
1291 
1303  NETIcon icon(int width = -1, int height = -1) const;
1304 
1305  /*
1306  * Sets user timestamp @p time on the window (property _NET_WM_USER_TIME).
1307  * The timestamp is expressed as XServer time. If a window
1308  * is shown with user timestamp older than the time of the last
1309  * user action, it won't be activated after being shown, with the special
1310  * value 0 meaning not to activate the window after being shown.
1311  * @since 3.2
1312  */
1313  void setUserTime( Time time );
1314 
1319  Time userTime() const;
1320 
1321  /*
1322  * Sets the startup notification id @p id on the window.
1323  * @since 3.2
1324  */
1325  void setStartupId( const char* startup_id );
1326 
1331  const char* startupId() const;
1332 
1337  void setAllowedActions( unsigned long actions );
1338 
1343  unsigned long allowedActions() const;
1344 
1345  /*
1346  * Returns the WM_TRANSIENT_FOR property for the window, i.e. the mainwindow
1347  * for this window.
1348  * @since 3.2
1349  */
1350  Window transientFor() const;
1351 
1356  Window groupLeader() const;
1357 
1363  const char* windowClassClass() const;
1364 
1370  const char* windowClassName() const;
1371 
1376  const char* windowRole() const;
1377 
1382  const char* clientMachine() const;
1383 
1392  void kdeGeometry(NETRect &frame, NETRect &window);
1393 
1409  void event( XEvent* event, unsigned long* properties, int properties_size );
1410 
1422  unsigned long event(XEvent *event);
1423 
1430  static const int OnAllDesktops;
1431 
1432 
1433 protected:
1441  virtual void changeDesktop(int desktop) { Q_UNUSED(desktop); }
1442 
1452  virtual void changeState(unsigned long state, unsigned long mask) { Q_UNUSED(state); Q_UNUSED(mask); }
1453 
1454 private:
1455  void update( const unsigned long[] );
1456  void updateWMState();
1457  void setIconInternal(NETRArray<NETIcon>& icons, int& icon_count, Atom property, NETIcon icon, Bool replace);
1458  NETIcon iconInternal(NETRArray<NETIcon>& icons, int icon_count, int width, int height) const;
1459  Role role;
1460 
1461 protected:
1462  virtual void virtual_hook( int id, void* data );
1463 private:
1464  NETWinInfoPrivate *p;
1465 };
1466 
1467 
1468 //#define KWIN_FOCUS
1469 
1470 #endif
1471 #endif // __net_wm_h
NET
Base namespace class.
Definition: netwm_def.h:235
NET::RequestSource
RequestSource
Source of the request.
Definition: netwm_def.h:631
NETExtendedStrut
Partial strut class for NET classes.
Definition: netwm_def.h:153
NETIcon
Simple icon class for NET classes.
Definition: netwm_def.h:122
NETPoint
Simple point class for NET classes.
Definition: netwm_def.h:44
NETRect
Simple rectangle class for NET classes.
Definition: netwm_def.h:94
NETSize
Simple size class for NET classes.
Definition: netwm_def.h:71
NETStrut
Definition: netwm_def.h:195

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.1
This website is maintained by Timothy Pearson.