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

Side by Side Diff: chrome/common/gtk_util.cc

Issue 463056: GTK: hook up drag and drop of browser actions (for reordering).... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/gtk_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/common/gtk_util.h" 5 #include "chrome/common/gtk_util.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 #include <gdk/gdkx.h> 8 #include <gdk/gdkx.h>
9 9
10 #include <cstdarg> 10 #include <cstdarg>
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // to be paired with a gdk_cursor_unref() so ref it here (as we own the ref 89 // to be paired with a gdk_cursor_unref() so ref it here (as we own the ref
90 // that comes from gdk_cursor_new(). 90 // that comes from gdk_cursor_new().
91 gdk_cursor_ref(cursor); 91 gdk_cursor_ref(cursor);
92 92
93 return cursor; 93 return cursor;
94 } 94 }
95 95
96 std::map<GdkCursorType, GdkCursor*> cursor_cache_; 96 std::map<GdkCursorType, GdkCursor*> cursor_cache_;
97 }; 97 };
98 98
99 // Expose event handler for a container that simply suppresses the default
100 // drawing and propagates the expose event to the container's children.
101 gboolean PaintNoBackground(GtkWidget* widget,
102 GdkEventExpose* event,
103 gpointer unused) {
104 GList* children = gtk_container_get_children(GTK_CONTAINER(widget));
105 for (GList* item = children; item; item = item->next) {
106 gtk_container_propagate_expose(GTK_CONTAINER(widget),
107 GTK_WIDGET(item->data),
108 event);
109 }
110 g_list_free(children);
111
112 return TRUE;
113 }
114
99 } // namespace 115 } // namespace
100 116
101 namespace event_utils { 117 namespace event_utils {
102 118
103 WindowOpenDisposition DispositionFromEventFlags(guint event_flags) { 119 WindowOpenDisposition DispositionFromEventFlags(guint event_flags) {
104 if ((event_flags & GDK_BUTTON2_MASK) || (event_flags & GDK_CONTROL_MASK)) { 120 if ((event_flags & GDK_BUTTON2_MASK) || (event_flags & GDK_CONTROL_MASK)) {
105 return (event_flags & GDK_SHIFT_MASK) ? 121 return (event_flags & GDK_SHIFT_MASK) ?
106 NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB; 122 NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB;
107 } 123 }
108 124
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 void ApplyMessageDialogQuirks(GtkWidget* dialog) { 628 void ApplyMessageDialogQuirks(GtkWidget* dialog) {
613 if (gtk_window_get_modal(GTK_WINDOW(dialog))) { 629 if (gtk_window_get_modal(GTK_WINDOW(dialog))) {
614 // Work around a KDE 3 window manager bug. 630 // Work around a KDE 3 window manager bug.
615 scoped_ptr<base::EnvironmentVariableGetter> env( 631 scoped_ptr<base::EnvironmentVariableGetter> env(
616 base::EnvironmentVariableGetter::Create()); 632 base::EnvironmentVariableGetter::Create());
617 if (base::DESKTOP_ENVIRONMENT_KDE3 == GetDesktopEnvironment(env.get())) 633 if (base::DESKTOP_ENVIRONMENT_KDE3 == GetDesktopEnvironment(env.get()))
618 gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE); 634 gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE);
619 } 635 }
620 } 636 }
621 637
638 void SuppressDefaultPainting(GtkWidget* container) {
639 g_signal_connect(container, "expose-event",
640 G_CALLBACK(PaintNoBackground), NULL);
641 }
642
622 } // namespace gtk_util 643 } // namespace gtk_util
OLDNEW
« no previous file with comments | « chrome/common/gtk_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698