• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright (c) 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 <string>
13 #include <X11/Xlib.h>
14 #include <X11/Xutil.h>
15 #include <X11/Xresource.h>
16 
17 #include "OSWindow.h"
18 
19 class X11Window : public OSWindow
20 {
21   public:
22     X11Window();
23     X11Window(int visualId);
24     ~X11Window();
25 
26     bool initialize(const std::string &name, size_t width, size_t height) override;
27     void destroy() override;
28 
29     EGLNativeWindowType getNativeWindow() const override;
30     EGLNativeDisplayType getNativeDisplay() const override;
31     void* getFramebufferNativeWindow() const override;
32 
33     void messageLoop() override;
34 
35     void setMousePosition(int x, int y) override;
36     bool setPosition(int x, int y) override;
37     bool resize(int width, int height) override;
38     void setVisible(bool isVisible) override;
39 
40     void signalTestEvent() override;
41 
42   private:
43     void processEvent(const XEvent &event);
44 
45     Atom WM_DELETE_WINDOW;
46     Atom WM_PROTOCOLS;
47     Atom TEST_EVENT;
48 
49     Display *mDisplay;
50     Window mWindow;
51     int mRequestedVisualId;
52     bool mVisible;
53 };
54 
55 #endif // UTIL_X11_WINDOW_H
56