• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 bool IsX11WindowAvailable();
21 
22 class ANGLE_UTIL_EXPORT X11Window : public OSWindow
23 {
24   public:
25     X11Window();
26     X11Window(int visualId);
27     ~X11Window() override;
28 
29     void disableErrorMessageDialog() override;
30     void destroy() override;
31 
32     void resetNativeWindow() override;
33     EGLNativeWindowType getNativeWindow() const override;
34     void *getPlatformExtension() override;
35     EGLNativeDisplayType getNativeDisplay() const override;
36 
37     void messageLoop() override;
38 
39     void setMousePosition(int x, int y) override;
40     bool setOrientation(int width, int height) override;
41     bool setPosition(int x, int y) override;
42     bool resize(int width, int height) override;
43     void setVisible(bool isVisible) override;
44 
45     void signalTestEvent() override;
46 
47   private:
48     bool initializeImpl(const std::string &name, int width, int height) override;
49     void processEvent(const XEvent &event);
50 
51     Atom WM_DELETE_WINDOW;
52     Atom WM_PROTOCOLS;
53     Atom TEST_EVENT;
54 
55     Display *mDisplay;
56     Window mWindow;
57     int mRequestedVisualId;
58     bool mVisible;
59 };
60 
61 #endif  // UTIL_X11_WINDOW_H
62