Преглед изворни кода

LibWeb: Handle theme change event in OutOfProcessWebView

Linus Groh пре 4 година
родитељ
комит
e6709e3834
2 измењених фајлова са 8 додато и 0 уклоњено
  1. 7 0
      Libraries/LibWeb/OutOfProcessWebView.cpp
  2. 1 0
      Libraries/LibWeb/OutOfProcessWebView.h

+ 7 - 0
Libraries/LibWeb/OutOfProcessWebView.cpp

@@ -113,6 +113,13 @@ void OutOfProcessWebView::mousemove_event(GUI::MouseEvent& event)
     client().post_message(Messages::WebContentServer::MouseMove(to_content_position(event.position()), event.button(), event.buttons(), event.modifiers()));
     client().post_message(Messages::WebContentServer::MouseMove(to_content_position(event.position()), event.button(), event.buttons(), event.modifiers()));
 }
 }
 
 
+void OutOfProcessWebView::theme_change_event(GUI::ThemeChangeEvent& event)
+{
+    GUI::ScrollableWidget::theme_change_event(event);
+    client().post_message(Messages::WebContentServer::UpdateSystemTheme(Gfx::current_system_theme_buffer_id()));
+    request_repaint();
+}
+
 void OutOfProcessWebView::notify_server_did_paint(Badge<WebContentClient>, i32 shbuf_id)
 void OutOfProcessWebView::notify_server_did_paint(Badge<WebContentClient>, i32 shbuf_id)
 {
 {
     if (m_back_bitmap->shbuf_id() == shbuf_id) {
     if (m_back_bitmap->shbuf_id() == shbuf_id) {

+ 1 - 0
Libraries/LibWeb/OutOfProcessWebView.h

@@ -75,6 +75,7 @@ private:
     virtual void mouseup_event(GUI::MouseEvent&) override;
     virtual void mouseup_event(GUI::MouseEvent&) override;
     virtual void mousemove_event(GUI::MouseEvent&) override;
     virtual void mousemove_event(GUI::MouseEvent&) override;
     virtual void keydown_event(GUI::KeyEvent&) override;
     virtual void keydown_event(GUI::KeyEvent&) override;
+    virtual void theme_change_event(GUI::ThemeChangeEvent&) override;
 
 
     // ^ScrollableWidget
     // ^ScrollableWidget
     virtual void did_scroll() override;
     virtual void did_scroll() override;