1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 
3 /*
4  * Copyright (C) 2016 Red Hat
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of the
9  * License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19  * 02111-1307, USA.
20  *
21  * Written by:
22  *     Jonas Ådahl <jadahl@gmail.com>
23  */
24 
25 #ifndef META_CLUTTER_BACKEND_X11_H
26 #define META_CLUTTER_BACKEND_X11_H
27 
28 #include <glib-object.h>
29 
30 #include "clutter/clutter-mutter.h"
31 
32 struct _MetaClutterBackendX11
33 {
34   ClutterBackend parent_instance;
35 
36   Display *xdisplay;
37   char   *display_name;
38 
39   Screen  *xscreen;
40   int      xscreen_num;
41   int      xscreen_width;
42   int      xscreen_height;
43 
44   Window   xwin_root;
45 
46   /* event source */
47   GSList  *event_filters;
48 
49   /* props */
50   Atom atom_NET_WM_PID;
51   Atom atom_NET_WM_PING;
52   Atom atom_NET_WM_STATE;
53   Atom atom_NET_WM_USER_TIME;
54   Atom atom_WM_PROTOCOLS;
55   Atom atom_WM_DELETE_WINDOW;
56   Atom atom_XEMBED;
57   Atom atom_XEMBED_INFO;
58   Atom atom_NET_WM_NAME;
59   Atom atom_UTF8_STRING;
60 
61   Time last_event_time;
62 };
63 
64 #define META_TYPE_CLUTTER_BACKEND_X11 (meta_clutter_backend_x11_get_type ())
65 G_DECLARE_FINAL_TYPE (MetaClutterBackendX11, meta_clutter_backend_x11,
66                       META, CLUTTER_BACKEND_X11,
67                       ClutterBackend)
68 
69 typedef enum
70 {
71   META_X11_FILTER_CONTINUE,
72   META_X11_FILTER_TRANSLATE,
73   META_X11_FILTER_REMOVE
74 } MetaX11FilterReturn;
75 
76 typedef MetaX11FilterReturn (*MetaX11FilterFunc) (XEvent        *xev,
77                                                   ClutterEvent  *cev,
78                                                   gpointer       data);
79 
80 void meta_clutter_x11_trap_x_errors (void);
81 gint meta_clutter_x11_untrap_x_errors (void);
82 
83 Display *meta_clutter_x11_get_default_display (void);
84 int meta_clutter_x11_get_default_screen (void);
85 Window meta_clutter_x11_get_root_window (void);
86 void meta_clutter_x11_set_display (Display * xdpy);
87 
88 void meta_clutter_x11_add_filter (MetaX11FilterFunc func,
89                                   gpointer          data);
90 void meta_clutter_x11_remove_filter (MetaX11FilterFunc func,
91                                      gpointer          data);
92 
93 void meta_clutter_x11_set_use_stereo_stage (gboolean use_stereo);
94 gboolean meta_clutter_x11_get_use_stereo_stage (void);
95 
96 #endif /* META_CLUTTER_BACKEND_X11_H */
97