Преглед на файлове

WindowServer: Relayout window buttons immediately on theme change

Andreas Kling преди 5 години
родител
ревизия
e2f45a4b0e
променени са 3 файла, в които са добавени 14 реда и са изтрити 6 реда
  1. 11 6
      Services/WindowServer/WindowFrame.cpp
  2. 2 0
      Services/WindowServer/WindowFrame.h
  3. 1 0
      Services/WindowServer/WindowManager.cpp

+ 11 - 6
Services/WindowServer/WindowFrame.cpp

@@ -328,6 +328,16 @@ void WindowFrame::invalidate_title_bar()
 }
 
 void WindowFrame::notify_window_rect_changed(const Gfx::IntRect& old_rect, const Gfx::IntRect& new_rect)
+{
+    layout_buttons();
+
+    auto& wm = WindowManager::the();
+    wm.invalidate(frame_rect_for_window(m_window, old_rect));
+    wm.invalidate(frame_rect_for_window(m_window, new_rect));
+    wm.notify_rect_changed(m_window, old_rect, new_rect);
+}
+
+void WindowFrame::layout_buttons()
 {
     auto palette = WindowManager::the().palette();
     int window_button_width = palette.window_title_button_width();
@@ -352,11 +362,6 @@ void WindowFrame::notify_window_rect_changed(const Gfx::IntRect& old_rect, const
             button.set_relative_rect(rect);
         }
     }
-
-    auto& wm = WindowManager::the();
-    wm.invalidate(frame_rect_for_window(m_window, old_rect));
-    wm.invalidate(frame_rect_for_window(m_window, new_rect));
-    wm.notify_rect_changed(m_window, old_rect, new_rect);
 }
 
 void WindowFrame::on_mouse_event(const MouseEvent& event)
@@ -390,7 +395,7 @@ void WindowFrame::on_mouse_event(const MouseEvent& event)
             return;
         } else if (event.type() == Event::MouseUp && event.button() == MouseButton::Left) {
             // Since the MouseDown event opened a menu, another MouseUp
-            // from the second click outside the menu wouldn't be considered 
+            // from the second click outside the menu wouldn't be considered
             // a double click, so let's manually check if it would otherwise
             // have been be considered to be one
             auto& wm = WindowManager::the();

+ 2 - 0
Services/WindowServer/WindowFrame.h

@@ -53,6 +53,8 @@ public:
 
     void did_set_maximized(Badge<Window>, bool);
 
+    void layout_buttons();
+
 private:
     void paint_notification_frame(Gfx::Painter&);
     void paint_normal_frame(Gfx::Painter&);

+ 1 - 0
Services/WindowServer/WindowManager.cpp

@@ -1388,6 +1388,7 @@ bool WindowManager::update_theme(String theme_path, String theme_name)
                 notified_clients.set(window.client());
             }
         }
+        window.frame().layout_buttons();
         return IterationDecision::Continue;
     });
     MenuManager::the().did_change_theme();