Panda3D

Loading...
Searching...
No Matches
x11GraphicsWindow.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file x11GraphicsWindow.h
10 * @author rdb
11 * @date 2009-07-07
12 */
13
14#ifndef X11GRAPHICSWINDOW_H
15#define X11GRAPHICSWINDOW_H
16
17#include "pandabase.h"
18
19#include "x11GraphicsPipe.h"
20#include "graphicsWindow.h"
21#include "buttonHandle.h"
22
23/**
24 * Interfaces to the X11 window system.
25 */
26 class x11GraphicsWindow : public GraphicsWindow {
27 public:
28 x11GraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
29 const std::string &name,
30 const FrameBufferProperties &fb_prop,
31 const WindowProperties &win_prop,
32 int flags,
33 GraphicsStateGuardian *gsg,
34 GraphicsOutput *host);
35 virtual ~x11GraphicsWindow();
36
37 virtual MouseData get_pointer(int device) const;
38 virtual bool move_pointer(int device, int x, int y);
39
40 virtual void clear(Thread *current_thread);
41 virtual bool begin_frame(FrameMode mode, Thread *current_thread);
42 virtual void end_frame(FrameMode mode, Thread *current_thread);
43
44 virtual void process_events();
45 virtual void set_properties_now(WindowProperties &properties);
46
47 INLINE X11_Window get_xwindow() const;
48
49 void enable_detectable_auto_repeat();
50
51 protected:
52 virtual void close_window();
53 virtual bool open_window();
54
55 virtual void mouse_mode_absolute();
56 virtual void mouse_mode_relative();
57
58 void set_wm_properties(const WindowProperties &properties,
59 bool already_mapped);
60
61 virtual void setup_colormap(XVisualInfo *visual);
62 void handle_keystroke(XKeyEvent &event);
63 void handle_keypress(XKeyEvent &event);
64 void handle_keyrelease(XKeyEvent &event);
65
66 ButtonHandle get_button(XKeyEvent &key_event, bool allow_shift);
67 ButtonHandle map_button(KeySym key) const;
68 ButtonHandle map_raw_button(KeyCode key) const;
69 ButtonHandle get_mouse_button(XButtonEvent &button_event);
70 virtual ButtonMap *get_keyboard_map() const;
71
72 static Bool check_event(X11_Display *display, XEvent *event, char *arg);
73
74 void open_raw_mice();
75
76 private:
77 X11_Cursor get_cursor(const Filename &filename);
78 X11_Cursor read_ico(std::istream &ico);
79
80 protected:
81 X11_Display *_display;
82 int _screen;
83 X11_Window _xwindow;
84 Colormap _colormap;
85 XIC _ic;
86 XVisualInfo *_visual_info;
87 Rotation _orig_rotation;
88 SizeID _orig_size_id;
89
90 LVecBase2i _fixed_size;
91
92 GraphicsWindowInputDevice *_input;
93
94 long _event_mask;
95 clock_t _awaiting_configure_since;
96 bool _dga_mouse_enabled;
97 Bool _override_redirect;
98 Atom _wm_delete_window;
99
100 x11GraphicsPipe::pfn_XRRGetScreenInfo _XRRGetScreenInfo;
101 x11GraphicsPipe::pfn_XRRSetScreenConfig _XRRSetScreenConfig;
102
103 public:
104 static TypeHandle get_class_type() {
105 return _type_handle;
106 }
107 static void init_type() {
108 GraphicsWindow::init_type();
109 register_type(_type_handle, "x11GraphicsWindow",
110 GraphicsWindow::get_class_type());
111 }
112 virtual TypeHandle get_type() const {
113 return get_class_type();
114 }
115 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
116
117 private:
118 static TypeHandle _type_handle;
119
120 // Since the Panda API requests icons and cursors by filename, we need a
121 // table mapping filenames to handles, so we can avoid re-reading the file
122 // each time we change icons.
123 pmap<Filename, X11_Cursor> _cursor_filenames;
124};
125
126#include "x11GraphicsWindow.I"
127
128#endif
buttonHandle.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
ButtonHandle
A ButtonHandle represents a single button from any device, including keyboard buttons and mouse butto...
Definition buttonHandle.h:26
ButtonMap
This class represents a map containing all of the buttons of a (keyboard) device, though it can also ...
Definition buttonMap.h:30
Filename
The name of a file, such as a texture file or an Egg file.
Definition filename.h:44
FrameBufferProperties
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
Definition frameBufferProperties.h:26
GraphicsStateGuardian
Encapsulates all the communication with a particular instance of a given rendering backend.
Definition graphicsStateGuardian.h:65
GraphicsWindowInputDevice
This is a virtual input device that represents the keyboard and mouse pair that is associated with a ...
Definition graphicsWindowInputDevice.h:28
Thread
A thread; that is, a lightweight process.
Definition thread.h:46
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
WindowProperties
A container for the various kinds of properties we might ask to have on a graphics window before we o...
Definition windowProperties.h:29
x11GraphicsWindow::begin_frame
virtual bool begin_frame(FrameMode mode, Thread *current_thread)
This function will be called within the draw thread before beginning rendering for a given frame.
Definition x11GraphicsWindow.cxx:229
x11GraphicsWindow::process_events
virtual void process_events()
Do whatever processing is necessary to ensure that the window responds to user events.
Definition x11GraphicsWindow.cxx:287
x11GraphicsWindow::clear
virtual void clear(Thread *current_thread)
Clears the entire framebuffer before rendering, according to the settings of get_color_clear_active()...
Definition x11GraphicsWindow.cxx:213
x11GraphicsWindow::move_pointer
virtual bool move_pointer(int device, int x, int y)
Forces the pointer to the indicated position within the window, if possible.
Definition x11GraphicsWindow.cxx:179
x11GraphicsWindow::enable_detectable_auto_repeat
void enable_detectable_auto_repeat()
Enables detectable auto-repeat if supported by the X server.
Definition x11GraphicsWindow.cxx:2451
x11GraphicsWindow::set_properties_now
virtual void set_properties_now(WindowProperties &properties)
Applies the requested set of properties to the window, if possible, for instance to request a change ...
Definition x11GraphicsWindow.cxx:601
x11GraphicsWindow::get_pointer
virtual MouseData get_pointer(int device) const
Returns the MouseData associated with the nth input device's pointer.
Definition x11GraphicsWindow.cxx:142
x11GraphicsWindow::get_xwindow
X11_Window get_xwindow() const
Returns the X11 Window handle.
Definition x11GraphicsWindow.I:18
x11GraphicsWindow::end_frame
virtual void end_frame(FrameMode mode, Thread *current_thread)
This function will be called within the draw thread after rendering is completed for a given frame.
Definition x11GraphicsWindow.cxx:262
graphicsWindow.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
MouseData
BEGIN_PUBLISH typedef PointerData MouseData
Deprecated alias for PointerData.
Definition mouseData.h:23
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition register_type.I:22
x11GraphicsPipe.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
x11GraphicsWindow.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.