WindowFrame.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. *
  8. * 1. Redistributions of source code must retain the above copyright notice, this
  9. * list of conditions and the following disclaimer.
  10. *
  11. * 2. Redistributions in binary form must reproduce the above copyright notice,
  12. * this list of conditions and the following disclaimer in the documentation
  13. * and/or other materials provided with the distribution.
  14. *
  15. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  16. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  17. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  18. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  19. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  20. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  21. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  22. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  23. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  24. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. */
  26. #include "ClientConnection.h"
  27. #include <AK/Badge.h>
  28. #include <LibGfx/Font.h>
  29. #include <LibGfx/Painter.h>
  30. #include <LibGfx/StylePainter.h>
  31. #include <LibGfx/WindowTheme.h>
  32. #include <WindowServer/Button.h>
  33. #include <WindowServer/Compositor.h>
  34. #include <WindowServer/Event.h>
  35. #include <WindowServer/Screen.h>
  36. #include <WindowServer/Window.h>
  37. #include <WindowServer/WindowFrame.h>
  38. #include <WindowServer/WindowManager.h>
  39. namespace WindowServer {
  40. static Gfx::WindowTheme::WindowType to_theme_window_type(WindowType type)
  41. {
  42. switch (type) {
  43. case WindowType::Normal:
  44. return Gfx::WindowTheme::WindowType::Normal;
  45. case WindowType::Notification:
  46. return Gfx::WindowTheme::WindowType::Notification;
  47. default:
  48. return Gfx::WindowTheme::WindowType::Other;
  49. }
  50. }
  51. static Gfx::Bitmap* s_minimize_icon;
  52. static Gfx::Bitmap* s_maximize_icon;
  53. static Gfx::Bitmap* s_restore_icon;
  54. static Gfx::Bitmap* s_close_icon;
  55. static String s_last_title_button_icons_path;
  56. static int s_last_title_button_icons_scale;
  57. WindowFrame::WindowFrame(Window& window)
  58. : m_window(window)
  59. {
  60. auto button = make<Button>(*this, [this](auto&) {
  61. m_window.request_close();
  62. });
  63. m_close_button = button.ptr();
  64. m_buttons.append(move(button));
  65. if (window.is_resizable()) {
  66. auto button = make<Button>(*this, [this](auto&) {
  67. WindowManager::the().maximize_windows(m_window, !m_window.is_maximized());
  68. });
  69. m_maximize_button = button.ptr();
  70. m_buttons.append(move(button));
  71. }
  72. if (window.is_minimizable()) {
  73. auto button = make<Button>(*this, [this](auto&) {
  74. WindowManager::the().minimize_windows(m_window, true);
  75. });
  76. m_minimize_button = button.ptr();
  77. m_buttons.append(move(button));
  78. }
  79. set_button_icons();
  80. }
  81. WindowFrame::~WindowFrame()
  82. {
  83. }
  84. void WindowFrame::set_button_icons()
  85. {
  86. if (m_window.is_frameless())
  87. return;
  88. String icons_path = WindowManager::the().palette().title_button_icons_path();
  89. int icons_scale = WindowManager::the().compositor_icon_scale();
  90. StringBuilder full_path;
  91. if (!s_minimize_icon || s_last_title_button_icons_path != icons_path || s_last_title_button_icons_scale != icons_scale) {
  92. full_path.append(icons_path);
  93. full_path.append("window-minimize.png");
  94. if (!(s_minimize_icon = Gfx::Bitmap::load_from_file(full_path.to_string(), icons_scale).leak_ref()))
  95. s_minimize_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/downward-triangle.png", icons_scale).leak_ref();
  96. full_path.clear();
  97. }
  98. if (!s_maximize_icon || s_last_title_button_icons_path != icons_path || s_last_title_button_icons_scale != icons_scale) {
  99. full_path.append(icons_path);
  100. full_path.append("window-maximize.png");
  101. if (!(s_maximize_icon = Gfx::Bitmap::load_from_file(full_path.to_string(), icons_scale).leak_ref()))
  102. s_maximize_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/upward-triangle.png", icons_scale).leak_ref();
  103. full_path.clear();
  104. }
  105. if (!s_restore_icon || s_last_title_button_icons_path != icons_path || s_last_title_button_icons_scale != icons_scale) {
  106. full_path.append(icons_path);
  107. full_path.append("window-restore.png");
  108. if (!(s_restore_icon = Gfx::Bitmap::load_from_file(full_path.to_string(), icons_scale).leak_ref()))
  109. s_restore_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/window-restore.png", icons_scale).leak_ref();
  110. full_path.clear();
  111. }
  112. if (!s_close_icon || s_last_title_button_icons_path != icons_path || s_last_title_button_icons_scale != icons_scale) {
  113. full_path.append(icons_path);
  114. full_path.append("window-close.png");
  115. if (!(s_close_icon = Gfx::Bitmap::load_from_file(full_path.to_string(), icons_scale).leak_ref()))
  116. s_close_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/window-close.png", icons_scale).leak_ref();
  117. full_path.clear();
  118. }
  119. m_close_button->set_icon(*s_close_icon);
  120. if (m_window.is_minimizable())
  121. m_minimize_button->set_icon(*s_minimize_icon);
  122. if (m_window.is_resizable())
  123. m_maximize_button->set_icon(m_window.is_maximized() ? *s_restore_icon : *s_maximize_icon);
  124. s_last_title_button_icons_path = icons_path;
  125. s_last_title_button_icons_scale = icons_scale;
  126. }
  127. void WindowFrame::did_set_maximized(Badge<Window>, bool maximized)
  128. {
  129. ASSERT(m_maximize_button);
  130. m_maximize_button->set_icon(maximized ? *s_restore_icon : *s_maximize_icon);
  131. }
  132. Gfx::IntRect WindowFrame::title_bar_rect() const
  133. {
  134. return Gfx::WindowTheme::current().title_bar_rect(to_theme_window_type(m_window.type()), m_window.rect(), WindowManager::the().palette());
  135. }
  136. Gfx::IntRect WindowFrame::title_bar_icon_rect() const
  137. {
  138. return Gfx::WindowTheme::current().title_bar_icon_rect(to_theme_window_type(m_window.type()), m_window.rect(), WindowManager::the().palette());
  139. }
  140. Gfx::IntRect WindowFrame::title_bar_text_rect() const
  141. {
  142. return Gfx::WindowTheme::current().title_bar_text_rect(to_theme_window_type(m_window.type()), m_window.rect(), WindowManager::the().palette());
  143. }
  144. Gfx::WindowTheme::WindowState WindowFrame::window_state_for_theme() const
  145. {
  146. auto& wm = WindowManager::the();
  147. if (m_flash_timer && m_flash_timer->is_active())
  148. return m_flash_counter & 1 ? Gfx::WindowTheme::WindowState::Active : Gfx::WindowTheme::WindowState::Inactive;
  149. if (&m_window == wm.m_highlight_window)
  150. return Gfx::WindowTheme::WindowState::Highlighted;
  151. if (&m_window == wm.m_move_window)
  152. return Gfx::WindowTheme::WindowState::Moving;
  153. if (wm.is_active_window_or_accessory(m_window))
  154. return Gfx::WindowTheme::WindowState::Active;
  155. return Gfx::WindowTheme::WindowState::Inactive;
  156. }
  157. void WindowFrame::paint_notification_frame(Gfx::Painter& painter)
  158. {
  159. auto palette = WindowManager::the().palette();
  160. Gfx::WindowTheme::current().paint_notification_frame(painter, m_window.rect(), palette, m_buttons.last().relative_rect());
  161. }
  162. void WindowFrame::paint_normal_frame(Gfx::Painter& painter)
  163. {
  164. auto palette = WindowManager::the().palette();
  165. auto& window = m_window;
  166. String title_text;
  167. if (window.client() && window.client()->is_unresponsive()) {
  168. StringBuilder builder;
  169. builder.append(window.title());
  170. builder.append(" (Not responding)");
  171. title_text = builder.to_string();
  172. } else {
  173. title_text = window.title();
  174. }
  175. auto leftmost_button_rect = m_buttons.is_empty() ? Gfx::IntRect() : m_buttons.last().relative_rect();
  176. Gfx::WindowTheme::current().paint_normal_frame(painter, window_state_for_theme(), m_window.rect(), title_text, m_window.icon(), palette, leftmost_button_rect);
  177. }
  178. void WindowFrame::paint(Gfx::Painter& painter, const Gfx::IntRect& rect)
  179. {
  180. render_to_cache();
  181. auto frame_rect = this->rect();
  182. auto window_rect = m_window.rect();
  183. if (m_top_bottom) {
  184. auto top_bottom_height = frame_rect.height() - window_rect.height();
  185. if (m_bottom_y > 0) {
  186. // We have a top piece
  187. auto src_rect = rect.intersected({ frame_rect.location(), { frame_rect.width(), m_bottom_y } });
  188. if (!src_rect.is_empty())
  189. painter.blit(src_rect.location(), *m_top_bottom, src_rect.translated(-frame_rect.location()), m_opacity);
  190. }
  191. if (m_bottom_y < top_bottom_height) {
  192. // We have a bottom piece
  193. Gfx::IntRect rect_in_frame { frame_rect.x(), window_rect.bottom() + 1, frame_rect.width(), top_bottom_height - m_bottom_y };
  194. auto src_rect = rect.intersected(rect_in_frame);
  195. if (!src_rect.is_empty())
  196. painter.blit(src_rect.location(), *m_top_bottom, src_rect.translated(-rect_in_frame.x(), -rect_in_frame.y() + m_bottom_y), m_opacity);
  197. }
  198. }
  199. if (m_left_right) {
  200. auto left_right_width = frame_rect.width() - window_rect.width();
  201. if (m_right_x > 0) {
  202. // We have a left piece
  203. Gfx::IntRect rect_in_frame { frame_rect.x(), window_rect.y(), m_right_x, window_rect.height() };
  204. auto src_rect = rect.intersected(rect_in_frame);
  205. if (!src_rect.is_empty())
  206. painter.blit(src_rect.location(), *m_left_right, src_rect.translated(-rect_in_frame.location()), m_opacity);
  207. }
  208. if (m_right_x < left_right_width) {
  209. // We have a right piece
  210. Gfx::IntRect rect_in_frame { window_rect.right() + 1, window_rect.y(), left_right_width - m_right_x, window_rect.height() };
  211. auto src_rect = rect.intersected(rect_in_frame);
  212. if (!src_rect.is_empty())
  213. painter.blit(src_rect.location(), *m_left_right, src_rect.translated(-rect_in_frame.x() + m_right_x, -rect_in_frame.y()), m_opacity);
  214. }
  215. }
  216. }
  217. void WindowFrame::render(Gfx::Painter& painter)
  218. {
  219. if (m_window.is_frameless())
  220. return;
  221. if (m_window.type() == WindowType::Notification)
  222. paint_notification_frame(painter);
  223. else if (m_window.type() == WindowType::Normal)
  224. paint_normal_frame(painter);
  225. else
  226. return;
  227. for (auto& button : m_buttons) {
  228. button.paint(painter);
  229. }
  230. }
  231. void WindowFrame::render_to_cache()
  232. {
  233. if (!m_dirty)
  234. return;
  235. m_dirty = true;
  236. static RefPtr<Gfx::Bitmap> s_tmp_bitmap;
  237. auto frame_rect = rect();
  238. auto window_rect = m_window.rect();
  239. auto scale = Screen::the().scale_factor();
  240. if (!s_tmp_bitmap || !s_tmp_bitmap->size().contains(frame_rect.size()) || s_tmp_bitmap->scale() != scale)
  241. s_tmp_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, frame_rect.size(), scale);
  242. Gfx::Painter painter(*s_tmp_bitmap);
  243. painter.fill_rect({ { 0, 0 }, frame_rect.size() }, Color::White);
  244. render(painter);
  245. auto top_bottom_height = frame_rect.height() - window_rect.height();
  246. if (top_bottom_height > 0) {
  247. if (!m_top_bottom || m_top_bottom->width() != frame_rect.width() || m_top_bottom->height() != top_bottom_height || m_top_bottom->scale() != scale)
  248. m_top_bottom = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, { frame_rect.width(), top_bottom_height }, scale);
  249. m_bottom_y = window_rect.y() - frame_rect.y();
  250. ASSERT(m_bottom_y >= 0);
  251. Gfx::Painter top_bottom_painter(*m_top_bottom);
  252. if (m_bottom_y > 0)
  253. top_bottom_painter.blit({ 0, 0 }, *s_tmp_bitmap, { 0, 0, frame_rect.width(), m_bottom_y });
  254. if (m_bottom_y < top_bottom_height)
  255. top_bottom_painter.blit({ 0, m_bottom_y }, *s_tmp_bitmap, { 0, frame_rect.height() - (frame_rect.bottom() - window_rect.bottom()), frame_rect.width(), top_bottom_height - m_bottom_y });
  256. } else {
  257. m_top_bottom = nullptr;
  258. m_bottom_y = 0;
  259. }
  260. auto left_right_width = frame_rect.width() - window_rect.width();
  261. if (left_right_width > 0) {
  262. if (!m_left_right || m_left_right->height() != frame_rect.height() || m_left_right->width() != left_right_width || m_left_right->scale() != scale)
  263. m_left_right = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, { left_right_width, frame_rect.height() }, scale);
  264. m_right_x = window_rect.x() - frame_rect.x();
  265. ASSERT(m_right_x >= 0);
  266. Gfx::Painter left_right_painter(*m_left_right);
  267. if (m_right_x > 0)
  268. left_right_painter.blit({ 0, 0 }, *s_tmp_bitmap, { 0, m_bottom_y, m_right_x, window_rect.height() });
  269. if (m_right_x < left_right_width)
  270. left_right_painter.blit({ m_right_x, 0 }, *s_tmp_bitmap, { (window_rect.right() - frame_rect.x()) + 1, m_bottom_y, frame_rect.width() - (frame_rect.right() - window_rect.right()), window_rect.height() });
  271. } else {
  272. m_left_right = nullptr;
  273. m_right_x = 0;
  274. }
  275. }
  276. void WindowFrame::set_opacity(float opacity)
  277. {
  278. if (m_opacity == opacity)
  279. return;
  280. bool was_opaque = is_opaque();
  281. m_opacity = opacity;
  282. if (was_opaque != is_opaque())
  283. Compositor::the().invalidate_occlusions();
  284. Compositor::the().invalidate_screen(rect());
  285. WindowManager::the().notify_opacity_changed(m_window);
  286. }
  287. static Gfx::IntRect frame_rect_for_window(Window& window, const Gfx::IntRect& rect)
  288. {
  289. if (window.is_frameless())
  290. return rect;
  291. return Gfx::WindowTheme::current().frame_rect_for_window(to_theme_window_type(window.type()), rect, WindowManager::the().palette());
  292. }
  293. static Gfx::IntRect frame_rect_for_window(Window& window)
  294. {
  295. return frame_rect_for_window(window, window.rect());
  296. }
  297. Gfx::IntRect WindowFrame::rect() const
  298. {
  299. return frame_rect_for_window(m_window);
  300. }
  301. void WindowFrame::invalidate_title_bar()
  302. {
  303. m_dirty = true;
  304. invalidate(title_bar_rect());
  305. }
  306. void WindowFrame::invalidate(Gfx::IntRect relative_rect)
  307. {
  308. auto frame_rect = rect();
  309. auto window_rect = m_window.rect();
  310. relative_rect.move_by(frame_rect.x() - window_rect.x(), frame_rect.y() - window_rect.y());
  311. m_window.invalidate(relative_rect, true);
  312. }
  313. void WindowFrame::notify_window_rect_changed(const Gfx::IntRect& old_rect, const Gfx::IntRect& new_rect)
  314. {
  315. layout_buttons();
  316. auto old_frame_rect = frame_rect_for_window(m_window, old_rect);
  317. auto new_frame_rect = frame_rect_for_window(m_window, new_rect);
  318. if (old_frame_rect.width() != new_frame_rect.width())
  319. m_dirty = true;
  320. auto& compositor = Compositor::the();
  321. for (auto& dirty : old_frame_rect.shatter(rect()))
  322. compositor.invalidate_screen(dirty);
  323. if (!m_window.is_opaque())
  324. compositor.invalidate_screen(rect());
  325. compositor.invalidate_occlusions();
  326. WindowManager::the().notify_rect_changed(m_window, old_rect, new_rect);
  327. }
  328. void WindowFrame::layout_buttons()
  329. {
  330. auto button_rects = Gfx::WindowTheme::current().layout_buttons(to_theme_window_type(m_window.type()), m_window.rect(), WindowManager::the().palette(), m_buttons.size());
  331. for (size_t i = 0; i < m_buttons.size(); i++)
  332. m_buttons[i].set_relative_rect(button_rects[i]);
  333. }
  334. void WindowFrame::on_mouse_event(const MouseEvent& event)
  335. {
  336. ASSERT(!m_window.is_fullscreen());
  337. auto& wm = WindowManager::the();
  338. if (m_window.type() != WindowType::Normal && m_window.type() != WindowType::Notification)
  339. return;
  340. if (m_window.type() == WindowType::Normal) {
  341. if (event.type() == Event::MouseDown)
  342. wm.move_to_front_and_make_active(m_window);
  343. if (m_window.blocking_modal_window())
  344. return;
  345. if (title_bar_icon_rect().contains(event.position())) {
  346. if (event.type() == Event::MouseDown && (event.button() == MouseButton::Left || event.button() == MouseButton::Right)) {
  347. // Manually start a potential double click. Since we're opening
  348. // a menu, we will only receive the MouseDown event, so we
  349. // need to record that fact. If the user subsequently clicks
  350. // on the same area, the menu will get closed, and we will
  351. // receive a MouseUp event, but because windows have changed
  352. // we don't get a MouseDoubleClick event. We can however record
  353. // this click, and when we receive the MouseUp event check if
  354. // it would have been considered a double click, if it weren't
  355. // for the fact that we opened and closed a window in the meanwhile
  356. auto& wm = WindowManager::the();
  357. wm.start_menu_doubleclick(m_window, event);
  358. m_window.popup_window_menu(title_bar_rect().bottom_left().translated(rect().location()), WindowMenuDefaultAction::Close);
  359. return;
  360. } else if (event.type() == Event::MouseUp && event.button() == MouseButton::Left) {
  361. // Since the MouseDown event opened a menu, another MouseUp
  362. // from the second click outside the menu wouldn't be considered
  363. // a double click, so let's manually check if it would otherwise
  364. // have been be considered to be one
  365. auto& wm = WindowManager::the();
  366. if (wm.is_menu_doubleclick(m_window, event)) {
  367. // It is a double click, so perform activate the default item
  368. m_window.window_menu_activate_default();
  369. }
  370. return;
  371. }
  372. }
  373. }
  374. // This is slightly hackish, but expand the title bar rect by two pixels downwards,
  375. // so that mouse events between the title bar and window contents don't act like
  376. // mouse events on the border.
  377. auto adjusted_title_bar_rect = title_bar_rect();
  378. adjusted_title_bar_rect.set_height(adjusted_title_bar_rect.height() + 2);
  379. if (adjusted_title_bar_rect.contains(event.position())) {
  380. wm.clear_resize_candidate();
  381. if (event.type() == Event::MouseDown)
  382. wm.move_to_front_and_make_active(m_window);
  383. for (auto& button : m_buttons) {
  384. if (button.relative_rect().contains(event.position()))
  385. return button.on_mouse_event(event.translated(-button.relative_rect().location()));
  386. }
  387. if (event.type() == Event::MouseDown) {
  388. if (m_window.type() == WindowType::Normal && event.button() == MouseButton::Right) {
  389. auto default_action = m_window.is_maximized() ? WindowMenuDefaultAction::Restore : WindowMenuDefaultAction::Maximize;
  390. m_window.popup_window_menu(event.position().translated(rect().location()), default_action);
  391. return;
  392. }
  393. if (m_window.is_movable() && event.button() == MouseButton::Left)
  394. wm.start_window_move(m_window, event.translated(rect().location()));
  395. }
  396. return;
  397. }
  398. if (m_window.is_resizable() && event.type() == Event::MouseMove && event.buttons() == 0) {
  399. constexpr ResizeDirection direction_for_hot_area[3][3] = {
  400. { ResizeDirection::UpLeft, ResizeDirection::Up, ResizeDirection::UpRight },
  401. { ResizeDirection::Left, ResizeDirection::None, ResizeDirection::Right },
  402. { ResizeDirection::DownLeft, ResizeDirection::Down, ResizeDirection::DownRight },
  403. };
  404. Gfx::IntRect outer_rect = { {}, rect().size() };
  405. ASSERT(outer_rect.contains(event.position()));
  406. int window_relative_x = event.x() - outer_rect.x();
  407. int window_relative_y = event.y() - outer_rect.y();
  408. int hot_area_row = min(2, window_relative_y / (outer_rect.height() / 3));
  409. int hot_area_column = min(2, window_relative_x / (outer_rect.width() / 3));
  410. wm.set_resize_candidate(m_window, direction_for_hot_area[hot_area_row][hot_area_column]);
  411. Compositor::the().invalidate_cursor();
  412. return;
  413. }
  414. if (m_window.is_resizable() && event.type() == Event::MouseDown && event.button() == MouseButton::Left)
  415. wm.start_window_resize(m_window, event.translated(rect().location()));
  416. }
  417. void WindowFrame::start_flash_animation()
  418. {
  419. if (!m_flash_timer) {
  420. m_flash_timer = Core::Timer::construct(100, [this] {
  421. ASSERT(m_flash_counter);
  422. invalidate_title_bar();
  423. if (!--m_flash_counter)
  424. m_flash_timer->stop();
  425. });
  426. }
  427. m_flash_counter = 8;
  428. m_flash_timer->start();
  429. }
  430. }