mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:12:45 +00:00 
			
		
		
		
	WindowServer: Run clang-format on everything.
This commit is contained in:
		
							parent
							
								
									76b3337498
								
							
						
					
					
						commit
						8358833bc8
					
				
					 12 changed files with 134 additions and 114 deletions
				
			
		|  | @ -1,9 +1,9 @@ | |||
| #include <SharedGraphics/CharacterBitmap.h> | ||||
| #include <SharedGraphics/Painter.h> | ||||
| #include <SharedGraphics/StylePainter.h> | ||||
| #include <WindowServer/WSButton.h> | ||||
| #include <WindowServer/WSEvent.h> | ||||
| #include <WindowServer/WSWindowManager.h> | ||||
| #include <SharedGraphics/Painter.h> | ||||
| #include <SharedGraphics/StylePainter.h> | ||||
| #include <SharedGraphics/CharacterBitmap.h> | ||||
| 
 | ||||
| WSButton::WSButton(WSWindowFrame& frame, Retained<CharacterBitmap>&& bitmap, Function<void(WSButton&)>&& on_click_handler) | ||||
|     : on_click(move(on_click_handler)) | ||||
|  |  | |||
|  | @ -1,8 +1,8 @@ | |||
| #include <WindowServer/WSCPUMonitor.h> | ||||
| #include <WindowServer/WSEventLoop.h> | ||||
| #include <WindowServer/WSWindowManager.h> | ||||
| #include <unistd.h> | ||||
| #include <stdio.h> | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| WSCPUMonitor::WSCPUMonitor() | ||||
|     : m_proc_all("/proc/all") | ||||
|  | @ -10,7 +10,7 @@ WSCPUMonitor::WSCPUMonitor() | |||
|     if (!m_proc_all.open(CIODevice::OpenMode::ReadOnly)) | ||||
|         ASSERT_NOT_REACHED(); | ||||
| 
 | ||||
|     create_thread([] (void* context) -> int { | ||||
|     create_thread([](void* context) -> int { | ||||
|         auto& monitor = *(WSCPUMonitor*)context; | ||||
|         for (;;) { | ||||
|             static unsigned last_busy; | ||||
|  | @ -27,7 +27,8 @@ WSCPUMonitor::WSCPUMonitor() | |||
|             monitor.m_dirty = true; | ||||
|             sleep(1); | ||||
|         } | ||||
|     }, this); | ||||
|     }, | ||||
|         this); | ||||
| } | ||||
| 
 | ||||
