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     void disableErrorMessageDialog() 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 setOrientation(int width, int height) override;
38     bool setPosition(int x, int y) override;
39     bool resize(int width, int height) override;
40     void setVisible(bool isVisible) override;
41 
42     void signalTestEvent() override;
43 
44   private:
45     bool initializeImpl(const std::string &name, int width, int height) override;
46     void processEvent(const XEvent &event);
47 
48     Atom WM_DELETE_WINDOW;
49     Atom WM_PROTOCOLS;
50     Atom TEST_EVENT;
51 
52     Display *mDisplay;
53     Window mWindow;
54     int mRequestedVisualId;
55     bool mVisible;
56 };
57 
58 #endif  // UTIL_X11_WINDOW_H
59