OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/libgtk2ui/gtk2_event_loop.h" | 5 #include "chrome/browser/ui/libgtkui/gtk2_event_loop.h" |
6 | 6 |
7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
8 #include <gdk/gdkx.h> | 8 #include <gdk/gdkx.h> |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 #include <X11/X.h> | 10 #include <X11/X.h> |
11 | 11 |
12 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
13 #include "ui/events/platform/x11/x11_event_source.h" | 13 #include "ui/events/platform/x11/x11_event_source.h" |
14 #include "ui/gfx/x/x11_types.h" | 14 #include "ui/gfx/x/x11_types.h" |
15 | 15 |
16 namespace libgtk2ui { | 16 namespace libgtkui { |
17 | 17 |
18 // static | 18 // static |
19 Gtk2EventLoop* Gtk2EventLoop::GetInstance() { | 19 Gtk2EventLoop* Gtk2EventLoop::GetInstance() { |
20 return base::Singleton<Gtk2EventLoop>::get(); | 20 return base::Singleton<Gtk2EventLoop>::get(); |
21 } | 21 } |
22 | 22 |
23 Gtk2EventLoop::Gtk2EventLoop() { | 23 Gtk2EventLoop::Gtk2EventLoop() { |
24 gdk_event_handler_set(DispatchGdkEvent, NULL, NULL); | 24 gdk_event_handler_set(DispatchGdkEvent, NULL, NULL); |
25 } | 25 } |
26 | 26 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 x_event.xkey.same_screen = true; | 72 x_event.xkey.same_screen = true; |
73 | 73 |
74 // We want to process the gtk2 event; mapped to an X11 event immediately | 74 // We want to process the gtk2 event; mapped to an X11 event immediately |
75 // otherwise if we put it back on the queue we may get items out of order. | 75 // otherwise if we put it back on the queue we may get items out of order. |
76 if (ui::X11EventSource* x11_source = ui::X11EventSource::GetInstance()) | 76 if (ui::X11EventSource* x11_source = ui::X11EventSource::GetInstance()) |
77 x11_source->DispatchXEventNow(&x_event); | 77 x11_source->DispatchXEventNow(&x_event); |
78 else | 78 else |
79 XPutBackEvent(x_event.xkey.display, &x_event); | 79 XPutBackEvent(x_event.xkey.display, &x_event); |
80 } | 80 } |
81 | 81 |
82 } // namespace libgtk2ui | 82 } // namespace libgtkui |
OLD | NEW |