OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef VIEWS_WIDGET_NATIVE_WIDGET_GTK_H_ |
| 6 #define VIEWS_WIDGET_NATIVE_WIDGET_GTK_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <gtk/gtk.h> |
| 10 |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/message_loop.h" |
| 14 #include "ui/base/gtk/gtk_signal.h" |
| 15 #include "ui/base/x/active_window_watcher_x.h" |
| 16 #include "ui/gfx/compositor/compositor.h" |
| 17 #include "ui/gfx/size.h" |
| 18 #include "ui/views/focus/focus_manager.h" |
| 19 #include "views/widget/native_widget_private.h" |
| 20 #include "views/widget/widget.h" |
| 21 |
| 22 namespace gfx { |
| 23 class Rect; |
| 24 } |
| 25 |
| 26 namespace ui { |
| 27 class OSExchangeData; |
| 28 class OSExchangeDataProviderGtk; |
| 29 class GtkSignalRegistrar; |
| 30 } |
| 31 using ui::OSExchangeData; |
| 32 using ui::OSExchangeDataProviderGtk; |
| 33 |
| 34 namespace views { |
| 35 |
| 36 class DropTargetGtk; |
| 37 class InputMethod; |
| 38 class View; |
| 39 |
| 40 namespace internal { |
| 41 class NativeWidgetDelegate; |
| 42 } |
| 43 |
| 44 // Widget implementation for GTK. |
| 45 class VIEWS_EXPORT NativeWidgetGtk : public internal::NativeWidgetPrivate, |
| 46 public ui::CompositorDelegate, |
| 47 public ui::ActiveWindowWatcherX::Observer { |
| 48 public: |
| 49 explicit NativeWidgetGtk(internal::NativeWidgetDelegate* delegate); |
| 50 virtual ~NativeWidgetGtk(); |
| 51 |
| 52 // Returns the transient parent. See make_transient_to_parent for details on |
| 53 // what the transient parent is. |
| 54 GtkWindow* GetTransientParent() const; |
| 55 |
| 56 // Makes the background of the window totally transparent. This must be |
| 57 // invoked before Init. This does a couple of checks and returns true if |
| 58 // the window can be made transparent. The actual work of making the window |
| 59 // transparent is done by ConfigureWidgetForTransparentBackground. |
| 60 // This works for both child and window types. |
| 61 bool MakeTransparent(); |
| 62 bool is_transparent() const { return transparent_; } |
| 63 |
| 64 // Enable/Disable double buffering.This is neccessary to prevent |
| 65 // flickering in ScrollView, which has both native and view |
| 66 // controls. |
| 67 void EnableDoubleBuffer(bool enabled); |
| 68 bool is_double_buffered() const { return is_double_buffered_; } |
| 69 |
| 70 bool is_ignore_events() const { return ignore_events_; } |
| 71 |
| 72 // Adds and removes the specified widget as a child of this widget's contents. |
| 73 // These methods make sure to add the widget to the window's contents |
| 74 // container if this widget is a window. |
| 75 void AddChild(GtkWidget* child); |
| 76 void RemoveChild(GtkWidget* child); |
| 77 |
| 78 // A safe way to reparent a child widget to this widget. Calls |
| 79 // gtk_widget_reparent which handles refcounting to avoid destroying the |
| 80 // widget when removing it from its old parent. |
| 81 void ReparentChild(GtkWidget* child); |
| 82 |
| 83 // Positions a child GtkWidget at the specified location and bounds. |
| 84 void PositionChild(GtkWidget* child, int x, int y, int w, int h); |
| 85 |
| 86 // Parent GtkWidget all children are added to. When this NativeWidgetGtk |
| 87 // corresponds to a top level window, this is the GtkFixed within the |
| 88 // GtkWindow, not the GtkWindow itself. For child widgets, this is the same |
| 89 // GtkFixed as |widget_|. |
| 90 GtkWidget* window_contents() const { return window_contents_; } |
| 91 |
| 92 // Starts a drag on this widget. This blocks until the drag is done. |
| 93 void DoDrag(const OSExchangeData& data, int operation); |
| 94 |
| 95 // Invoked when the active status changes. |
| 96 virtual void OnActiveChanged(); |
| 97 |
| 98 // Sets the drop target to NULL. This is invoked by DropTargetGTK when the |
| 99 // drop is done. |
| 100 void ResetDropTarget(); |
| 101 |
| 102 // Gets the requested size of the widget. This can be the size |
| 103 // stored in properties for a GtkViewsFixed, or in the requisitioned |
| 104 // size of other kinds of widgets. |
| 105 void GetRequestedSize(gfx::Size* out) const; |
| 106 |
| 107 // Overridden from ui::ActiveWindowWatcherX::Observer. |
| 108 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE; |
| 109 |
| 110 // Handles a keyboard event by sending it to our focus manager. |
| 111 // Returns true if it's handled by the focus manager. |
| 112 bool HandleKeyboardEvent(const KeyEvent& key); |
| 113 |
| 114 // Tells widget not to remove FREEZE_UPDATES property when the |
| 115 // widget is painted. This is used if painting the gtk widget |
| 116 // is not enough to show the window and has to wait further like |
| 117 // keyboard overlay. Returns true if this is called before |
| 118 // FREEZE_UPDATES property is removed, or false otherwise. |
| 119 bool SuppressFreezeUpdates(); |
| 120 |
| 121 // Sets and deletes FREEZE_UPDATES property on given |window|. |
| 122 // It adds the property when |enable| is true and remove if false. |
| 123 // Calling this method will realize the window if it's not realized yet. |
| 124 // This property is used to help WindowManager know when the window |
| 125 // is fully painted so that WM can map the fully painted window. |
| 126 // The property is based on Owen Taylor's proposal at |
| 127 // http://mail.gnome.org/archives/wm-spec-list/2009-June/msg00002.html. |
| 128 // This is just a hint to WM, and won't change the behavior for WM |
| 129 // which does not support this property. |
| 130 static void UpdateFreezeUpdatesProperty(GtkWindow* window, bool enable); |
| 131 |
| 132 // Registers a expose handler that removes FREEZE_UPDATES property. |
| 133 // If you are adding a GtkWidget with its own GdkWindow that may |
| 134 // fill the entire area of the NativeWidgetGtk to the view hierachy, you |
| 135 // need use this function to tell WM that when the widget is ready |
| 136 // to be shown. |
| 137 // Caller of this method do not need to disconnect this because the |
| 138 // handler will be removed upon the first invocation of the handler, |
| 139 // or when the widget is re-attached, and expose won't be emitted on |
| 140 // detached widget. |
| 141 static void RegisterChildExposeHandler(GtkWidget* widget); |
| 142 |
| 143 // Overridden from internal::NativeWidgetPrivate: |
| 144 virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE; |
| 145 virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE; |
| 146 virtual void UpdateFrameAfterFrameChange() OVERRIDE; |
| 147 virtual bool ShouldUseNativeFrame() const OVERRIDE; |
| 148 virtual void FrameTypeChanged() OVERRIDE; |
| 149 virtual Widget* GetWidget() OVERRIDE; |
| 150 virtual const Widget* GetWidget() const OVERRIDE; |
| 151 virtual gfx::NativeView GetNativeView() const OVERRIDE; |
| 152 virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE; |
| 153 virtual Widget* GetTopLevelWidget() OVERRIDE; |
| 154 virtual const ui::Compositor* GetCompositor() const OVERRIDE; |
| 155 virtual ui::Compositor* GetCompositor() OVERRIDE; |
| 156 virtual void CalculateOffsetToAncestorWithLayer( |
| 157 gfx::Point* offset, |
| 158 ui::Layer** layer_parent) OVERRIDE; |
| 159 virtual void ReorderLayers() OVERRIDE; |
| 160 virtual void ViewRemoved(View* view) OVERRIDE; |
| 161 virtual void SetNativeWindowProperty(const char* name, void* value) OVERRIDE; |
| 162 virtual void* GetNativeWindowProperty(const char* name) const OVERRIDE; |
| 163 virtual TooltipManager* GetTooltipManager() const OVERRIDE; |
| 164 virtual bool IsScreenReaderActive() const OVERRIDE; |
| 165 virtual void SendNativeAccessibilityEvent( |
| 166 View* view, |
| 167 ui::AccessibilityTypes::Event event_type) OVERRIDE; |
| 168 virtual void SetMouseCapture() OVERRIDE; |
| 169 virtual void ReleaseMouseCapture() OVERRIDE; |
| 170 virtual bool HasMouseCapture() const OVERRIDE; |
| 171 virtual InputMethod* CreateInputMethod() OVERRIDE; |
| 172 virtual void CenterWindow(const gfx::Size& size) OVERRIDE; |
| 173 virtual void GetWindowPlacement( |
| 174 gfx::Rect* bounds, |
| 175 ui::WindowShowState* show_state) const OVERRIDE; |
| 176 virtual void SetWindowTitle(const string16& title) OVERRIDE; |
| 177 virtual void SetWindowIcons(const SkBitmap& window_icon, |
| 178 const SkBitmap& app_icon) OVERRIDE; |
| 179 virtual void SetAccessibleName(const string16& name) OVERRIDE; |
| 180 virtual void SetAccessibleRole(ui::AccessibilityTypes::Role role) OVERRIDE; |
| 181 virtual void SetAccessibleState(ui::AccessibilityTypes::State state) OVERRIDE; |
| 182 virtual void BecomeModal() OVERRIDE; |
| 183 virtual gfx::Rect GetWindowScreenBounds() const OVERRIDE; |
| 184 virtual gfx::Rect GetClientAreaScreenBounds() const OVERRIDE; |
| 185 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; |
| 186 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; |
| 187 virtual void SetSize(const gfx::Size& size) OVERRIDE; |
| 188 virtual void MoveAbove(gfx::NativeView native_view) OVERRIDE; |
| 189 virtual void MoveToTop() OVERRIDE; |
| 190 virtual void SetShape(gfx::NativeRegion shape) OVERRIDE; |
| 191 virtual void Close() OVERRIDE; |
| 192 virtual void CloseNow() OVERRIDE; |
| 193 virtual void EnableClose(bool enable) OVERRIDE; |
| 194 virtual void Show() OVERRIDE; |
| 195 virtual void Hide() OVERRIDE; |
| 196 virtual void ShowMaximizedWithBounds( |
| 197 const gfx::Rect& restored_bounds) OVERRIDE; |
| 198 virtual void ShowWithWindowState(ui::WindowShowState window_state) OVERRIDE; |
| 199 virtual bool IsVisible() const OVERRIDE; |
| 200 virtual void Activate() OVERRIDE; |
| 201 virtual void Deactivate() OVERRIDE; |
| 202 virtual bool IsActive() const OVERRIDE; |
| 203 virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE; |
| 204 virtual void Maximize() OVERRIDE; |
| 205 virtual void Minimize() OVERRIDE; |
| 206 virtual bool IsMaximized() const OVERRIDE; |
| 207 virtual bool IsMinimized() const OVERRIDE; |
| 208 virtual void Restore() OVERRIDE; |
| 209 virtual void SetFullscreen(bool fullscreen) OVERRIDE; |
| 210 virtual bool IsFullscreen() const OVERRIDE; |
| 211 virtual void SetOpacity(unsigned char opacity) OVERRIDE; |
| 212 virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE; |
| 213 virtual bool IsAccessibleWidget() const OVERRIDE; |
| 214 virtual void RunShellDrag(View* view, |
| 215 const ui::OSExchangeData& data, |
| 216 int operation) OVERRIDE; |
| 217 virtual void SchedulePaintInRect(const gfx::Rect& rect) OVERRIDE; |
| 218 virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; |
| 219 virtual void ClearNativeFocus() OVERRIDE; |
| 220 virtual void FocusNativeView(gfx::NativeView native_view) OVERRIDE; |
| 221 virtual bool ConvertPointFromAncestor( |
| 222 const Widget* ancestor, gfx::Point* point) const OVERRIDE; |
| 223 virtual gfx::Rect GetWorkAreaBoundsInScreen() const OVERRIDE; |
| 224 virtual void SetInactiveRenderingDisabled(bool value) OVERRIDE; |
| 225 |
| 226 protected: |
| 227 // Modifies event coordinates to the targeted widget contained by this widget. |
| 228 template<class Event> GdkEvent* TransformEvent(Event* event) { |
| 229 GdkWindow* dest = GTK_WIDGET(window_contents_)->window; |
| 230 if (event && event->window != dest) { |
| 231 gint dest_x, dest_y; |
| 232 gdk_window_get_root_origin(dest, &dest_x, &dest_y); |
| 233 event->x = event->x_root - dest_x; |
| 234 event->y = event->y_root - dest_y; |
| 235 } |
| 236 return reinterpret_cast<GdkEvent*>(event); |
| 237 } |
| 238 |
| 239 // Event handlers: |
| 240 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnButtonPress, |
| 241 GdkEventButton*); |
| 242 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, void, OnSizeRequest, |
| 243 GtkRequisition*); |
| 244 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, void, OnSizeAllocate, |
| 245 GtkAllocation*); |
| 246 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnPaint, |
| 247 GdkEventExpose*); |
| 248 CHROMEGTK_VIRTUAL_CALLBACK_4(NativeWidgetGtk, void, OnDragDataGet, |
| 249 GdkDragContext*, GtkSelectionData*, guint, |
| 250 guint); |
| 251 CHROMEGTK_VIRTUAL_CALLBACK_6(NativeWidgetGtk, void, OnDragDataReceived, |
| 252 GdkDragContext*, gint, gint, GtkSelectionData*, |
| 253 guint, guint); |
| 254 CHROMEGTK_VIRTUAL_CALLBACK_4(NativeWidgetGtk, gboolean, OnDragDrop, |
| 255 GdkDragContext*, gint, gint, guint); |
| 256 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, void, OnDragEnd, |
| 257 GdkDragContext*); |
| 258 CHROMEGTK_VIRTUAL_CALLBACK_2(NativeWidgetGtk, gboolean, OnDragFailed, |
| 259 GdkDragContext*, GtkDragResult); |
| 260 CHROMEGTK_VIRTUAL_CALLBACK_2(NativeWidgetGtk, void, OnDragLeave, |
| 261 GdkDragContext*, guint); |
| 262 CHROMEGTK_VIRTUAL_CALLBACK_4(NativeWidgetGtk, gboolean, OnDragMotion, |
| 263 GdkDragContext*, gint, gint, guint); |
| 264 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnEnterNotify, |
| 265 GdkEventCrossing*); |
| 266 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnLeaveNotify, |
| 267 GdkEventCrossing*); |
| 268 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnMotionNotify, |
| 269 GdkEventMotion*); |
| 270 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnButtonRelease, |
| 271 GdkEventButton*); |
| 272 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnFocusIn, |
| 273 GdkEventFocus*); |
| 274 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnFocusOut, |
| 275 GdkEventFocus*); |
| 276 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnEventKey, |
| 277 GdkEventKey*); |
| 278 CHROMEGTK_VIRTUAL_CALLBACK_4(NativeWidgetGtk, gboolean, OnQueryTooltip, gint, |
| 279 gint, gboolean, GtkTooltip*); |
| 280 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnScroll, |
| 281 GdkEventScroll*); |
| 282 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnVisibilityNotify, |
| 283 GdkEventVisibility*); |
| 284 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnGrabBrokeEvent, |
| 285 GdkEvent*); |
| 286 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, void, OnGrabNotify, gboolean); |
| 287 CHROMEGTK_VIRTUAL_CALLBACK_0(NativeWidgetGtk, void, OnDestroy); |
| 288 CHROMEGTK_VIRTUAL_CALLBACK_0(NativeWidgetGtk, void, OnShow); |
| 289 CHROMEGTK_VIRTUAL_CALLBACK_0(NativeWidgetGtk, void, OnMap); |
| 290 CHROMEGTK_VIRTUAL_CALLBACK_0(NativeWidgetGtk, void, OnHide); |
| 291 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnWindowStateEvent, |
| 292 GdkEventWindowState*); |
| 293 CHROMEGTK_VIRTUAL_CALLBACK_1(NativeWidgetGtk, gboolean, OnConfigureEvent, |
| 294 GdkEventConfigure*); |
| 295 |
| 296 // Invoked when the widget is destroyed and right before the object |
| 297 // destruction. Useful for overriding. |
| 298 virtual void OnDestroyed(GObject *where_the_object_was); |
| 299 static void OnDestroyedThunk(gpointer data, GObject *where_the_object_was) { |
| 300 reinterpret_cast<NativeWidgetGtk*>(data)->OnDestroyed(where_the_object_was); |
| 301 } |
| 302 |
| 303 // Invoked when gtk grab is stolen by other GtkWidget in the same |
| 304 // application. |
| 305 virtual void HandleGtkGrabBroke(); |
| 306 |
| 307 const internal::NativeWidgetDelegate* delegate() const { return delegate_; } |
| 308 internal::NativeWidgetDelegate* delegate() { return delegate_; } |
| 309 |
| 310 private: |
| 311 class DropObserver; |
| 312 friend class DropObserver; |
| 313 |
| 314 // Overridden from ui::CompositorDelegate |
| 315 virtual void ScheduleDraw(); |
| 316 |
| 317 // Overridden from internal::InputMethodDelegate |
| 318 virtual void DispatchKeyEventPostIME(const KeyEvent& key) OVERRIDE; |
| 319 |
| 320 void SetInitParams(const Widget::InitParams& params); |
| 321 |
| 322 // This is called only when the window is transparent. |
| 323 CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnWindowPaint, |
| 324 GdkEventExpose*); |
| 325 |
| 326 // Callbacks for expose event on child widgets. See the description of |
| 327 // RegisterChildChildExposeHandler. |
| 328 void OnChildExpose(GtkWidget* child); |
| 329 static gboolean ChildExposeHandler(GtkWidget* widget, GdkEventExpose* event); |
| 330 |
| 331 // Creates the GtkWidget. |
| 332 void CreateGtkWidget(const Widget::InitParams& params); |
| 333 |
| 334 // Invoked from create widget to enable the various bits needed for a |
| 335 // transparent background. This is only invoked if MakeTransparent has been |
| 336 // invoked. |
| 337 void ConfigureWidgetForTransparentBackground(GtkWidget* parent); |
| 338 |
| 339 // Invoked from create widget to enable the various bits needed for a |
| 340 // window which doesn't receive events. |
| 341 void ConfigureWidgetForIgnoreEvents(); |
| 342 |
| 343 // A utility function to draw a transparent background onto the |widget|. |
| 344 static void DrawTransparentBackground(GtkWidget* widget, |
| 345 GdkEventExpose* event); |
| 346 |
| 347 // Asks the delegate if any to save the window's location and size. |
| 348 void SaveWindowPosition(); |
| 349 |
| 350 // A delegate implementation that handles events received here. |
| 351 // See class documentation for Widget in widget.h for a note about ownership. |
| 352 internal::NativeWidgetDelegate* delegate_; |
| 353 |
| 354 // Our native views. If we're a window/popup, then widget_ is the window and |
| 355 // window_contents_ is a GtkFixed. If we're not a window/popup, then widget_ |
| 356 // and window_contents_ point to the same GtkFixed. |
| 357 GtkWidget* widget_; |
| 358 GtkWidget* window_contents_; |
| 359 |
| 360 // Child GtkWidgets created with no parent need to be parented to a valid top |
| 361 // level window otherwise Gtk throws a fit. |null_parent_| is an invisible |
| 362 // popup that such GtkWidgets are parented to. |
| 363 static GtkWidget* null_parent_; |
| 364 |
| 365 // True if the widget is a child of some other widget. |
| 366 bool child_; |
| 367 |
| 368 // The TooltipManager. |
| 369 // WARNING: RootView's destructor calls into the TooltipManager. As such, this |
| 370 // must be destroyed AFTER root_view_. |
| 371 scoped_ptr<TooltipManager> tooltip_manager_; |
| 372 |
| 373 scoped_ptr<DropTargetGtk> drop_target_; |
| 374 |
| 375 // The following factory is used to delay destruction. |
| 376 base::WeakPtrFactory<NativeWidgetGtk> close_widget_factory_; |
| 377 |
| 378 // See class documentation for Widget in widget.h for a note about ownership. |
| 379 Widget::InitParams::Ownership ownership_; |
| 380 |
| 381 // See description above make_transparent for details. |
| 382 bool transparent_; |
| 383 |
| 384 // Makes the window pass all events through to any windows behind it. |
| 385 // Set during SetInitParams before the widget is created. The actual work of |
| 386 // making the window ignore events is done by ConfigureWidgetForIgnoreEvents. |
| 387 bool ignore_events_; |
| 388 |
| 389 // See note in DropObserver for details on this. |
| 390 bool ignore_drag_leave_; |
| 391 |
| 392 unsigned char opacity_; |
| 393 |
| 394 // This is non-null during the life of DoDrag and contains the actual data |
| 395 // for the drag. |
| 396 const OSExchangeDataProviderGtk* drag_data_; |
| 397 |
| 398 // True to enable debug painting. Enabling causes the damaged |
| 399 // region to be painted to flash in red. |
| 400 static bool debug_paint_enabled_; |
| 401 |
| 402 // State of the window, such as fullscreen, hidden... |
| 403 GdkWindowState window_state_; |
| 404 |
| 405 // Are we active? |
| 406 bool is_active_; |
| 407 |
| 408 // See make_transient_to_parent for a description. |
| 409 bool transient_to_parent_; |
| 410 |
| 411 // Last size supplied to OnSizeAllocate. We cache this as any time the |
| 412 // size of a GtkWidget changes size_allocate is called, even if the size |
| 413 // didn't change. If we didn't cache this and ignore calls when the size |
| 414 // hasn't changed, we can end up getting stuck in a never ending loop. |
| 415 gfx::Size size_; |
| 416 |
| 417 // This is initially false and when the first focus-in event is received this |
| 418 // is set to true and no additional processing is done. Subsequently when |
| 419 // focus-in is received we do the normal focus manager processing. |
| 420 // |
| 421 // This behavior is necessitated by Gtk/X sending focus events |
| 422 // asynchronously. The initial sequence for windows is typically: show, |
| 423 // request focus on some widget. Because of async events on Gtk this becomes |
| 424 // show, request focus, get focus in event which ends up clearing focus |
| 425 // (first request to FocusManager::RestoreFocusedView ends up clearing focus). |
| 426 bool got_initial_focus_in_; |
| 427 |
| 428 // If true, we've received a focus-in event. If false we've received a |
| 429 // focus-out event. We can get multiple focus-out events in a row, we use |
| 430 // this to determine whether we should process the event. |
| 431 bool has_focus_; |
| 432 |
| 433 // If true, the window stays on top of the screen. This is only used |
| 434 // for types other than TYPE_CHILD. |
| 435 bool always_on_top_; |
| 436 |
| 437 // If true, we enable the content widget's double buffering. |
| 438 // This is false by default. |
| 439 bool is_double_buffered_; |
| 440 |
| 441 // Indicates if we should handle the upcoming Alt key release event. |
| 442 bool should_handle_menu_key_release_; |
| 443 |
| 444 // Valid for the lifetime of StartDragForViewFromMouseEvent, indicates the |
| 445 // view the drag started from. |
| 446 View* dragged_view_; |
| 447 |
| 448 // If the widget has ever been painted. This is used to guarantee |
| 449 // that window manager shows the window only after the window is painted. |
| 450 bool painted_; |
| 451 |
| 452 // The compositor for accelerated drawing. |
| 453 scoped_refptr<ui::Compositor> compositor_; |
| 454 |
| 455 // Have we done a pointer grab? |
| 456 bool has_pointer_grab_; |
| 457 |
| 458 // Have we done a keyboard grab? |
| 459 bool has_keyboard_grab_; |
| 460 |
| 461 // ID of the 'grab-notify' signal. If non-zero we're listening for |
| 462 // 'grab-notify' events. |
| 463 glong grab_notify_signal_id_; |
| 464 |
| 465 // If we were created for a menu. |
| 466 bool is_menu_; |
| 467 |
| 468 scoped_ptr<ui::GtkSignalRegistrar> signal_registrar_; |
| 469 |
| 470 DISALLOW_COPY_AND_ASSIGN(NativeWidgetGtk); |
| 471 }; |
| 472 |
| 473 } // namespace views |
| 474 |
| 475 #endif // VIEWS_WIDGET_NATIVE_WIDGET_GTK_H_ |
OLD | NEW |