| void WSCPUMonitor::get_cpu_usage(unsigned& busy, unsigned& idle) | ||||
|  | @ -65,8 +66,7 @@ void WSCPUMonitor::paint(Painter& painter, const Rect& rect) | |||
|         painter.draw_line( | ||||
|             { rect.x() + i, rect.bottom() }, | ||||
|             { rect.x() + i, (int)(rect.y() + (rect.height() - (cpu_usage * (float)rect.height()))) }, | ||||
|             Color::from_rgb(0xaa6d4b) | ||||
|         ); | ||||
|             Color::from_rgb(0xaa6d4b)); | ||||
|         ++i; | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -355,7 +355,7 @@ void WSClientConnection::handle_request(const WSAPISetWindowOpacityRequest& requ | |||
| 
 | ||||
| void WSClientConnection::handle_request(const WSAPISetWallpaperRequest& request) | ||||
| { | ||||
|     WSCompositor::the().set_wallpaper(request.wallpaper(), [&] (bool success) { | ||||
|     WSCompositor::the().set_wallpaper(request.wallpaper(), [&](bool success) { | ||||
|         WSAPI_ServerMessage response; | ||||
|         response.type = WSAPI_ServerMessage::Type::DidSetWallpaper; | ||||
|         response.value = success; | ||||
|  | @ -564,7 +564,7 @@ void WSClientConnection::handle_request(const WSAPIInvalidateRectRequest& reques | |||
|     } | ||||
|     auto& window = *(*it).value; | ||||
|     for (int i = 0; i < request.rects().size(); ++i) | ||||
|         window.request_update(request.rects()[i].intersected({ { }, window.size() })); | ||||
|         window.request_update(request.rects()[i].intersected({ {}, window.size() })); | ||||
| } | ||||
| 
 | ||||
| void WSClientConnection::handle_request(const WSAPIDidFinishPaintingNotification& request) | ||||
|  |  | |||
|  | @ -1,21 +1,21 @@ | |||
| #include <WindowServer/WSEventLoop.h> | ||||
| #include <WindowServer/WSEvent.h> | ||||
| #include <LibCore/CObject.h> | ||||
| #include <WindowServer/WSWindowManager.h> | ||||
| #include <WindowServer/WSScreen.h> | ||||
| #include <WindowServer/WSClientConnection.h> | ||||
| #include <WindowServer/WSAPITypes.h> | ||||
| #include <WindowServer/WSCursor.h> | ||||
| #include <Kernel/KeyCode.h> | ||||
| #include <Kernel/MousePacket.h> | ||||
| #include <sys/socket.h> | ||||
| #include <LibCore/CObject.h> | ||||
| #include <WindowServer/WSAPITypes.h> | ||||
| #include <WindowServer/WSClientConnection.h> | ||||
| #include <WindowServer/WSCursor.h> | ||||
| #include <WindowServer/WSEvent.h> | ||||
| #include <WindowServer/WSEventLoop.h> | ||||
| #include <WindowServer/WSScreen.h> | ||||
| #include <WindowServer/WSWindowManager.h> | ||||
| #include <errno.h> | ||||
| #include <fcntl.h> | ||||
| #include <stdio.h> | ||||
| #include <sys/select.h> | ||||
| #include <sys/socket.h> | ||||
| #include <sys/time.h> | ||||
| #include <time.h> | ||||
| #include <unistd.h> | ||||
| #include <fcntl.h> | ||||
| #include <stdio.h> | ||||
| #include <errno.h> | ||||
| 
 | ||||
| //#define WSMESSAGELOOP_DEBUG
 | ||||
| 
 | ||||
|  | @ -104,7 +104,7 @@ static Vector<Rect, 32> get_rects(const WSAPI_ClientMessage& message, const Byte | |||
| { | ||||
|     Vector<Rect, 32> rects; | ||||
|     if (message.rect_count > (WSAPI_ClientMessage::max_inline_rect_count + extra_data.size() / sizeof(WSAPI_Rect))) { | ||||
|         return { }; | ||||
|         return {}; | ||||
|     } | ||||
|     for (int i = 0; i < min(WSAPI_ClientMessage::max_inline_rect_count, message.rect_count); ++i) | ||||
|         rects.append(message.rects[i]); | ||||
|  | @ -320,7 +320,7 @@ bool WSEventLoop::on_receive_from_client(int client_id, const WSAPI_ClientMessag | |||
| 
 | ||||
| void WSEventLoop::add_file_descriptors_for_select(fd_set& fds, int& max_fd_added) | ||||
| { | ||||
|     auto add_fd_to_set = [&max_fd_added] (int fd, auto& set) { | ||||
|     auto add_fd_to_set = [&max_fd_added](int fd, auto& set) { | ||||
|         FD_SET(fd, &set); | ||||
|         if (fd > max_fd_added) | ||||
|             max_fd_added = fd; | ||||
|  | @ -328,7 +328,7 @@ void WSEventLoop::add_file_descriptors_for_select(fd_set& fds, int& max_fd_added | |||
|     add_fd_to_set(m_keyboard_fd, fds); | ||||
|     add_fd_to_set(m_mouse_fd, fds); | ||||
|     add_fd_to_set(m_server_fd, fds); | ||||
|     WSClientConnection::for_each_client([&] (WSClientConnection& client) { | ||||
|     WSClientConnection::for_each_client([&](WSClientConnection& client) { | ||||
|         add_fd_to_set(client.fd(), fds); | ||||
|     }); | ||||
| } | ||||
|  | @ -341,7 +341,7 @@ void WSEventLoop::process_file_descriptors_after_select(const fd_set& fds) | |||
|         drain_keyboard(); | ||||
|     if (FD_ISSET(m_mouse_fd, &fds)) | ||||
|         drain_mouse(); | ||||
|     WSClientConnection::for_each_client([&] (WSClientConnection& client) { | ||||
|     WSClientConnection::for_each_client([&](WSClientConnection& client) { | ||||
|         if (FD_ISSET(client.fd(), &fds)) | ||||
|             drain_client(client); | ||||
|     }); | ||||
|  |  | |||
|  | @ -1,16 +1,16 @@ | |||
| #include "WSMenu.h" | ||||
| #include "WSMenuItem.h" | ||||
| #include "WSWindow.h" | ||||
| #include "WSEvent.h" | ||||
| #include "WSEventLoop.h" | ||||
| #include "WSWindowManager.h" | ||||
| #include "WSMenuItem.h" | ||||
| #include "WSScreen.h" | ||||
| #include <WindowServer/WSAPITypes.h> | ||||
| #include <WindowServer/WSClientConnection.h> | ||||
| #include "WSWindow.h" | ||||
| #include "WSWindowManager.h" | ||||
| #include <SharedGraphics/CharacterBitmap.h> | ||||
| #include <SharedGraphics/Font.h> | ||||
| #include <SharedGraphics/Painter.h> | ||||
| #include <SharedGraphics/StylePainter.h> | ||||
| #include <SharedGraphics/Font.h> | ||||
| #include <WindowServer/WSAPITypes.h> | ||||
| #include <WindowServer/WSClientConnection.h> | ||||
| 
 | ||||
| WSMenu::WSMenu(WSClientConnection* client, int menu_id, const String& name) | ||||
|     : m_client(client) | ||||
|  | @ -115,7 +115,7 @@ void WSMenu::draw() | |||
|     ASSERT(menu_window()->backing_store()); | ||||
|     Painter painter(*menu_window()->backing_store()); | ||||
| 
 | ||||
|     Rect rect { { }, menu_window()->size() }; | ||||
|     Rect rect { {}, menu_window()->size() }; | ||||
|     painter.fill_rect(rect.shrunken(6, 6), Color::LightGray); | ||||
|     StylePainter::paint_window_frame(painter, rect); | ||||
|     int width = this->width(); | ||||
|  |  | |||
|  | @ -11,4 +11,3 @@ WSMenuBar::WSMenuBar(WSClientConnection& client, int menubar_id) | |||
| WSMenuBar::~WSMenuBar() | ||||
| { | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| #include "WSScreen.h" | ||||
| #include "WSCompositor.h" | ||||
| #include "WSEvent.h" | ||||
| #include "WSEventLoop.h" | ||||
| #include "WSScreen.h" | ||||
| #include "WSWindowManager.h" | ||||
| #include <fcntl.h> | ||||
| #include <sys/ioctl.h> | ||||
|  | @ -39,7 +39,7 @@ void WSScreen::set_resolution(int width, int height) | |||
|         int width; | ||||
|         int height; | ||||
|     }; | ||||
|     BXVGAResolution resolution { (int)width, (int)height}; | ||||
|     BXVGAResolution resolution { (int)width, (int)height }; | ||||
|     int rc = ioctl(m_framebuffer_fd, 1985, (int)&resolution); | ||||
|     ASSERT(rc == 0); | ||||
| 
 | ||||
|  | @ -67,7 +67,7 @@ void WSScreen::on_receive_mouse_data(int dx, int dy, int dz, unsigned buttons) | |||
|     unsigned prev_buttons = m_mouse_button_state; | ||||
|     m_mouse_button_state = buttons; | ||||
|     unsigned changed_buttons = prev_buttons ^ buttons; | ||||
|     auto post_mousedown_or_mouseup_if_needed = [&] (MouseButton button) { | ||||
|     auto post_mousedown_or_mouseup_if_needed = [&](MouseButton button) { | ||||
|         if (!(changed_buttons & (unsigned)button)) | ||||
|             return; | ||||
|         auto message = make<WSMouseEvent>(buttons & (unsigned)button ? WSEvent::MouseDown : WSEvent::MouseUp, m_cursor_location, buttons, button, m_modifiers); | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| #include "WSWindow.h" | ||||
| #include "WSWindowManager.h" | ||||
| #include "WSEvent.h" | ||||
| #include "WSEventLoop.h" | ||||
| #include "WSWindowManager.h" | ||||
| #include <WindowServer/WSAPITypes.h> | ||||
| #include <WindowServer/WSClientConnection.h> | ||||
| 
 | ||||
|  | @ -77,10 +77,14 @@ void WSWindow::set_rect(const Rect& rect) | |||
| static WSAPI_MouseButton to_api(MouseButton button) | ||||
| { | ||||
|     switch (button) { | ||||
|     case MouseButton::None: return WSAPI_MouseButton::NoButton; | ||||
|     case MouseButton::Left: return WSAPI_MouseButton::Left; | ||||
|     case MouseButton::Right: return WSAPI_MouseButton::Right; | ||||
|     case MouseButton::Middle: return WSAPI_MouseButton::Middle; | ||||
|     case MouseButton::None: | ||||
|         return WSAPI_MouseButton::NoButton; | ||||
|     case MouseButton::Left: | ||||
|         return WSAPI_MouseButton::Left; | ||||
|     case MouseButton::Right: | ||||
|         return WSAPI_MouseButton::Right; | ||||
|     case MouseButton::Middle: | ||||
|         return WSAPI_MouseButton::Middle; | ||||
|     } | ||||
|     ASSERT_NOT_REACHED(); | ||||
| } | ||||
|  | @ -93,12 +97,23 @@ void WSWindow::handle_mouse_event(const WSMouseEvent& event) | |||
|     server_message.window_id = window_id(); | ||||
| 
 | ||||
|     switch (event.type()) { | ||||
|     case WSEvent::MouseMove: server_message.type = WSAPI_ServerMessage::Type::MouseMove; break; | ||||
|     case WSEvent::MouseDown: server_message.type = WSAPI_ServerMessage::Type::MouseDown; break; | ||||
|     case WSEvent::MouseDoubleClick: server_message.type = WSAPI_ServerMessage::Type::MouseDoubleClick; break; | ||||
|     case WSEvent::MouseUp: server_message.type = WSAPI_ServerMessage::Type::MouseUp; break; | ||||
|     case WSEvent::MouseWheel: server_message.type = WSAPI_ServerMessage::Type::MouseWheel; break; | ||||
|     default: ASSERT_NOT_REACHED(); | ||||
|     case WSEvent::MouseMove: | ||||
|         server_message.type = WSAPI_ServerMessage::Type::MouseMove; | ||||
|         break; | ||||
|     case WSEvent::MouseDown: | ||||
|         server_message.type = WSAPI_ServerMessage::Type::MouseDown; | ||||
|         break; | ||||
|     case WSEvent::MouseDoubleClick: | ||||
|         server_message.type = WSAPI_ServerMessage::Type::MouseDoubleClick; | ||||
|         break; | ||||
|     case WSEvent::MouseUp: | ||||
|         server_message.type = WSAPI_ServerMessage::Type::MouseUp; | ||||
|         break; | ||||
|     case WSEvent::MouseWheel: | ||||
|         server_message.type = WSAPI_ServerMessage::Type::MouseWheel; | ||||
|         break; | ||||
|     default: | ||||
|         ASSERT_NOT_REACHED(); | ||||
|     } | ||||
| 
 | ||||
|     server_message.mouse.position = event.position(); | ||||
|  | @ -134,7 +149,7 @@ void WSWindow::set_minimized(bool minimized) | |||
|         return; | ||||
|     m_minimized = minimized; | ||||
|     if (!minimized) | ||||
|         request_update({ { }, size() }); | ||||
|         request_update({ {}, size() }); | ||||
|     invalidate(); | ||||
|     WSWindowManager::the().notify_minimization_state_changed(*this); | ||||
| } | ||||
|  | @ -291,7 +306,7 @@ void WSWindow::set_default_icon() | |||
| void WSWindow::request_update(const Rect& rect) | ||||
| { | ||||
|     if (m_pending_paint_rects.is_empty()) { | ||||
|         deferred_invoke([this] (auto&) { | ||||
|         deferred_invoke([this](auto&) { | ||||
|             client()->post_paint_message(*this); | ||||
|         }); | ||||
|     } | ||||
|  |  | |||
|  | @ -90,20 +90,20 @@ WSWindowFrame::WSWindowFrame(WSWindow& window) | |||
|     if (!s_unmaximize_button_bitmap) | ||||
|         s_unmaximize_button_bitmap = &CharacterBitmap::create_from_ascii(s_unmaximize_button_bitmap_data, s_unmaximize_button_bitmap_width, s_unmaximize_button_bitmap_height).leak_ref(); | ||||
| 
 | ||||
|     m_buttons.append(make<WSButton>(*this, *s_close_button_bitmap, [this] (auto&) { | ||||
|     m_buttons.append(make<WSButton>(*this, *s_close_button_bitmap, [this](auto&) { | ||||
|         WSEvent close_request(WSEvent::WindowCloseRequest); | ||||
|         m_window.event(close_request); | ||||
|     })); | ||||
| 
 | ||||
|     if (window.is_resizable()) { | ||||
|         auto button = make<WSButton>(*this, *s_maximize_button_bitmap, [this] (auto&) { | ||||
|         auto button = make<WSButton>(*this, *s_maximize_button_bitmap, [this](auto&) { | ||||
|             m_window.set_maximized(!m_window.is_maximized()); | ||||
|         }); | ||||
|         m_maximize_button = button.ptr(); | ||||
|         m_buttons.append(move(button)); | ||||
|     } | ||||
| 
 | ||||
|     m_buttons.append(make<WSButton>(*this, *s_minimize_button_bitmap, [this] (auto&) { | ||||
|     m_buttons.append(make<WSButton>(*this, *s_minimize_button_bitmap, [this](auto&) { | ||||
|         m_window.set_minimized(true); | ||||
|     })); | ||||
| } | ||||
|  | @ -159,7 +159,7 @@ void WSWindowFrame::paint(Painter& painter) | |||
|     auto titlebar_rect = title_bar_rect(); | ||||
|     auto titlebar_icon_rect = title_bar_icon_rect(); | ||||
|     auto titlebar_inner_rect = title_bar_text_rect(); | ||||
|     Rect outer_rect = { { }, rect().size() }; | ||||
|     Rect outer_rect = { {}, rect().size() }; | ||||
| 
 | ||||
|     auto titlebar_title_rect = titlebar_inner_rect; | ||||
|     titlebar_title_rect.set_width(Font::default_bold_font().width(window.title())); | ||||
|  | @ -248,7 +248,8 @@ void WSWindowFrame::notify_window_rect_changed(const Rect& old_rect, const Rect& | |||
| { | ||||
|     int window_button_width = 15; | ||||
|     int window_button_height = 15; | ||||
|     int x = title_bar_text_rect().right() + 1;; | ||||
|     int x = title_bar_text_rect().right() + 1; | ||||
|     ; | ||||
|     for (auto& button : m_buttons) { | ||||
|         x -= window_button_width; | ||||
|         Rect rect { x, 0, window_button_width, window_button_height }; | ||||
|  | @ -297,7 +298,7 @@ void WSWindowFrame::on_mouse_event(const WSMouseEvent& event) | |||
|             { ResizeDirection::Left, ResizeDirection::None, ResizeDirection::Right }, | ||||
|             { ResizeDirection::DownLeft, ResizeDirection::Down, ResizeDirection::DownRight }, | ||||
|         }; | ||||
|         Rect outer_rect = { { }, rect().size() }; | ||||
|         Rect outer_rect = { {}, rect().size() }; | ||||
|         ASSERT(outer_rect.contains(event.position())); | ||||
|         int window_relative_x = event.x() - outer_rect.x(); | ||||
|         int window_relative_y = event.y() - outer_rect.y(); | ||||
|  |  | |||
|  | @ -1,3 +1,4 @@ | |||
| #include "WSWindowManager.h" | ||||
| #include "WSCompositor.h" | ||||
| #include "WSEventLoop.h" | ||||
| #include "WSMenu.h" | ||||
|  | @ -5,7 +6,6 @@ | |||
| #include "WSMenuItem.h" | ||||
| #include "WSScreen.h" | ||||
| #include "WSWindow.h" | ||||
| #include "WSWindowManager.h" | ||||
| #include <AK/StdLibExtras.h> | ||||
| #include <AK/Vector.h> | ||||
| #include <LibCore/CTimer.h> | ||||
|  | @ -43,8 +43,8 @@ WSWindowManager::WSWindowManager() | |||
|     reload_config(false); | ||||
| 
 | ||||
|     struct AppMenuItem { | ||||
|         const char *binary_name; | ||||
|         const char *description; | ||||
|         const char* binary_name; | ||||
|         const char* description; | ||||
|     }; | ||||
| 
 | ||||
|     Vector<AppMenuItem> apps; | ||||
|  | @ -65,10 +65,10 @@ WSWindowManager::WSWindowManager() | |||
|         m_system_menu->add_item(make<WSMenuItem>(*m_system_menu, 100, "Reload WM Config File")); | ||||
|         m_system_menu->add_item(make<WSMenuItem>(*m_system_menu, WSMenuItem::Separator)); | ||||
|         m_system_menu->add_item(make<WSMenuItem>(*m_system_menu, 200, "About...")); | ||||
|         m_system_menu->on_item_activation = [this, apps] (WSMenuItem& item) { | ||||
|         m_system_menu->on_item_activation = [this, apps](WSMenuItem& item) { | ||||
|             if (item.identifier() >= 1 && item.identifier() <= 1 + apps.size() - 1) { | ||||
|                 if (fork() == 0) { | ||||
|                     const auto& bin = apps[item.identifier() -1].binary_name; | ||||
|                     const auto& bin = apps[item.identifier() - 1].binary_name; | ||||
|                     execl(bin, bin, nullptr); | ||||
|                     ASSERT_NOT_REACHED(); | ||||
|                 } | ||||
|  | @ -199,7 +199,7 @@ void WSWindowManager::tick_clock() | |||
| void WSWindowManager::set_resolution(int width, int height) | ||||
| { | ||||
|     WSCompositor::the().set_resolution(width, height); | ||||
|     WSClientConnection::for_each_client([&] (WSClientConnection& client) { | ||||
|     WSClientConnection::for_each_client([&](WSClientConnection& client) { | ||||
|         client.notify_about_new_screen_rect(WSScreen::the().rect()); | ||||
|     }); | ||||
|     if (m_wm_config) { | ||||
|  | @ -211,7 +211,6 @@ void WSWindowManager::set_resolution(int width, int height) | |||
|     } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| int WSWindowManager::menubar_menu_margin() const | ||||
| { | ||||
|     return 16; | ||||
|  | @ -238,7 +237,7 @@ void WSWindowManager::set_current_menubar(WSMenuBar* menubar) | |||
| #endif | ||||
|     Point next_menu_location { menubar_menu_margin() / 2, 0 }; | ||||
|     int index = 0; | ||||
|     for_each_active_menubar_menu([&] (WSMenu& menu) { | ||||
|     for_each_active_menubar_menu([&](WSMenu& menu) { | ||||
|         int text_width = index == 1 ? Font::default_bold_font().width(menu.name()) : font().width(menu.name()); | ||||
|         menu.set_rect_in_menubar({ next_menu_location.x() - menubar_menu_margin() / 2, 0, text_width + menubar_menu_margin(), menubar_rect().height() - 1 }); | ||||
|         menu.set_text_rect_in_menubar({ next_menu_location, { text_width, menubar_rect().height() } }); | ||||
|  | @ -263,7 +262,7 @@ void WSWindowManager::add_window(WSWindow& window) | |||
|         m_switcher.refresh(); | ||||
| 
 | ||||
|     if (window.listens_to_wm_events()) { | ||||
|         for_each_window([&] (WSWindow& other_window) { | ||||
|         for_each_window([&](WSWindow& other_window) { | ||||
|             if (&window != &other_window) { | ||||
|                 tell_wm_listener_about_window(window, other_window); | ||||
|                 tell_wm_listener_about_window_icon(window, other_window); | ||||
|  | @ -297,7 +296,7 @@ void WSWindowManager::remove_window(WSWindow& window) | |||
|     if (m_switcher.is_visible() && window.type() != WSWindowType::WindowSwitcher) | ||||
|         m_switcher.refresh(); | ||||
| 
 | ||||
|     for_each_window_listening_to_wm_events([&window] (WSWindow& listener) { | ||||
|     for_each_window_listening_to_wm_events([&window](WSWindow& listener) { | ||||
|         if (!(listener.wm_event_mask() & WSAPI_WMEventMask::WindowRemovals)) | ||||
|             return IterationDecision::Continue; | ||||
|         if (window.client()) | ||||
|  | @ -332,7 +331,7 @@ void WSWindowManager::tell_wm_listener_about_window_icon(WSWindow& listener, WSW | |||
| 
 | ||||
| void WSWindowManager::tell_wm_listeners_window_state_changed(WSWindow& window) | ||||
| { | ||||
|     for_each_window_listening_to_wm_events([&] (WSWindow& listener) { | ||||
|     for_each_window_listening_to_wm_events([&](WSWindow& listener) { | ||||
|         tell_wm_listener_about_window(listener, window); | ||||
|         return IterationDecision::Continue; | ||||
|     }); | ||||
|  | @ -340,7 +339,7 @@ void WSWindowManager::tell_wm_listeners_window_state_changed(WSWindow& window) | |||
| 
 | ||||
| void WSWindowManager::tell_wm_listeners_window_icon_changed(WSWindow& window) | ||||
| { | ||||
|     for_each_window_listening_to_wm_events([&] (WSWindow& listener) { | ||||
|     for_each_window_listening_to_wm_events([&](WSWindow& listener) { | ||||
|         tell_wm_listener_about_window_icon(listener, window); | ||||
|         return IterationDecision::Continue; | ||||
|     }); | ||||
|  | @ -348,7 +347,7 @@ void WSWindowManager::tell_wm_listeners_window_icon_changed(WSWindow& window) | |||
| 
 | ||||
| void WSWindowManager::tell_wm_listeners_window_rect_changed(WSWindow& window) | ||||
| { | ||||
|     for_each_window_listening_to_wm_events([&] (WSWindow& listener) { | ||||
|     for_each_window_listening_to_wm_events([&](WSWindow& listener) { | ||||
|         tell_wm_listener_about_window_rect(listener, window); | ||||
|         return IterationDecision::Continue; | ||||
|     }); | ||||
|  | @ -388,7 +387,7 @@ void WSWindowManager::notify_minimization_state_changed(WSWindow& window) | |||
| 
 | ||||
| void WSWindowManager::pick_new_active_window() | ||||
| { | ||||
|     for_each_visible_window_of_type_from_front_to_back(WSWindowType::Normal, [&] (WSWindow& candidate) { | ||||
|     for_each_visible_window_of_type_from_front_to_back(WSWindowType::Normal, [&](WSWindow& candidate) { | ||||
|         set_active_window(&candidate); | ||||
|         return IterationDecision::Abort; | ||||
|     }); | ||||
|  | @ -427,7 +426,7 @@ void WSWindowManager::close_current_menu() | |||
| 
 | ||||
| void WSWindowManager::handle_menubar_mouse_event(const WSMouseEvent& event) | ||||
| { | ||||
|     for_each_active_menubar_menu([&] (WSMenu& menu) { | ||||
|     for_each_active_menubar_menu([&](WSMenu& menu) { | ||||
|         if (menu.rect_in_menubar().contains(event.position())) { | ||||
|             handle_menu_mouse_event(menu, event); | ||||
|             return false; | ||||
|  | @ -442,7 +441,8 @@ void WSWindowManager::start_window_drag(WSWindow& window, const WSMouseEvent& ev | |||
|     printf("[WM] Begin dragging WSWindow{%p}\n", &window); | ||||
| #endif | ||||
|     move_to_front_and_make_active(window); | ||||
|     m_drag_window = window.make_weak_ptr();; | ||||
|     m_drag_window = window.make_weak_ptr(); | ||||
|     ; | ||||
|     m_drag_origin = event.position(); | ||||
|     m_drag_window_origin = window.position(); | ||||
|     invalidate(window); | ||||
|  | @ -472,7 +472,8 @@ void WSWindowManager::start_window_resize(WSWindow& window, const Point& positio | |||
|     printf("[WM] Begin resizing WSWindow{%p}\n", &window); | ||||
| #endif | ||||
|     m_resizing_mouse_button = button; | ||||
|     m_resize_window = window.make_weak_ptr();; | ||||
|     m_resize_window = window.make_weak_ptr(); | ||||
|     ; | ||||
|     m_resize_origin = position; | ||||
|     m_resize_window_original_rect = window.rect(); | ||||
| 
 | ||||
|  | @ -628,9 +629,12 @@ void WSWindowManager::set_cursor_tracking_button(WSButton* button) | |||
| CElapsedTimer& WSWindowManager::DoubleClickInfo::click_clock(MouseButton button) | ||||
| { | ||||
|     switch (button) { | ||||
|     case MouseButton::Left: return m_left_click_clock; | ||||
|     case MouseButton::Right: return m_right_click_clock; | ||||
|     case MouseButton::Middle: return m_middle_click_clock; | ||||
|     case MouseButton::Left: | ||||
|         return m_left_click_clock; | ||||
|     case MouseButton::Right: | ||||
|         return m_right_click_clock; | ||||
|     case MouseButton::Middle: | ||||
|         return m_middle_click_clock; | ||||
|     default: | ||||
|         ASSERT_NOT_REACHED(); | ||||
|     } | ||||
|  | @ -742,7 +746,7 @@ void WSWindowManager::process_mouse_event(WSMouseEvent& event, WSWindow*& hovere | |||
| 
 | ||||
|     WSWindow* event_window_with_frame = nullptr; | ||||
| 
 | ||||
|     for_each_visible_window_from_front_to_back([&] (WSWindow& window) { | ||||
|     for_each_visible_window_from_front_to_back([&](WSWindow& window) { | ||||
|         auto window_frame_rect = window.frame().rect(); | ||||
|         if (!window_frame_rect.contains(event.position())) | ||||
|             return IterationDecision::Continue; | ||||
|  | @ -797,7 +801,7 @@ void WSWindowManager::clear_resize_candidate() | |||
| bool WSWindowManager::any_opaque_window_contains_rect(const Rect& rect) | ||||
| { | ||||
|     bool found_containing_window = false; | ||||
|     for_each_window([&] (WSWindow& window) { | ||||
|     for_each_window([&](WSWindow& window) { | ||||
|         if (!window.is_visible()) | ||||
|             return IterationDecision::Continue; | ||||
|         if (window.is_minimized()) | ||||
|  | @ -822,7 +826,7 @@ bool WSWindowManager::any_opaque_window_above_this_one_contains_rect(const WSWin | |||
| { | ||||
|     bool found_containing_window = false; | ||||
|     bool checking = false; | ||||
|     for_each_visible_window_from_back_to_front([&] (WSWindow& window) { | ||||
|     for_each_visible_window_from_back_to_front([&](WSWindow& window) { | ||||
|         if (&window == &a_window) { | ||||
|             checking = true; | ||||
|             return IterationDecision::Continue; | ||||
|  | @ -849,7 +853,7 @@ bool WSWindowManager::any_opaque_window_above_this_one_contains_rect(const WSWin | |||
| Rect WSWindowManager::menubar_rect() const | ||||
| { | ||||
|     if (active_fullscreen_window()) | ||||
|         return { }; | ||||
|         return {}; | ||||
|     return { 0, 0, WSScreen::the().rect().width(), 18 }; | ||||
| } | ||||
| 
 | ||||
|  | @ -1050,7 +1054,7 @@ Rect WSWindowManager::maximized_window_rect(const WSWindow& window) const | |||
|     rect.set_height(rect.height() - menubar_rect().height()); | ||||
| 
 | ||||
|     // Subtract taskbar window height if present
 | ||||
|     const_cast<WSWindowManager*>(this)->for_each_visible_window_of_type_from_back_to_front(WSWindowType::Taskbar, [&rect] (WSWindow& taskbar_window) { | ||||
|     const_cast<WSWindowManager*>(this)->for_each_visible_window_of_type_from_back_to_front(WSWindowType::Taskbar, [&rect](WSWindow& taskbar_window) { | ||||
|         rect.set_height(rect.height() - taskbar_window.height()); | ||||
|         return IterationDecision::Abort; | ||||
|     }); | ||||
|  |  | |||
|  | @ -1,9 +1,9 @@ | |||
| #include <WindowServer/WSWindowSwitcher.h> | ||||
| #include <WindowServer/WSWindowManager.h> | ||||
| #include <WindowServer/WSEvent.h> | ||||
| #include <WindowServer/WSScreen.h> | ||||
| #include <SharedGraphics/Font.h> | ||||
| #include <SharedGraphics/StylePainter.h> | ||||
| #include <WindowServer/WSEvent.h> | ||||
| #include <WindowServer/WSScreen.h> | ||||
| #include <WindowServer/WSWindowManager.h> | ||||
| #include <WindowServer/WSWindowSwitcher.h> | ||||
| 
 | ||||
| static WSWindowSwitcher* s_the; | ||||
| 
 | ||||
|  | @ -70,8 +70,8 @@ void WSWindowSwitcher::on_key_event(const WSKeyEvent& event) | |||
| void WSWindowSwitcher::draw() | ||||
| { | ||||
|     Painter painter(*m_switcher_window->backing_store()); | ||||
|     painter.fill_rect({ { }, m_rect.size() }, Color::LightGray); | ||||
|     painter.draw_rect({ { }, m_rect.size() }, Color::DarkGray); | ||||
|     painter.fill_rect({ {}, m_rect.size() }, Color::LightGray); | ||||
|     painter.draw_rect({ {}, m_rect.size() }, Color::DarkGray); | ||||
|     for (int index = 0; index < m_windows.size(); ++index) { | ||||
|         auto& window = *m_windows.at(index); | ||||
|         Rect item_rect { | ||||
|  | @ -116,14 +116,15 @@ void WSWindowSwitcher::refresh() | |||
|     m_selected_index = 0; | ||||
|     int window_count = 0; | ||||
|     int longest_title_width = 0; | ||||
|     wm.for_each_visible_window_of_type_from_front_to_back(WSWindowType::Normal, [&] (WSWindow& window) { | ||||
|     wm.for_each_visible_window_of_type_from_front_to_back(WSWindowType::Normal, [&](WSWindow& window) { | ||||
|         ++window_count; | ||||
|         longest_title_width = max(longest_title_width, wm.font().width(window.title())); | ||||
|         if (selected_window == &window) | ||||
|             m_selected_index = m_windows.size(); | ||||
|         m_windows.append(window.make_weak_ptr()); | ||||
|         return IterationDecision::Continue; | ||||
|     }, true); | ||||
|     }, | ||||
|         true); | ||||
|     if (m_windows.is_empty()) { | ||||
|         hide(); | ||||
|         return; | ||||
|  |  | |||
|  | @ -1,8 +1,8 @@ | |||
| #include <LibCore/CConfigFile.h> | ||||
| #include <WindowServer/WSCompositor.h> | ||||
| #include <WindowServer/WSEventLoop.h> | ||||
| #include <WindowServer/WSScreen.h> | ||||
| #include <WindowServer/WSWindowManager.h> | ||||
| #include <WindowServer/WSEventLoop.h> | ||||
| #include <WindowServer/WSCompositor.h> | ||||
| #include <LibCore/CConfigFile.h> | ||||
| #include <signal.h> | ||||
| #include <stdio.h> | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling