FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
X11NativeGdkEvent.h
1 /**********************************************************\
2 File: X11NativeGdkEvent.h
3 
4 Original Author: John Boyd (medusade)
5 
6 Created: 5/4/2012
7 License: Dual license model; choose one of two:
8  New BSD License
9  http://www.opensource.org/licenses/bsd-license.php
10  - or -
11  GNU Lesser General Public License, version 2.1
12  http://www.gnu.org/licenses/lgpl-2.1.html
13 
14 Copyright John Boyd (medusade), Firebreath development team
15 \**********************************************************/
16 #pragma once
17 #ifndef H_FB_EVENTS_X11NATIVEGDKEVENT
18 #define H_FB_EVENTS_X11NATIVEGDKEVENT
19 
20 #include <gdk/gdk.h>
21 
22 namespace FB {
23 
33 {
34 public:
35  GdkEvent m_gdkEvent;
36 
38  (GdkWindow* window=0, GdkEventType type=GDK_NOTHING, gint8 send_event=TRUE)
39  {
40  m_gdkEvent.any.type = type;
41  m_gdkEvent.any.window = window;
42  m_gdkEvent.any.send_event = send_event;
43  }
44  bool SendEvent()
45  {
46  bool sent = false;
47  if ((sent = (m_gdkEvent.any.type != GDK_NOTHING) && (m_gdkEvent.any.window != 0)))
48  {
49  gdk_threads_enter();
50  gdk_event_put(&m_gdkEvent);
51  gdk_threads_leave();
52  }
53  return sent;
54  }
55  inline operator GdkEvent* () const
56  { return (GdkEvent*)(&m_gdkEvent); }
57 };
58 
68 {
69 public:
70  typedef X11NativeGdkEvent Extends;
71 
73  (GdkWindow* window=0, GdkRegion* region=0,
74  int x=0, int y=0, int width=0, int height=0, int count=0,
75  GdkEventType type=GDK_EXPOSE, gint8 send_event=TRUE)
76  : Extends(window, type, send_event)
77  {
78  m_gdkEvent.expose.area.x = x;
79  m_gdkEvent.expose.area.y = y;
80  m_gdkEvent.expose.area.width = width;
81  m_gdkEvent.expose.area.height = height;
82  m_gdkEvent.expose.region = region;
83  m_gdkEvent.expose.count = count;
84  }
85 };
86 
87 } // namespace FB
88 
89 #endif // H_FB_EVENTS_X11NATIVEGDKEVENT
Class encapsulation for native Gdk expose event.
Class encapsulation for native Gdk event.