Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: chrome/browser/ui/libgtkui/gtk_event_loop.cc

Issue 2453243002: Gtk3 UI: Rename files in libgtkui containing gtk2 in their name (Closed)
Patch Set: Fix git cl format mistake Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/libgtkui/gtk2_event_loop.h" 5 #include "chrome/browser/ui/libgtkui/gtk_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 libgtkui { 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
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), NULL,
29 NULL, NULL); 29 NULL);
30 } 30 }
31 31
32 // static 32 // static
33 void Gtk2EventLoop::DispatchGdkEvent(GdkEvent* gdk_event, gpointer) { 33 void Gtk2EventLoop::DispatchGdkEvent(GdkEvent* gdk_event, gpointer) {
34 switch (gdk_event->type) { 34 switch (gdk_event->type) {
35 case GDK_KEY_PRESS: 35 case GDK_KEY_PRESS:
36 case GDK_KEY_RELEASE: 36 case GDK_KEY_RELEASE:
37 ProcessGdkEventKey(gdk_event->key); 37 ProcessGdkEventKey(gdk_event->key);
38 break; 38 break;
39 default: 39 default:
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 libgtkui 82 } // namespace libgtkui
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtkui/gtk_event_loop.h ('k') | chrome/browser/ui/libgtkui/gtk_key_bindings_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698