aboutsummaryrefslogtreecommitdiffstats
path: root/matchbox/mb-wm-client-window.h
blob: 9d4b2760f4cfc10f0adb7aa39f1acdbb980af20a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/*
 *  Matchbox Window Manager II - A lightweight window manager not for the
 *                               desktop.
 *
 *  Authored By Matthew Allum <mallum@o-hand.com>
 *
 *  Copyright (c) 2005 OpenedHand Ltd - http://o-hand.com
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2, or (at your option)
 *  any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 */

#ifndef _HAVE_MB_WM_CLIENT_WINDOW_H
#define _HAVE_MB_WM_CLIENT_WINDOW_H

#include <matchbox/mb-wm-object.h>
#include <matchbox/mb-wm-types.h>

/* FIXME: below limits to 32 props */

/* When a property changes
 *    - window updates its internal values
 *    - somehow signals client object to process with what changed.
 */

#define MBWM_WINDOW_PROP_WIN_TYPE        (1<<0)
#define MBWM_WINDOW_PROP_GEOMETRY        (1<<1)
#define MBWM_WINDOW_PROP_ATTR            (1<<2)
#define MBWM_WINDOW_PROP_NAME            (1<<3)
#define MBWM_WINDOW_PROP_WM_HINTS        (1<<4)
#define MBWM_WINDOW_PROP_WM_NORMAL_HINTS (1<<5)
#define MBWM_WINDOW_PROP_NET_ICON        (1<<6)
#define MBWM_WINDOW_PROP_NET_PID         (1<<7)
#define MBWM_WINDOW_PROP_PROTOS          (1<<8)
#define MBWM_WINDOW_PROP_TRANSIENCY      (1<<9)
#define MBWM_WINDOW_PROP_STATE           (1<<10)
#define MBWM_WINDOW_PROP_NET_STATE       (1<<11)
#define MBWM_WINDOW_PROP_STARTUP_ID      (1<<12)
#define MBWM_WINDOW_PROP_CLIENT_MACHINE  (1<<13)
#define MBWM_WINDOW_PROP_ALLOWED_ACTIONS (1<<14)
#define MBWM_WINDOW_PROP_NET_USER_TIME   (1<<15)
#define MBWM_WINDOW_PROP_CM_TRANSLUCENCY (1<<17)
#define MBWM_WINDOW_PROP_MWM_HINTS       (1<<18)

#define MBWM_WINDOW_PROP_ALL        (0xffffffff)

typedef enum MBWMClientWindowEWMHState
  {
    MBWMClientWindowEWMHStateModal            = (1<<0),
    MBWMClientWindowEWMHStateSticky           = (1<<1),
    MBWMClientWindowEWMHStateMaximisedVert    = (1<<2),
    MBWMClientWindowEWMHStateMaximisedHorz    = (1<<3),
    MBWMClientWindowEWMHStateShaded           = (1<<4),
    MBWMClientWindowEWMHStateSkipTaskbar      = (1<<5),
    MBWMClientWindowEWMHStateSkipPager        = (1<<6),
    MBWMClientWindowEWMHStateHidden           = (1<<7),
    MBWMClientWindowEWMHStateFullscreen       = (1<<8),
    MBWMClientWindowEWMHStateAbove            = (1<<9),
    MBWMClientWindowEWMHStateBelow            = (1<<10),
    MBWMClientWindowEWMHStateDemandsAttention = (1<<11),
    /*
     * Keep in sync with the MBWMClientWindowEWHMStatesCount define below !!!
     */
  }
MBWMClientWindowEWMHState;

#define MBWMClientWindowEWHMStatesCount 12

typedef enum MBWMClientWindowStateChange
  {
    MBWMClientWindowStateChangeRemove  = (1<<0),
    MBWMClientWindowStateChangeAdd     = (1<<1),
    MBWMClientWindowStateChangeToggle  = (1<<2),
  }
MBWMClientWindowStateChange;

typedef enum MBWMClientWindowProtos
  {
    MBWMClientWindowProtosFocus         = (1<<0),
    MBWMClientWindowProtosDelete        = (1<<1),
    MBWMClientWindowProtosContextHelp   = (1<<2),
    MBWMClientWindowProtosContextAccept = (1<<3),
    MBWMClientWindowProtosContextCustom = (1<<4),
    MBWMClientWindowProtosPing          = (1<<5),
    MBWMClientWindowProtosSyncRequest   = (1<<6),
  }
MBWMClientWindowProtos;

typedef enum MBWMClientWindowAllowedActions
  {
    MBWMClientWindowActionMove          = (1<<0),
    MBWMClientWindowActionResize        = (1<<1),
    MBWMClientWindowActionMinimize      = (1<<2),
    MBWMClientWindowActionShade         = (1<<3),
    MBWMClientWindowActionStick         = (1<<4),
    MBWMClientWindowActionMaximizeHorz  = (1<<5),
    MBWMClientWindowActionMaximizeVert  = (1<<6),
    MBWMClientWindowActionFullscreen    = (1<<7),
    MBWMClientWindowActionChangeDesktop = (1<<8),
    MBWMClientWindowActionClose         = (1<<9),
  }
MBWMClientWindowAllowedActions;

#define MB_WM_CLIENT_WINDOW(c) ((MBWMClientWindow*)(c))
#define MB_WM_CLIENT_WINDOW_CLASS(c) ((MBWMClientWindowClass*)(c))
#define MB_WM_TYPE_CLIENT_WINDOW (mb_wm_client_window_class_type ())

typedef struct MBWMClientWindow            MBWMClientWindow;
typedef struct MBWMClientWindowClass       MBWMClientWindowClass;

struct MBWMClientWindow
{
  MBWMObject    parent;

  MBGeometry                     geometry;
  MBGeometry                     x_geometry;
  unsigned int                   depth;
  char                          *name;
  Window                         xwindow;
  Visual                        *visual;
  Colormap                       colormap;
  MBWMManager               *wm;

  Atom                           net_type;
  Atom                          *net_type_full;
  int                            net_type_full_size;
  Bool                           want_key_input;
  Window                         xwin_group;
  Pixmap                         icon_pixmap, icon_pixmap_mask;

  /* WithdrawnState 0, NormalState 1, IconicState 3 */
  int                            initial_state ;

  MBWMClientWindowEWMHState      ewmh_state;
  Window                         xwin_transient_for;

  MBWMClientWindowProtos         protos;
  pid_t                          pid;
  int                            translucency;
  char                          *machine;

  GList                      *icons;

  MBWMClientWindowAllowedActions allowed_actions;

  unsigned long                  user_time;

  int                            gravity;
  int                            window_class;
  Bool                           override_redirect;
  Bool                           undecorated;

  Bool                           user_pos;
};

struct MBWMClientWindowClass
{
  MBWMObjectClass parent;
};

int
mb_wm_client_window_class_type ();

MBWMClientWindow*
mb_wm_client_window_new (MBWMManager *wm, Window xwin);

Bool
mb_wm_client_window_sync_properties (MBWMClientWindow *win,
				     unsigned long     props_req);

Bool
mb_wm_client_window_is_state_set (MBWMClientWindow *win,
				  MBWMClientWindowEWMHState state);

#endif