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/libgtk2ui/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 #include <X11/Xlib.h> | 11 #include <X11/Xlib.h> |
12 | 12 |
13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
14 #include "ui/gfx/x/x11_types.h" | 14 #include "ui/gfx/x/x11_types.h" |
15 | 15 |
16 namespace libgtk2ui { | 16 namespace libgtk2ui { |
17 | 17 |
18 // static | 18 // static |
19 Gtk2EventLoop* Gtk2EventLoop::GetInstance() { | 19 Gtk2EventLoop* Gtk2EventLoop::GetInstance() { |
20 return 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 |
27 Gtk2EventLoop::~Gtk2EventLoop() { | 27 Gtk2EventLoop::~Gtk2EventLoop() { |
28 gdk_event_handler_set(reinterpret_cast<GdkEventFunc>(gtk_main_do_event), | 28 gdk_event_handler_set(reinterpret_cast<GdkEventFunc>(gtk_main_do_event), |
29 NULL, NULL); | 29 NULL, NULL); |
30 } | 30 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // the upper 16 bits into another unused field. (crbug.com/524084) | 76 // the upper 16 bits into another unused field. (crbug.com/524084) |
77 x_event.xkey.x = x_event.xkey.y = -1; | 77 x_event.xkey.x = x_event.xkey.y = -1; |
78 x_event.xkey.x_root = gdk_event_key.hardware_keycode; | 78 x_event.xkey.x_root = gdk_event_key.hardware_keycode; |
79 x_event.xkey.y_root = gdk_event_key.state >> 16; | 79 x_event.xkey.y_root = gdk_event_key.state >> 16; |
80 | 80 |
81 XSendEvent(x_event.xkey.display, x_event.xkey.window, true, KeyPressMask, | 81 XSendEvent(x_event.xkey.display, x_event.xkey.window, true, KeyPressMask, |
82 &x_event); | 82 &x_event); |
83 } | 83 } |
84 | 84 |
85 } // namespace libgtk2ui | 85 } // namespace libgtk2ui |
OLD | NEW |