2 * Copyright © 2011 Collabora, Ltd.
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
23 #ifndef WSCREENSAVER_GLUE_H
24 #define WSCREENSAVER_GLUE_H
27 * This file is glue, that tries to avoid changing glmatrix.c from the
28 * original too much, hopefully easing the porting of other (GL)
29 * xscreensaver "hacks".
32 #include "wscreensaver.h"
48 #define ENTRYPOINT static
54 typedef struct ModeInfo ModeInfo;
56 #define MI_DISPLAY(mi) NULL
57 #define MI_WINDOW(mi) (mi)
58 #define MI_SCREEN(mi) ((mi)->instance_number)
59 #define MI_WIDTH(mi) ((mi)->width)
60 #define MI_HEIGHT(mi) ((mi)->height)
61 #define MI_IS_WIREFRAME(mi) 0
62 #define MI_NUM_SCREENS(mi) 16
64 typedef EGLContext GLXContext;
66 double frand(double f);
67 void clear_gl_error(void);
68 void check_gl_error(const char *msg);
71 glXMakeCurrent(void *dummy, ModeInfo *mi, EGLContext ctx)
73 assert(mi->eglctx == ctx);
77 glXSwapBuffers(void *dummy, ModeInfo *mi)
87 /* just enough XImage to satisfy glmatrix.c */
89 typedef struct _XImage {
96 XImage *xpm_to_ximage(char **xpm_data);
97 void XDestroyImage(XImage *xi);
99 static inline unsigned long
100 XGetPixel(XImage *xi, int x, int y)
102 return *(uint32_t *)(xi->data + xi->bytes_per_line * y + 4 * x);
106 XPutPixel(XImage *xi, int x, int y, unsigned long pixel)
108 *(uint32_t *)(xi->data + xi->bytes_per_line * y + 4 * x) = pixel;
112 * override glViewport from the plugin, so we can set it up properly
113 * rendering to a regular decorated Wayland window.
118 #define glViewport(x,y,w,h) do {} while (0)
120 #endif /* WSCREENSAVER_GLUE_H */