summaryrefslogtreecommitdiff
path: root/libwnck/screen.h
blob: 0472b06d4f12e3887410c16d85611ff2f23a86bf (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
/* screen object */

/*
 * Copyright (C) 2001 Havoc Pennington
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef WNCK_SCREEN_H
#define WNCK_SCREEN_H

#include <glib-object.h>

G_BEGIN_DECLS

/* forward decls */
typedef struct _WnckApplication WnckApplication;
typedef struct _WnckClassGroup  WnckClassGroup;
typedef struct _WnckWindow      WnckWindow;
typedef struct _WnckWorkspace   WnckWorkspace;

/* Screen */

#define WNCK_TYPE_SCREEN              (wnck_screen_get_type ())
#define WNCK_SCREEN(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), WNCK_TYPE_SCREEN, WnckScreen))
#define WNCK_SCREEN_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), WNCK_TYPE_SCREEN, WnckScreenClass))
#define WNCK_IS_SCREEN(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), WNCK_TYPE_SCREEN))
#define WNCK_IS_SCREEN_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), WNCK_TYPE_SCREEN))
#define WNCK_SCREEN_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), WNCK_TYPE_SCREEN, WnckScreenClass))

typedef struct _WnckScreen        WnckScreen;
typedef struct _WnckScreenClass   WnckScreenClass;
typedef struct _WnckScreenPrivate WnckScreenPrivate;

/**
 * WnckScreen:
 *
 * The #WnckScreen struct contains only private fields and should not be
 * directly accessed.
 */
struct _WnckScreen
{
  GObject parent_instance;

  WnckScreenPrivate *priv;
};

struct _WnckScreenClass
{
  GObjectClass parent_class;

  /* focused window changed */
  void (* active_window_changed)    (WnckScreen *screen,
                                     WnckWindow *previous_window);
  /* current workspace changed */
  void (* active_workspace_changed) (WnckScreen *screen,
                                     WnckWorkspace *previous_workspace);
  /* stacking order changed */
  void (* window_stacking_changed)  (WnckScreen *screen);
  /* window added */
  void (* window_opened)            (WnckScreen *screen,
                                     WnckWindow *window);
  /* window removed */
  void (* window_closed)            (WnckScreen *screen,
                                     WnckWindow *window);
  /* new workspace */
  void (* workspace_created)        (WnckScreen *screen,
                                     WnckWorkspace *space);
  /* workspace gone */
  void (* workspace_destroyed)      (WnckScreen *screen,
                                     WnckWorkspace *space);
  /* new app */
  void (* application_opened)       (WnckScreen      *screen,
                                     WnckApplication *app);
  /* app gone */
  void (* application_closed)       (WnckScreen      *screen,
                                     WnckApplication *app);

  /* New background */
  void (* background_changed)       (WnckScreen      *screen);

  /* new class group */
  void (* class_group_opened)       (WnckScreen     *screen,
                                     WnckClassGroup *class_group);
  /* class group gone */
  void (* class_group_closed)       (WnckScreen     *screen,
                                     WnckClassGroup *class_group);
  /* Toggle showing desktop */
  void (* showing_desktop_changed)  (WnckScreen      *screen);

  /* Viewport stuff changed */
  void (* viewports_changed)        (WnckScreen      *screen);
  
  /* Padding for future expansion */
  void (* pad1) (void);
  void (* pad2) (void);
  void (* pad3) (void);
  void (* pad4) (void);
  void (* pad5) (void);
  void (* pad6) (void);
};

typedef struct _WnckWorkspaceLayout WnckWorkspaceLayout;

struct _WnckWorkspaceLayout
{
  int rows;
  int cols;
  int *grid;
  int grid_area;
  int current_row;
  int current_col;
};

typedef enum
{
  WNCK_MOTION_UP = -1,
  WNCK_MOTION_DOWN = -2,
  WNCK_MOTION_LEFT = -3,
  WNCK_MOTION_RIGHT = -4
} WnckMotionDirection;

GType wnck_screen_get_type (void) G_GNUC_CONST;

WnckScreen*    wnck_screen_get_default              (void);
WnckScreen*    wnck_screen_get                      (int         index);
WnckScreen*    wnck_screen_get_for_root             (gulong      root_window_id);
WnckWorkspace* wnck_screen_get_workspace            (WnckScreen *screen,
                                                     int         workspace);
int            wnck_screen_get_workspace_index      (WnckScreen    *screen,
                                                     WnckWorkspace *workspace);
WnckWorkspace* wnck_screen_get_workspace_neighbor   (WnckScreen         *screen,
                                                     WnckWorkspace      *workspace,
                                                     WnckMotionDirection direction);
WnckWorkspace* wnck_screen_get_active_workspace     (WnckScreen *screen);
WnckWindow*    wnck_screen_get_active_window        (WnckScreen *screen);
WnckWindow*    wnck_screen_get_previously_active_window (WnckScreen *screen);
GList*         wnck_screen_get_windows              (WnckScreen *screen);
GList*         wnck_screen_get_windows_stacked      (WnckScreen *screen);
void           wnck_screen_force_update             (WnckScreen *screen);
int            wnck_screen_get_workspace_count      (WnckScreen *screen);
void           wnck_screen_change_workspace_count   (WnckScreen *screen,
                                                     int         count);
gboolean       wnck_screen_net_wm_supports          (WnckScreen *screen,
                                                     const char *atom);
gulong         wnck_screen_get_background_pixmap    (WnckScreen *screen);
int            wnck_screen_get_width                (WnckScreen *screen);
int            wnck_screen_get_height               (WnckScreen *screen);
gboolean       wnck_screen_get_showing_desktop      (WnckScreen *screen);
void           wnck_screen_toggle_showing_desktop   (WnckScreen *screen,
                                                     gboolean    show);
void           wnck_screen_move_viewport            (WnckScreen *screen,
                                                     int         x,
                                                     int         y);
int            wnck_screen_try_set_workspace_layout (WnckScreen *screen,
                                                     int         current_token,
                                                     int         rows,
                                                     int         columns);
void           wnck_screen_release_workspace_layout (WnckScreen *screen,
                                                     int         current_token);
void           wnck_screen_calc_workspace_layout    (WnckScreen          *screen,
                                                     int                  num_workspaces,
                                                     int                  current_space,
                                                     WnckWorkspaceLayout *layout);
void           wnck_screen_free_workspace_layout (WnckWorkspaceLayout *layout);


G_END_DECLS

#endif /* WNCK_SCREEN_H */