| OLD | NEW |
| 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/gtk/apps/native_app_window_gtk.h" | 5 #include "chrome/browser/ui/gtk/apps/native_app_window_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkx.h> | 7 #include <gdk/gdkx.h> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/message_loop/message_pump_gtk.h" | 10 #include "base/message_loop/message_pump_gtk.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.h" | 13 #include "chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.h" |
| 14 #include "chrome/browser/ui/gtk/gtk_util.h" | 14 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 15 #include "chrome/browser/ui/gtk/gtk_window_util.h" | 15 #include "chrome/browser/ui/gtk/gtk_window_util.h" |
| 16 #include "chrome/browser/web_applications/web_app.h" | 16 #include "chrome/browser/web_applications/web_app.h" |
| 17 #include "content/public/browser/render_view_host.h" | 17 #include "content/public/browser/render_view_host.h" |
| 18 #include "content/public/browser/render_widget_host_view.h" | 18 #include "content/public/browser/render_widget_host_view.h" |
| 19 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
| 20 #include "content/public/browser/web_contents_view.h" | 20 #include "content/public/browser/web_contents_view.h" |
| 21 #include "extensions/common/extension.h" | 21 #include "extensions/common/extension.h" |
| 22 #include "ui/base/x/active_window_watcher_x.h" | 22 #include "ui/base/x/active_window_watcher_x.h" |
| 23 #include "ui/gfx/gtk_util.h" | 23 #include "ui/gfx/gtk_util.h" |
| 24 #include "ui/gfx/image/image.h" | 24 #include "ui/gfx/image/image.h" |
| 25 #include "ui/gfx/rect.h" | 25 #include "ui/gfx/rect.h" |
| 26 | 26 |
| 27 using apps::ShellWindow; | 27 using apps::AppWindow; |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 // The timeout in milliseconds before we'll get the true window position with | 31 // The timeout in milliseconds before we'll get the true window position with |
| 32 // gtk_window_get_position() after the last GTK configure-event signal. | 32 // gtk_window_get_position() after the last GTK configure-event signal. |
| 33 const int kDebounceTimeoutMilliseconds = 100; | 33 const int kDebounceTimeoutMilliseconds = 100; |
| 34 | 34 |
| 35 const char* kAtomsToCache[] = { | 35 const char* kAtomsToCache[] = { |
| 36 "_NET_WM_STATE", | 36 "_NET_WM_STATE", |
| 37 "_NET_WM_STATE_HIDDEN", | 37 "_NET_WM_STATE_HIDDEN", |
| 38 NULL | 38 NULL |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 } // namespace | 41 } // namespace |
| 42 | 42 |
| 43 NativeAppWindowGtk::NativeAppWindowGtk(ShellWindow* shell_window, | 43 NativeAppWindowGtk::NativeAppWindowGtk(AppWindow* app_window, |
| 44 const ShellWindow::CreateParams& params) | 44 const AppWindow::CreateParams& params) |
| 45 : shell_window_(shell_window), | 45 : app_window_(app_window), |
| 46 window_(NULL), | 46 window_(NULL), |
| 47 state_(GDK_WINDOW_STATE_WITHDRAWN), | 47 state_(GDK_WINDOW_STATE_WITHDRAWN), |
| 48 is_active_(false), | 48 is_active_(false), |
| 49 content_thinks_its_fullscreen_(false), | 49 content_thinks_its_fullscreen_(false), |
| 50 maximize_pending_(false), | 50 maximize_pending_(false), |
| 51 frameless_(params.frame == ShellWindow::FRAME_NONE), | 51 frameless_(params.frame == AppWindow::FRAME_NONE), |
| 52 always_on_top_(params.always_on_top), | 52 always_on_top_(params.always_on_top), |
| 53 frame_cursor_(NULL), | 53 frame_cursor_(NULL), |
| 54 atom_cache_(base::MessagePumpGtk::GetDefaultXDisplay(), kAtomsToCache), | 54 atom_cache_(base::MessagePumpGtk::GetDefaultXDisplay(), kAtomsToCache), |
| 55 is_x_event_listened_(false) { | 55 is_x_event_listened_(false) { |
| 56 Observe(web_contents()); | 56 Observe(web_contents()); |
| 57 | 57 |
| 58 window_ = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); | 58 window_ = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); |
| 59 | 59 |
| 60 gfx::NativeView native_view = | 60 gfx::NativeView native_view = |
| 61 web_contents()->GetView()->GetNativeView(); | 61 web_contents()->GetView()->GetNativeView(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 82 gtk_window_set_resizable(window_, FALSE); | 82 gtk_window_set_resizable(window_, FALSE); |
| 83 } | 83 } |
| 84 | 84 |
| 85 // make sure bounds_ and restored_bounds_ have correct values until we | 85 // make sure bounds_ and restored_bounds_ have correct values until we |
| 86 // get our first configure-event | 86 // get our first configure-event |
| 87 bounds_ = restored_bounds_ = params.bounds; | 87 bounds_ = restored_bounds_ = params.bounds; |
| 88 gint x, y; | 88 gint x, y; |
| 89 gtk_window_get_position(window_, &x, &y); | 89 gtk_window_get_position(window_, &x, &y); |
| 90 bounds_.set_origin(gfx::Point(x, y)); | 90 bounds_.set_origin(gfx::Point(x, y)); |
| 91 | 91 |
| 92 // Hide titlebar when {frame: 'none'} specified on ShellWindow. | 92 // Hide titlebar when {frame: 'none'} specified on AppWindow.. |
| 93 if (frameless_) | 93 if (frameless_) |
| 94 gtk_window_set_decorated(window_, false); | 94 gtk_window_set_decorated(window_, false); |
| 95 | 95 |
| 96 if (always_on_top_) | 96 if (always_on_top_) |
| 97 gtk_window_set_keep_above(window_, TRUE); | 97 gtk_window_set_keep_above(window_, TRUE); |
| 98 | 98 |
| 99 UpdateWindowMinMaxSize(); | 99 UpdateWindowMinMaxSize(); |
| 100 | 100 |
| 101 // In some (older) versions of compiz, raising top-level windows when they | 101 // In some (older) versions of compiz, raising top-level windows when they |
| 102 // are partially off-screen causes them to get snapped back on screen, not | 102 // are partially off-screen causes them to get snapped back on screen, not |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(window_)); | 139 GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(window_)); |
| 140 gdk_window_add_filter(window, | 140 gdk_window_add_filter(window, |
| 141 &NativeAppWindowGtk::OnXEventThunk, | 141 &NativeAppWindowGtk::OnXEventThunk, |
| 142 this); | 142 this); |
| 143 is_x_event_listened_ = true; | 143 is_x_event_listened_ = true; |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 // Add the keybinding registry. | 147 // Add the keybinding registry. |
| 148 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryGtk( | 148 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryGtk( |
| 149 Profile::FromBrowserContext(shell_window_->browser_context()), | 149 Profile::FromBrowserContext(app_window_->browser_context()), |
| 150 window_, | 150 window_, |
| 151 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, | 151 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, |
| 152 shell_window_)); | 152 app_window_)); |
| 153 | 153 |
| 154 ui::ActiveWindowWatcherX::AddObserver(this); | 154 ui::ActiveWindowWatcherX::AddObserver(this); |
| 155 } | 155 } |
| 156 | 156 |
| 157 NativeAppWindowGtk::~NativeAppWindowGtk() { | 157 NativeAppWindowGtk::~NativeAppWindowGtk() { |
| 158 ui::ActiveWindowWatcherX::RemoveObserver(this); | 158 ui::ActiveWindowWatcherX::RemoveObserver(this); |
| 159 if (is_x_event_listened_) { | 159 if (is_x_event_listened_) { |
| 160 gdk_window_remove_filter(NULL, | 160 gdk_window_remove_filter(NULL, |
| 161 &NativeAppWindowGtk::OnXEventThunk, | 161 &NativeAppWindowGtk::OnXEventThunk, |
| 162 this); | 162 this); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 void NativeAppWindowGtk::ShowInactive() { | 224 void NativeAppWindowGtk::ShowInactive() { |
| 225 gtk_window_set_focus_on_map(window_, false); | 225 gtk_window_set_focus_on_map(window_, false); |
| 226 gtk_widget_show(GTK_WIDGET(window_)); | 226 gtk_widget_show(GTK_WIDGET(window_)); |
| 227 } | 227 } |
| 228 | 228 |
| 229 void NativeAppWindowGtk::Hide() { | 229 void NativeAppWindowGtk::Hide() { |
| 230 gtk_widget_hide(GTK_WIDGET(window_)); | 230 gtk_widget_hide(GTK_WIDGET(window_)); |
| 231 } | 231 } |
| 232 | 232 |
| 233 void NativeAppWindowGtk::Close() { | 233 void NativeAppWindowGtk::Close() { |
| 234 shell_window_->OnNativeWindowChanged(); | 234 app_window_->OnNativeWindowChanged(); |
| 235 | 235 |
| 236 // Cancel any pending callback from the window configure debounce timer. | 236 // Cancel any pending callback from the window configure debounce timer. |
| 237 window_configure_debounce_timer_.Stop(); | 237 window_configure_debounce_timer_.Stop(); |
| 238 | 238 |
| 239 GtkWidget* window = GTK_WIDGET(window_); | 239 GtkWidget* window = GTK_WIDGET(window_); |
| 240 // To help catch bugs in any event handlers that might get fired during the | 240 // To help catch bugs in any event handlers that might get fired during the |
| 241 // destruction, set window_ to NULL before any handlers will run. | 241 // destruction, set window_ to NULL before any handlers will run. |
| 242 window_ = NULL; | 242 window_ = NULL; |
| 243 | 243 |
| 244 // OnNativeClose does a delete this so no other members should | 244 // OnNativeClose does a delete this so no other members should |
| 245 // be accessed after. gtk_widget_destroy is safe (and must | 245 // be accessed after. gtk_widget_destroy is safe (and must |
| 246 // be last). | 246 // be last). |
| 247 shell_window_->OnNativeClose(); | 247 app_window_->OnNativeClose(); |
| 248 gtk_widget_destroy(window); | 248 gtk_widget_destroy(window); |
| 249 } | 249 } |
| 250 | 250 |
| 251 void NativeAppWindowGtk::Activate() { | 251 void NativeAppWindowGtk::Activate() { |
| 252 gtk_window_present(window_); | 252 gtk_window_present(window_); |
| 253 } | 253 } |
| 254 | 254 |
| 255 void NativeAppWindowGtk::Deactivate() { | 255 void NativeAppWindowGtk::Deactivate() { |
| 256 gdk_window_lower(gtk_widget_get_window(GTK_WIDGET(window_))); | 256 gdk_window_lower(gtk_widget_get_window(GTK_WIDGET(window_))); |
| 257 } | 257 } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 std::vector< ::Atom>::iterator it = | 328 std::vector< ::Atom>::iterator it = |
| 329 std::find(atom_list.begin(), | 329 std::find(atom_list.begin(), |
| 330 atom_list.end(), | 330 atom_list.end(), |
| 331 atom_cache_.GetAtom("_NET_WM_STATE_HIDDEN")); | 331 atom_cache_.GetAtom("_NET_WM_STATE_HIDDEN")); |
| 332 | 332 |
| 333 GdkWindowState previous_state = state_; | 333 GdkWindowState previous_state = state_; |
| 334 state_ = (it != atom_list.end()) ? GDK_WINDOW_STATE_ICONIFIED : | 334 state_ = (it != atom_list.end()) ? GDK_WINDOW_STATE_ICONIFIED : |
| 335 static_cast<GdkWindowState>(state_ & ~GDK_WINDOW_STATE_ICONIFIED); | 335 static_cast<GdkWindowState>(state_ & ~GDK_WINDOW_STATE_ICONIFIED); |
| 336 | 336 |
| 337 if (previous_state != state_) { | 337 if (previous_state != state_) { |
| 338 shell_window_->OnNativeWindowChanged(); | 338 app_window_->OnNativeWindowChanged(); |
| 339 } | 339 } |
| 340 } | 340 } |
| 341 | 341 |
| 342 return GDK_FILTER_CONTINUE; | 342 return GDK_FILTER_CONTINUE; |
| 343 } | 343 } |
| 344 | 344 |
| 345 void NativeAppWindowGtk::FlashFrame(bool flash) { | 345 void NativeAppWindowGtk::FlashFrame(bool flash) { |
| 346 gtk_window_set_urgency_hint(window_, flash); | 346 gtk_window_set_urgency_hint(window_, flash); |
| 347 } | 347 } |
| 348 | 348 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 observer_list_.RemoveObserver(observer); | 395 observer_list_.RemoveObserver(observer); |
| 396 } | 396 } |
| 397 | 397 |
| 398 void NativeAppWindowGtk::ActiveWindowChanged(GdkWindow* active_window) { | 398 void NativeAppWindowGtk::ActiveWindowChanged(GdkWindow* active_window) { |
| 399 // Do nothing if we're in the process of closing the browser window. | 399 // Do nothing if we're in the process of closing the browser window. |
| 400 if (!window_) | 400 if (!window_) |
| 401 return; | 401 return; |
| 402 | 402 |
| 403 is_active_ = gtk_widget_get_window(GTK_WIDGET(window_)) == active_window; | 403 is_active_ = gtk_widget_get_window(GTK_WIDGET(window_)) == active_window; |
| 404 if (is_active_) | 404 if (is_active_) |
| 405 shell_window_->OnNativeWindowActivated(); | 405 app_window_->OnNativeWindowActivated(); |
| 406 } | 406 } |
| 407 | 407 |
| 408 // Callback for the delete event. This event is fired when the user tries to | 408 // Callback for the delete event. This event is fired when the user tries to |
| 409 // close the window (e.g., clicking on the X in the window manager title bar). | 409 // close the window (e.g., clicking on the X in the window manager title bar). |
| 410 gboolean NativeAppWindowGtk::OnMainWindowDeleteEvent(GtkWidget* widget, | 410 gboolean NativeAppWindowGtk::OnMainWindowDeleteEvent(GtkWidget* widget, |
| 411 GdkEvent* event) { | 411 GdkEvent* event) { |
| 412 Close(); | 412 Close(); |
| 413 | 413 |
| 414 // Return true to prevent the GTK window from being destroyed. Close will | 414 // Return true to prevent the GTK window from being destroyed. Close will |
| 415 // destroy it for us. | 415 // destroy it for us. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 438 window_configure_debounce_timer_.Stop(); | 438 window_configure_debounce_timer_.Stop(); |
| 439 window_configure_debounce_timer_.Start(FROM_HERE, | 439 window_configure_debounce_timer_.Start(FROM_HERE, |
| 440 base::TimeDelta::FromMilliseconds(kDebounceTimeoutMilliseconds), this, | 440 base::TimeDelta::FromMilliseconds(kDebounceTimeoutMilliseconds), this, |
| 441 &NativeAppWindowGtk::OnConfigureDebounced); | 441 &NativeAppWindowGtk::OnConfigureDebounced); |
| 442 | 442 |
| 443 return FALSE; | 443 return FALSE; |
| 444 } | 444 } |
| 445 | 445 |
| 446 void NativeAppWindowGtk::OnConfigureDebounced() { | 446 void NativeAppWindowGtk::OnConfigureDebounced() { |
| 447 gtk_window_util::UpdateWindowPosition(this, &bounds_, &restored_bounds_); | 447 gtk_window_util::UpdateWindowPosition(this, &bounds_, &restored_bounds_); |
| 448 shell_window_->OnNativeWindowChanged(); | 448 app_window_->OnNativeWindowChanged(); |
| 449 | 449 |
| 450 FOR_EACH_OBSERVER(web_modal::ModalDialogHostObserver, | 450 FOR_EACH_OBSERVER(web_modal::ModalDialogHostObserver, |
| 451 observer_list_, | 451 observer_list_, |
| 452 OnPositionRequiresUpdate()); | 452 OnPositionRequiresUpdate()); |
| 453 | 453 |
| 454 // Fullscreen of non-resizable windows requires them to be made resizable | 454 // Fullscreen of non-resizable windows requires them to be made resizable |
| 455 // first. After that takes effect and OnConfigure is called we transition | 455 // first. After that takes effect and OnConfigure is called we transition |
| 456 // to fullscreen. | 456 // to fullscreen. |
| 457 if (!IsFullscreen() && IsFullscreenOrPending()) { | 457 if (!IsFullscreen() && IsFullscreenOrPending()) { |
| 458 gtk_window_fullscreen(window_); | 458 gtk_window_fullscreen(window_); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 gdk_window_lower(gdk_window); | 586 gdk_window_lower(gdk_window); |
| 587 return TRUE; | 587 return TRUE; |
| 588 } | 588 } |
| 589 | 589 |
| 590 return FALSE; | 590 return FALSE; |
| 591 } | 591 } |
| 592 | 592 |
| 593 // NativeAppWindow implementation: | 593 // NativeAppWindow implementation: |
| 594 | 594 |
| 595 void NativeAppWindowGtk::SetFullscreen(int fullscreen_types) { | 595 void NativeAppWindowGtk::SetFullscreen(int fullscreen_types) { |
| 596 bool fullscreen = (fullscreen_types != ShellWindow::FULLSCREEN_TYPE_NONE); | 596 bool fullscreen = (fullscreen_types != AppWindow::FULLSCREEN_TYPE_NONE); |
| 597 content_thinks_its_fullscreen_ = fullscreen; | 597 content_thinks_its_fullscreen_ = fullscreen; |
| 598 if (fullscreen) { | 598 if (fullscreen) { |
| 599 if (resizable_) { | 599 if (resizable_) { |
| 600 gtk_window_fullscreen(window_); | 600 gtk_window_fullscreen(window_); |
| 601 } else { | 601 } else { |
| 602 // We must first make the window resizable. That won't take effect | 602 // We must first make the window resizable. That won't take effect |
| 603 // immediately, so OnConfigureDebounced completes the fullscreen call. | 603 // immediately, so OnConfigureDebounced completes the fullscreen call. |
| 604 gtk_window_set_resizable(window_, TRUE); | 604 gtk_window_set_resizable(window_, TRUE); |
| 605 } | 605 } |
| 606 } else { | 606 } else { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 618 // will fall back to |IsFullscreen| which will soon have the correct state. | 618 // will fall back to |IsFullscreen| which will soon have the correct state. |
| 619 return content_thinks_its_fullscreen_ || IsFullscreen(); | 619 return content_thinks_its_fullscreen_ || IsFullscreen(); |
| 620 } | 620 } |
| 621 | 621 |
| 622 bool NativeAppWindowGtk::IsDetached() const { | 622 bool NativeAppWindowGtk::IsDetached() const { |
| 623 return false; | 623 return false; |
| 624 } | 624 } |
| 625 | 625 |
| 626 void NativeAppWindowGtk::UpdateWindowIcon() { | 626 void NativeAppWindowGtk::UpdateWindowIcon() { |
| 627 Profile* profile = | 627 Profile* profile = |
| 628 Profile::FromBrowserContext(shell_window_->browser_context()); | 628 Profile::FromBrowserContext(app_window_->browser_context()); |
| 629 gfx::Image app_icon = shell_window_->app_icon(); | 629 gfx::Image app_icon = app_window_->app_icon(); |
| 630 if (!app_icon.IsEmpty()) | 630 if (!app_icon.IsEmpty()) |
| 631 gtk_util::SetWindowIcon(window_, profile, app_icon.ToGdkPixbuf()); | 631 gtk_util::SetWindowIcon(window_, profile, app_icon.ToGdkPixbuf()); |
| 632 else | 632 else |
| 633 gtk_util::SetWindowIcon(window_, profile); | 633 gtk_util::SetWindowIcon(window_, profile); |
| 634 } | 634 } |
| 635 | 635 |
| 636 void NativeAppWindowGtk::UpdateWindowTitle() { | 636 void NativeAppWindowGtk::UpdateWindowTitle() { |
| 637 base::string16 title = shell_window_->GetTitle(); | 637 base::string16 title = app_window_->GetTitle(); |
| 638 gtk_window_set_title(window_, base::UTF16ToUTF8(title).c_str()); | 638 gtk_window_set_title(window_, base::UTF16ToUTF8(title).c_str()); |
| 639 } | 639 } |
| 640 | 640 |
| 641 void NativeAppWindowGtk::UpdateBadgeIcon() { | 641 void NativeAppWindowGtk::UpdateBadgeIcon() { |
| 642 NOTIMPLEMENTED(); | 642 NOTIMPLEMENTED(); |
| 643 } | 643 } |
| 644 | 644 |
| 645 void NativeAppWindowGtk::UpdateDraggableRegions( | 645 void NativeAppWindowGtk::UpdateDraggableRegions( |
| 646 const std::vector<extensions::DraggableRegion>& regions) { | 646 const std::vector<extensions::DraggableRegion>& regions) { |
| 647 // Draggable region is not supported for non-frameless window. | 647 // Draggable region is not supported for non-frameless window. |
| 648 if (!frameless_) | 648 if (!frameless_) |
| 649 return; | 649 return; |
| 650 | 650 |
| 651 draggable_region_.reset(ShellWindow::RawDraggableRegionsToSkRegion(regions)); | 651 draggable_region_.reset(AppWindow::RawDraggableRegionsToSkRegion(regions)); |
| 652 } | 652 } |
| 653 | 653 |
| 654 SkRegion* NativeAppWindowGtk::GetDraggableRegion() { | 654 SkRegion* NativeAppWindowGtk::GetDraggableRegion() { |
| 655 return draggable_region_.get(); | 655 return draggable_region_.get(); |
| 656 } | 656 } |
| 657 | 657 |
| 658 void NativeAppWindowGtk::UpdateShape(scoped_ptr<SkRegion> region) { | 658 void NativeAppWindowGtk::UpdateShape(scoped_ptr<SkRegion> region) { |
| 659 NOTIMPLEMENTED(); | 659 NOTIMPLEMENTED(); |
| 660 } | 660 } |
| 661 | 661 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 rect_with_decorations.height - current_height - top_inset, | 693 rect_with_decorations.height - current_height - top_inset, |
| 694 rect_with_decorations.width - current_width - left_inset); | 694 rect_with_decorations.width - current_width - left_inset); |
| 695 } | 695 } |
| 696 | 696 |
| 697 void NativeAppWindowGtk::HideWithApp() {} | 697 void NativeAppWindowGtk::HideWithApp() {} |
| 698 void NativeAppWindowGtk::ShowWithApp() {} | 698 void NativeAppWindowGtk::ShowWithApp() {} |
| 699 | 699 |
| 700 void NativeAppWindowGtk::UpdateWindowMinMaxSize() { | 700 void NativeAppWindowGtk::UpdateWindowMinMaxSize() { |
| 701 GdkGeometry hints; | 701 GdkGeometry hints; |
| 702 int hints_mask = 0; | 702 int hints_mask = 0; |
| 703 if (shell_window_->size_constraints().HasMinimumSize()) { | 703 if (app_window_->size_constraints().HasMinimumSize()) { |
| 704 gfx::Size min_size = shell_window_->size_constraints().GetMinimumSize(); | 704 gfx::Size min_size = app_window_->size_constraints().GetMinimumSize(); |
| 705 hints.min_height = min_size.height(); | 705 hints.min_height = min_size.height(); |
| 706 hints.min_width = min_size.width(); | 706 hints.min_width = min_size.width(); |
| 707 hints_mask |= GDK_HINT_MIN_SIZE; | 707 hints_mask |= GDK_HINT_MIN_SIZE; |
| 708 } | 708 } |
| 709 if (shell_window_->size_constraints().HasMaximumSize()) { | 709 if (app_window_->size_constraints().HasMaximumSize()) { |
| 710 gfx::Size max_size = shell_window_->size_constraints().GetMaximumSize(); | 710 gfx::Size max_size = app_window_->size_constraints().GetMaximumSize(); |
| 711 const int kUnboundedSize = ShellWindow::SizeConstraints::kUnboundedSize; | 711 const int kUnboundedSize = AppWindow::SizeConstraints::kUnboundedSize; |
| 712 hints.max_height = max_size.height() == kUnboundedSize ? | 712 hints.max_height = max_size.height() == kUnboundedSize ? |
| 713 G_MAXINT : max_size.height(); | 713 G_MAXINT : max_size.height(); |
| 714 hints.max_width = max_size.width() == kUnboundedSize ? | 714 hints.max_width = max_size.width() == kUnboundedSize ? |
| 715 G_MAXINT : max_size.width(); | 715 G_MAXINT : max_size.width(); |
| 716 hints_mask |= GDK_HINT_MAX_SIZE; | 716 hints_mask |= GDK_HINT_MAX_SIZE; |
| 717 } | 717 } |
| 718 if (hints_mask) { | 718 if (hints_mask) { |
| 719 gtk_window_set_geometry_hints( | 719 gtk_window_set_geometry_hints( |
| 720 window_, | 720 window_, |
| 721 GTK_WIDGET(window_), | 721 GTK_WIDGET(window_), |
| 722 &hints, | 722 &hints, |
| 723 static_cast<GdkWindowHints>(hints_mask)); | 723 static_cast<GdkWindowHints>(hints_mask)); |
| 724 } | 724 } |
| 725 } | 725 } |
| OLD | NEW |