summaryrefslogtreecommitdiff
path: root/src/compositor/compositor.c
blob: 4d3f370b6bfa4d63778b95f89dfc1135e11417a2 (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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */

/*
 * Copyright (C) 2008 Iain Holmes
 *
 * 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 of the
 * License, 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.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301, USA.
 */

#include <config.h>
#include "compositor-private.h"
#include "compositor-xrender.h"

MetaCompositor *
meta_compositor_new (MetaDisplay *display)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
  /* At some point we would have a way to select between backends */
  return meta_compositor_xrender_new (display);
#else
  return NULL;
#endif
}

void
meta_compositor_destroy (MetaCompositor *compositor)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
  if (compositor && compositor->destroy)
    compositor->destroy (compositor);
#endif
}

void
meta_compositor_add_window (MetaCompositor    *compositor,
                            MetaWindow        *window,
                            Window             xwindow,
                            XWindowAttributes *attrs)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
  if (compositor && compositor->add_window)
    compositor->add_window (compositor, window, xwindow, attrs);
#endif
}

void
meta_compositor_remove_window (MetaCompositor *compositor,
                               Window          xwindow)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
  if (compositor && compositor->remove_window)
    compositor->remove_window (compositor, xwindow);
#endif
}

void
meta_compositor_manage_screen (MetaCompositor *compositor,
                               MetaScreen     *screen)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
  if (compositor && compositor->manage_screen)
    compositor->manage_screen (compositor, screen);
#endif
}

void
meta_compositor_unmanage_screen (MetaCompositor *compositor,
                                 MetaScreen     *screen)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
  if (compositor && compositor->unmanage_screen)
    compositor->unmanage_screen (compositor, screen);
#endif
}

void
meta_compositor_set_updates (MetaCompositor *compositor,
                             MetaWindow     *window,
                             gboolean        updates)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
  if (compositor && compositor->set_updates)
    compositor->set_updates (compositor, window, updates);
#endif
}

void
meta_compositor_process_event (MetaCompositor *compositor,
                               XEvent         *event,
                               MetaWindow     *window)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
  if (compositor && compositor->process_event)
    compositor->process_event (compositor, event, window);
#endif
}

#if GTK_CHECK_VERSION (3, 0, 0)
cairo_surface_t *
meta_compositor_get_window_surface (MetaCompositor *compositor,
                                    MetaWindow     *window)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
  if (compositor && compositor->get_window_surface)
    return compositor->get_window_surface (compositor, window);
  else
    return NULL;
#else
  return NULL;
#endif
}
#else
Pixmap
meta_compositor_get_window_pixmap (MetaCompositor *compositor,
                                   MetaWindow     *window)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
  if (compositor && compositor->get_window_pixmap)
    return compositor->get_window_pixmap (compositor, window);
  else
    return None;
#else
  return None;
#endif
}
#endif  /* GTK_CHECK_VERSION */

void
meta_compositor_set_active_window (MetaCompositor *compositor,
                                   MetaScreen     *screen,
                                   MetaWindow     *window)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
  if (compositor && compositor->set_active_window)
    compositor->set_active_window (compositor, screen, window);
#endif
}

/* These functions are unused at the moment */
void meta_compositor_begin_move (MetaCompositor *compositor,
                                 MetaWindow     *window,
                                 MetaRectangle  *initial,
                                 int             grab_x,
                                 int             grab_y)
{
}

void meta_compositor_update_move (MetaCompositor *compositor,
                                  MetaWindow     *window,
                                  int             x,
                                  int             y)
{
}

void meta_compositor_end_move (MetaCompositor *compositor,
                               MetaWindow     *window)
{
}

void meta_compositor_free_window (MetaCompositor *compositor,
                                  MetaWindow     *window)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
  if (compositor && compositor->free_window)
    compositor->free_window (compositor, window);
#endif
}

void
meta_compositor_maximize_window (MetaCompositor *compositor,
                                 MetaWindow     *window)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
  if (compositor && compositor->maximize_window)
    compositor->maximize_window (compositor, window);
#endif
}

void
meta_compositor_unmaximize_window (MetaCompositor *compositor,
                                   MetaWindow     *window)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
  if (compositor && compositor->unmaximize_window)
    compositor->unmaximize_window (compositor, window);
#endif
}