glwindow: pass display to implementation's _new()
[platform/upstream/gstreamer.git] / gst-libs / gst / gl / wayland / gstglwindow_wayland_egl.h
1 /*
2  * GStreamer
3  * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20
21 #ifndef __GST_GL_WINDOW_WAYLAND_EGL_H__
22 #define __GST_GL_WINDOW_WAYLAND_EGL_H__
23
24 #include <wayland-client.h>
25 #include <wayland-egl.h>
26 #include <wayland-cursor.h>
27
28 #include <gst/gl/gl.h>
29
30 G_BEGIN_DECLS
31
32 #define GST_GL_TYPE_WINDOW_WAYLAND_EGL         (gst_gl_window_wayland_egl_get_type())
33 #define GST_GL_WINDOW_WAYLAND_EGL(o)           (G_TYPE_CHECK_INSTANCE_CAST((o), GST_GL_TYPE_WINDOW_WAYLAND_EGL, GstGLWindowWaylandEGL))
34 #define GST_GL_WINDOW_WAYLAND_EGL_CLASS(k)     (G_TYPE_CHECK_CLASS((k), GST_GL_TYPE_WINDOW_WAYLAND_EGL, GstGLWindowWaylandEGLClass))
35 #define GST_GL_IS_WINDOW_WAYLAND_EGL(o)        (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_GL_TYPE_WINDOW_WAYLAND_EGL))
36 #define GST_GL_IS_WINDOW_WAYLAND_EGL_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE((k), GST_GL_TYPE_WINDOW_WAYLAND_EGL))
37 #define GST_GL_WINDOW_WAYLAND_EGL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_GL_TYPE_WINDOW_WAYLAND_EGL, GstGLWindowWaylandEGL_Class))
38
39 typedef struct _GstGLWindowWaylandEGL        GstGLWindowWaylandEGL;
40 typedef struct _GstGLWindowWaylandEGLClass   GstGLWindowWaylandEGLClass;
41
42 struct window;
43
44 struct display {
45   struct wl_display      *display;
46   struct wl_registry     *registry;
47   struct wl_compositor   *compositor;
48   struct wl_shell        *shell;
49   struct wl_seat         *seat;
50   struct wl_pointer      *pointer;
51   struct wl_keyboard     *keyboard;
52   struct wl_shm          *shm;
53   struct wl_cursor_theme *cursor_theme;
54   struct wl_cursor       *default_cursor;
55   struct wl_surface      *cursor_surface;
56   struct window          *window;
57   guint32                 serial;
58
59   gdouble pointer_x;
60   gdouble pointer_y;
61 };
62
63 struct window {
64   struct display *display;
65
66   struct wl_event_queue     *queue;
67   struct wl_surface         *surface;
68   struct wl_shell_surface   *shell_surface;
69   struct wl_egl_window      *native;
70   struct wl_surface         *foreign_surface;
71   struct wl_subsurface      *subsurface;
72   struct wl_callback        *callback;
73   int fullscreen, configured;
74   int window_width, window_height;
75   int window_x, window_y;
76 };
77
78 struct _GstGLWindowWaylandEGL {
79   /*< private >*/
80   GstGLWindow parent;
81
82   struct display display;
83   struct window  window;
84
85   GSource *wl_source;
86
87   gpointer _reserved[GST_PADDING];
88 };
89
90 struct _GstGLWindowWaylandEGLClass {
91   /*< private >*/
92   GstGLWindowClass parent_class;
93
94   /*< private >*/
95   gpointer _reserved[GST_PADDING];
96 };
97
98 GType gst_gl_window_wayland_egl_get_type     (void);
99
100 GstGLWindowWaylandEGL * gst_gl_window_wayland_egl_new  (GstGLDisplay * display);
101
102 void gst_gl_window_wayland_egl_create_window (GstGLWindowWaylandEGL * window_egl);
103
104 G_END_DECLS
105
106 #endif /* __GST_GL_WINDOW_X11_H__ */