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

Side by Side Diff: chrome/browser/ui/panels/panel_drag_gtk.h

Issue 10170037: Make GTK Panels ignore mouse/keyboard events after drag is ended until mouse is released. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update GTK native panel testing end drag logic. Created 8 years, 7 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_DRAG_GTK_H_ 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_DRAG_GTK_H_
6 #define CHROME_BROWSER_UI_PANELS_PANEL_DRAG_GTK_H_ 6 #define CHROME_BROWSER_UI_PANELS_PANEL_DRAG_GTK_H_
7 #pragma once 7 #pragma once
8 8
9 #include <gtk/gtk.h> 9 #include <gtk/gtk.h>
10 10
(...skipping 30 matching lines...) Expand all
41 // |titlebar_widget| should handle the mouse release event if the mouse 41 // |titlebar_widget| should handle the mouse release event if the mouse
42 // is released without exceeding the drag threshold (a mouse click). 42 // is released without exceeding the drag threshold (a mouse click).
43 void InitialTitlebarMousePress(GdkEventButton* event, 43 void InitialTitlebarMousePress(GdkEventButton* event,
44 GtkWidget* titlebar_widget); 44 GtkWidget* titlebar_widget);
45 45
46 private: 46 private:
47 friend class NativePanelTestingGtk; 47 friend class NativePanelTestingGtk;
48 48
49 enum DragState { 49 enum DragState {
50 NOT_DRAGGING, 50 NOT_DRAGGING,
51 DRAG_IN_PROGRESS 51 DRAG_IN_PROGRESS,
52 DRAG_ENDED_WAITING_FOR_MOUSE_RELEASE
52 }; 53 };
53 54
54 // Callbacks for GTK mouse and key events. 55 // Callbacks for GTK mouse and key events.
55 CHROMEGTK_CALLBACK_1(PanelDragGtk, gboolean, OnMouseMoveEvent, 56 CHROMEGTK_CALLBACK_1(PanelDragGtk, gboolean, OnMouseMoveEvent,
56 GdkEventMotion*); 57 GdkEventMotion*);
57 CHROMEGTK_CALLBACK_1(PanelDragGtk, gboolean, OnButtonPressEvent, 58 CHROMEGTK_CALLBACK_1(PanelDragGtk, gboolean, OnButtonPressEvent,
58 GdkEventButton*); 59 GdkEventButton*);
59 CHROMEGTK_CALLBACK_1(PanelDragGtk, gboolean, OnButtonReleaseEvent, 60 CHROMEGTK_CALLBACK_1(PanelDragGtk, gboolean, OnButtonReleaseEvent,
60 GdkEventButton*); 61 GdkEventButton*);
61 CHROMEGTK_CALLBACK_1(PanelDragGtk, gboolean, OnKeyPressEvent, 62 CHROMEGTK_CALLBACK_1(PanelDragGtk, gboolean, OnKeyPressEvent,
62 GdkEventKey*); 63 GdkEventKey*);
63 CHROMEGTK_CALLBACK_1(PanelDragGtk, gboolean, OnKeyReleaseEvent, 64 CHROMEGTK_CALLBACK_1(PanelDragGtk, gboolean, OnKeyReleaseEvent,
64 GdkEventKey*); 65 GdkEventKey*);
65 CHROMEGTK_CALLBACK_1(PanelDragGtk, gboolean, OnGrabBrokenEvent, 66 CHROMEGTK_CALLBACK_1(PanelDragGtk, gboolean, OnGrabBrokenEvent,
66 GdkEventGrabBroken*); 67 GdkEventGrabBroken*);
67 68
68 // Utility to dcheck a bunch of state to ensure a clean slate. 69 // Utility to dcheck a bunch of state to ensure a clean slate.
69 // Returns only if all the dchecks pass. 70 // Returns only if all the dchecks pass.
70 void AssertCleanState(); 71 void AssertCleanState();
71 72
72 void GrabPointerAndKeyboard(GdkEventButton* event, 73 void GrabPointerAndKeyboard(GdkEventButton* event,
73 GdkCursor* cursor); 74 GdkCursor* cursor);
75 void ReleasePointerAndKeyboardGrab();
74 76
75 // Ends any drag that is currently in progress (if any). 77 // Ends any drag that is currently in progress (if any).
76 // Also resets all drag state. 78 // Resets all drag state except for pointer and keyboard grabs.
79 // The grabs are released when the mouse is released to prevent a
80 // mouse release *after* the drag has ended (e.g. via ESC key) from
81 // being treated as a mouse click.
77 void EndDrag(bool canceled); 82 void EndDrag(bool canceled);
78 83
79 // Weak pointer to the panel being dragged. 84 // Weak pointer to the panel being dragged.
80 Panel* panel_; 85 Panel* panel_;
81 86
82 // Invisible event box to receive mouse and key events. 87 // Invisible event box to receive mouse and key events.
83 GtkWidget* drag_widget_; 88 GtkWidget* drag_widget_;
84 89
85 DragState drag_state_; 90 DragState drag_state_;
86 91
87 // A copy of the initial button press event. 92 // A copy of the initial button press event.
88 GdkEvent* initial_mouse_down_; 93 GdkEvent* initial_mouse_down_;
89 94
90 // Widget that should process the mouse click if mouse is released 95 // Widget that should process the mouse click if mouse is released
91 // without exceeding the drag threshold. May be NULL if no click 96 // without exceeding the drag threshold. May be NULL if no click
92 // handling is necessary. 97 // handling is necessary.
93 GtkWidget* click_handler_; 98 GtkWidget* click_handler_;
94 99
95 // Delegate for processing drag depends on actual type of drag. 100 // Delegate for processing drag depends on actual type of drag.
96 PanelDragDelegate* drag_delegate_; 101 PanelDragDelegate* drag_delegate_;
97 102
98 DISALLOW_COPY_AND_ASSIGN(PanelDragGtk); 103 DISALLOW_COPY_AND_ASSIGN(PanelDragGtk);
99 }; 104 };
100 105
101 #endif // CHROME_BROWSER_UI_PANELS_PANEL_DRAG_GTK_H_ 106 #endif // CHROME_BROWSER_UI_PANELS_PANEL_DRAG_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_window_gtk.cc ('k') | chrome/browser/ui/panels/panel_drag_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698