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

Side by Side Diff: chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.cc

Issue 813823003: Allow build under GTK+ 2.24. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update expected_deps since the glib version dep decreased. Created 6 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/x11_input_method_context_impl_gtk2.h" 5 #include "chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.h"
6 6
7 #include <gdk/gdk.h> 7 #include <gdk/gdk.h>
8 #include <gdk/gdkkeysyms.h> 8 #include <gdk/gdkkeysyms.h>
9 #include <gdk/gdkx.h> 9 #include <gdk/gdkx.h>
10 10
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 keyboard_group = keys[i].group; 229 keyboard_group = keys[i].group;
230 break; 230 break;
231 } 231 }
232 } 232 }
233 } 233 }
234 g_free(keys); 234 g_free(keys);
235 keys = NULL; 235 keys = NULL;
236 g_free(keyvals); 236 g_free(keyvals);
237 keyvals = NULL; 237 keyvals = NULL;
238 // Get a GdkWindow. 238 // Get a GdkWindow.
239 #if GTK_CHECK_VERSION(2,24,0)
239 GdkWindow* window = gdk_x11_window_lookup_for_display(display, xkey.window); 240 GdkWindow* window = gdk_x11_window_lookup_for_display(display, xkey.window);
241 #else
242 GdkWindow* window = gdk_window_lookup_for_display(display, xkey.window);
243 #endif
240 if (window) 244 if (window)
241 g_object_ref(window); 245 g_object_ref(window);
242 else 246 else
247 #if GTK_CHECK_VERSION(2,24,0)
243 window = gdk_x11_window_foreign_new_for_display(display, xkey.window); 248 window = gdk_x11_window_foreign_new_for_display(display, xkey.window);
249 #else
250 window = gdk_window_foreign_new_for_display(display, xkey.window);
251 #endif
244 if (!window) { 252 if (!window) {
245 LOG(ERROR) << "Cannot get a GdkWindow for a key event."; 253 LOG(ERROR) << "Cannot get a GdkWindow for a key event.";
246 return NULL; 254 return NULL;
247 } 255 }
248 256
249 // Create a GdkEvent. 257 // Create a GdkEvent.
250 GdkEventType event_type = xkey.type == KeyPress ? 258 GdkEventType event_type = xkey.type == KeyPress ?
251 GDK_KEY_PRESS : GDK_KEY_RELEASE; 259 GDK_KEY_PRESS : GDK_KEY_RELEASE;
252 GdkEvent* event = gdk_event_new(event_type); 260 GdkEvent* event = gdk_event_new(event_type);
253 event->key.type = event_type; 261 event->key.type = event_type;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 if (context != gtk_context_) 349 if (context != gtk_context_)
342 return; 350 return;
343 351
344 delegate_->OnPreeditStart(); 352 delegate_->OnPreeditStart();
345 } 353 }
346 354
347 // GtkCommitSignalTrap 355 // GtkCommitSignalTrap
348 356
349 X11InputMethodContextImplGtk2::GtkCommitSignalTrap::GtkCommitSignalTrap() 357 X11InputMethodContextImplGtk2::GtkCommitSignalTrap::GtkCommitSignalTrap()
350 : is_trap_enabled_(false), 358 : is_trap_enabled_(false),
359 #if GTK_CHECK_VERSION (2,22,0)
351 gdk_event_key_keyval_(GDK_KEY_VoidSymbol), 360 gdk_event_key_keyval_(GDK_KEY_VoidSymbol),
361 #else
362 gdk_event_key_keyval_(GDK_VoidSymbol),
363 #endif
352 is_signal_caught_(false) {} 364 is_signal_caught_(false) {}
353 365
354 void X11InputMethodContextImplGtk2::GtkCommitSignalTrap::StartTrap( 366 void X11InputMethodContextImplGtk2::GtkCommitSignalTrap::StartTrap(
355 guint keyval) { 367 guint keyval) {
356 is_signal_caught_ = false; 368 is_signal_caught_ = false;
357 gdk_event_key_keyval_ = keyval; 369 gdk_event_key_keyval_ = keyval;
358 is_trap_enabled_ = true; 370 is_trap_enabled_ = true;
359 } 371 }
360 372
361 void X11InputMethodContextImplGtk2::GtkCommitSignalTrap::StopTrap() { 373 void X11InputMethodContextImplGtk2::GtkCommitSignalTrap::StopTrap() {
362 is_trap_enabled_ = false; 374 is_trap_enabled_ = false;
363 } 375 }
364 376
365 bool X11InputMethodContextImplGtk2::GtkCommitSignalTrap::Trap( 377 bool X11InputMethodContextImplGtk2::GtkCommitSignalTrap::Trap(
366 const base::string16& text) { 378 const base::string16& text) {
367 DCHECK(!is_signal_caught_); 379 DCHECK(!is_signal_caught_);
368 if (is_trap_enabled_ && 380 if (is_trap_enabled_ &&
369 text.length() == 1 && 381 text.length() == 1 &&
370 text[0] == gdk_keyval_to_unicode(gdk_event_key_keyval_)) { 382 text[0] == gdk_keyval_to_unicode(gdk_event_key_keyval_)) {
371 is_signal_caught_ = true; 383 is_signal_caught_ = true;
372 return true; 384 return true;
373 } else { 385 } else {
374 return false; 386 return false;
375 } 387 }
376 } 388 }
377 389
378 } // namespace libgtk2ui 390 } // namespace libgtk2ui
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtk2ui/print_dialog_gtk2.cc ('k') | chrome/installer/linux/debian/expected_deps_ia32 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698