1 //
2 // Copyright 2015 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 // X11Window.h: Definition of the implementation of OSWindow for X11
8 
9 #ifndef UTIL_X11_WINDOW_H
10 #define UTIL_X11_WINDOW_H
11 
12 #include <X11/Xlib.h>
13 #include <X11/Xresource.h>
14 #include <X11/Xutil.h>
15 #include <string>
16 
17 #include "util/OSWindow.h"
18 #include "util/util_export.h"
19 
20 class ANGLE_UTIL_EXPORT X11Window : public OSWindow
21 {
22   public:
23     X11Window();
24     X11Window(int visualId);
25     ~X11Window() override;
26 
27     bool initialize(const std::string &name, int width, int height) override;
28     void destroy() override;
29 
30     void resetNativeWindow() override;
31     EGLNativeWindowType getNativeWindow() const override;
32     EGLNativeDisplayType getNativeDisplay() const override;
33 
34     void messageLoop() override;
35 
36     void setMousePosition(int x, int y) override;
37     bool setPosition(int x, int y) override;
38     bool resize(int width, int height) override;
39     void setVisible(bool isVisible) override;
40 
41     void signalTestEvent() override;
42 
43   private:
44     void processEvent(const XEvent &event);
45 
46     Atom WM_DELETE_WINDOW;
47     Atom WM_PROTOCOLS;
48     Atom TEST_EVENT;
49 
50     Display *mDisplay;
51     Window mWindow;
52     int mRequestedVisualId;
53     bool mVisible;
54 };
55 
56 #endif  // UTIL_X11_WINDOW_H
57