ladybird/Userland/Services/WindowServer/WindowMode.h
thankyouverycool 463aff827e LibGUI+WindowServer: Notify Windows on input preemption
Previously Menus set themselves as active input solely to make
sure CaptureInput modals would close, but this is a functional
half-truth. Menus don't actually use the active input role; they
preempt normal Windows during event handling instead.

Now the active input window is notified on preemption and Menus
can remain outside the active input concept. This lets us make
more granular choices about modal behavior. For now, the only
thing clients care about is menu preemption on popup.

Fixes windows which close on changes to active input closing
on their own context menus.
2022-09-08 23:21:54 +01:00

37 lines
964 B
C++

/*
* Copyright (c) 2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
namespace WindowServer {
// WindowMode sets modal behavior for windows in a modal chain
//
// - Modeless: No modal effect (default mode for parentless windows)
// - Passive: Joins the modal chain but has no modal effect (default mode for child windows)
// - RenderAbove: Renders above its parent
// - CaptureInput: Captures input from its parent
// - Blocking: Preempts all interaction with its modal chain excepting descendants (default mode for Dialogs)
enum class WindowMode {
Modeless = 0,
Passive,
RenderAbove,
CaptureInput,
Blocking,
_Count,
};
// InputPreemptors are Objects which take input precedence over the active input
// window without changing its activity state or joining its modal chain
enum class InputPreemptor {
ContextMenu = 0,
MenubarMenu,
OtherMenu,
Other,
};
}