PieDock  1.6.3
WorkspaceLayout.h
1 /*
2  * O ,-
3  * ° o . -´ ' ,-
4  * ° .´ ` . ´,´
5  * ( ° )) . (
6  * `-;_ . -´ `.`.
7  * `._' ´
8  *
9  * Copyright (c) 2012 Markus Fisch <mf@markusfisch.de>
10  *
11  * Licensed under the MIT license:
12  * http://www.opensource.org/licenses/mit-license.php
13  */
14 #ifndef _PieDock_WorkspaceLayout_
15 #define _PieDock_WorkspaceLayout_
16 
17 #include <X11/Xlib.h>
18 
19 namespace PieDock
20 {
27  {
28  public:
29  typedef struct
30  {
31  unsigned long number;
32  int x;
33  int y;
35 
36  enum PreferredVirtualLayout
37  {
38  Horizontal,
39  Vertical,
40  Square
41  };
42 
43  virtual ~WorkspaceLayout() {}
44  inline const unsigned long &getScreenWidth() const {
45  return screen.width; }
46  inline const unsigned long &getScreenHeight() const {
47  return screen.height; }
48  inline const unsigned long &getTotalWidth() const {
49  return total.width; }
50  inline const unsigned long &getTotalHeight() const {
51  return total.height; }
52  inline const int &getColumns() const {
53  return columns; }
54  inline const int &getRows() const {
55  return rows; }
56  inline const bool &isVirtual() const {
57  return virtualDesktop; }
58  static WorkspaceLayout *getWorkspaceLayout( Display *,
59  PreferredVirtualLayout = Horizontal );
60  bool isOnAnotherWorkspace( Window, WorkspacePosition & );
61  bool isOnAnotherWorkspace( Window, XWindowAttributes &,
62  WorkspacePosition & );
63 
64  private:
65  typedef struct
66  {
67  unsigned long width;
68  unsigned long height;
69  } Geometry;
70 
71  static WorkspaceLayout *singleton;
72  Display *display;
73  PreferredVirtualLayout preferredLayout;
74  Geometry screen;
75  Geometry total;
76  int columns;
77  int rows;
78  bool virtualDesktop;
79 
80  WorkspaceLayout( Display *, PreferredVirtualLayout );
81  WorkspaceLayout &operator=( const WorkspaceLayout & ) {
82  return *this; }
83  };
84 }
85 
86 #endif