1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 21:57:35 +00:00

WindowServer: Don't invalidate already frontmost window for moving to front.

This commit is contained in:
Andreas Kling 2019-01-21 02:18:16 +01:00
parent e115ae5641
commit 786b903d62
5 changed files with 18 additions and 8 deletions

View file

@ -7,6 +7,8 @@
#include <WindowServer/WSWindow.h> #include <WindowServer/WSWindow.h>
#include <WindowServer/WSWindowManager.h> #include <WindowServer/WSWindowManager.h>
//#define LOG_GUI_SYSCALLS
void Process::initialize_gui_statics() void Process::initialize_gui_statics()
{ {
Font::initialize(); Font::initialize();
@ -104,9 +106,6 @@ int Process::gui$get_window_backing_store(int window_id, GUI_WindowBackingStoreI
int Process::gui$invalidate_window(int window_id, const GUI_Rect* rect) int Process::gui$invalidate_window(int window_id, const GUI_Rect* rect)
{ {
#ifdef LOG_GUI_SYSCALLS
dbgprintf("%s<%u> gui$invalidate_window (window_id=%d, rect=%p)\n", name().characters(), pid(), window_id, rect);
#endif
if (window_id < 0) if (window_id < 0)
return -EINVAL; return -EINVAL;
if (rect && !validate_read_typed(rect)) if (rect && !validate_read_typed(rect))
@ -114,6 +113,12 @@ int Process::gui$invalidate_window(int window_id, const GUI_Rect* rect)
auto it = m_windows.find(window_id); auto it = m_windows.find(window_id);
if (it == m_windows.end()) if (it == m_windows.end())
return -EBADWINDOW; return -EBADWINDOW;
#ifdef LOG_GUI_SYSCALLS
if (!rect)
dbgprintf("%s<%u> gui$invalidate_window (window_id=%d, rect=(entire))\n", name().characters(), pid(), window_id);
else
dbgprintf("%s<%u> gui$invalidate_window (window_id=%d, rect={%d,%d %dx%d})\n", name().characters(), pid(), window_id, rect->location.x, rect->location.y, rect->size.width, rect->size.height);
#endif
auto& window = *(*it).value; auto& window = *(*it).value;
auto event = make<WSEvent>(WSEvent::WM_Invalidate); auto event = make<WSEvent>(WSEvent::WM_Invalidate);
if (rect) if (rect)

View file

@ -94,9 +94,9 @@ public:
enum class GMouseButton : byte { enum class GMouseButton : byte {
None = 0, None = 0,
Left, Left = 1,
Middle, Right = 2,
Right, Middle = 4,
}; };
enum GKeyboardKey { enum GKeyboardKey {

View file

@ -18,7 +18,7 @@ void GLabel::set_text(String&& text)
update(); update();
} }
void GLabel::paint_event(GPaintEvent&) void GLabel::paint_event(GPaintEvent& event)
{ {
Painter painter(*this); Painter painter(*this);
if (fill_with_background_color()) if (fill_with_background_color())

View file

@ -82,5 +82,9 @@ GWindow* make_launcher_window()
} }
}; };
auto* dummy_button = new GButton(widget);
dummy_button->set_relative_rect({ 5, 50, 70, 20 });
dummy_button->set_caption("Dummy");
return window; return window;
} }

View file

@ -193,9 +193,10 @@ void WSWindowManager::add_window(WSWindow& window)
void WSWindowManager::move_to_front(WSWindow& window) void WSWindowManager::move_to_front(WSWindow& window)
{ {
LOCKER(m_lock); LOCKER(m_lock);
if (m_windows_in_order.tail() != &window)
invalidate(window);
m_windows_in_order.remove(&window); m_windows_in_order.remove(&window);
m_windows_in_order.append(&window); m_windows_in_order.append(&window);
invalidate(window);
} }
void WSWindowManager::remove_window(WSWindow& window) void WSWindowManager::remove_window(WSWindow& window)