Commit Graph

22257 Commits

Author SHA1 Message Date
Andreas Kling
fa9846ec6f WindowServer: Simplify how we determine the hovered window
Instead of plumbing a Window* through the entire mouse event processing
logic, just do a hit test and say that the window under the cursor is
the hovered window.

It's funny how much easier this is now that we have a way to hit test
the entire window stack with one call.
2021-06-18 17:40:05 +02:00
Andreas Kling
3bf5e482cf Kernel: Make the "in early boot" flag read-only-after-init 2021-06-18 17:40:05 +02:00
Andreas Kling
7b3fdd178e WindowServer: Simplify processing of window-specific mouse events
Move the logic for processing a mouse event that hits a specific window
into its own function.

If the window is blocked by a modal child, we now get that out of the
way first, so we don't have to think about it later.
2021-06-18 17:40:05 +02:00
Andreas Kling
2f9e8a982c WindowServer: Unify hit testing between fullscreen/regular windows
Even if a window is in fullscreen mode, we still want hit testing to
walk the window stack. Otherwise child windows of the fullscreen
window will not receive mouse events.
2021-06-18 17:40:05 +02:00
Andreas Kling
09dacf4cd1 WindowServer: Move titlebar button mouse event handling to a function
The button widgets internally rendered by WindowServer are only used
in titlebars, and require a bit of mouse event handling. Instead of
mixing it with the window-oriented mouse event handling, get the
button event stuff out of the way first.
2021-06-18 17:40:05 +02:00
Andreas Kling
5d73e16edf WindowServer: Make deliver_mouse_event() perform coordinate translation
Instead of expecting callers to provide a window-relative position,
just take care of it inside deliver_mouse_event() instead.
2021-06-18 17:40:05 +02:00
Andreas Kling
300711d013 WindowServer: Preserve all members in MouseEvent::translated()
We were forgetting to preserve the m_drag and m_mime_data members of
WindowServer::MouseEvent when making a translated copy.

This didn't affect any reachable code paths before this change.
2021-06-18 17:40:05 +02:00
Andreas Kling
bac200885c LibGUI: Don't restart AbstractView drag on mousemove after escape key
Previously, if a drag operation was aborted by pressing the escape key
(handled by WindowServer), the drag would immediately restart if you
moved the mouse cursor before releasing the mouse button.
2021-06-18 17:40:05 +02:00
Andreas Kling
58823c474e WindowServer: Don't let super key open system menu while tracking input
Previously it was possible to open the system menu while tracking mouse
input after a mousedown event.
2021-06-18 17:40:05 +02:00
Andreas Kling
82a945fa7e WindowServer: Always send mouse events to active input tracker first
If a window is currently actively tracking input events (because
sent it a MouseDown and haven't sent it a MouseUp yet), we now simply
send mouse events to that window right away before doing any other
event processing.

This makes it much easier to reason about mouse events.
2021-06-18 17:40:05 +02:00
Andreas Kling
69dad3b996 WindowServer: Remove an unnecessary temporary variable 2021-06-18 17:40:05 +02:00
Andreas Kling
ad828b3cfc WindowServer: Split up WindowFrame::handle_mouse_event()
Break this function into a couple of smaller functions, one for each
of these areas:

- The titlebar
- The titlebar icon
- The menubar
- The border
2021-06-18 17:40:05 +02:00
Andreas Kling
f88361fc28 WindowServer: Add WindowStack::window_at() and use it a bunch
This performs a hit test on the window stack to find the window under
a given cursor position.
2021-06-18 17:40:05 +02:00
Andreas Kling
4133caba78 WindowServer: Make hit test results richer
Instead of just answering hit/no-hit when hit testing windows, we now
return a HitTestResult object which tells you which window was hit,
where it was hit, and whether you hit the frame or the content.
2021-06-18 17:40:05 +02:00
Andreas Kling
370d3749e5 WindowServer: Remove weird feature where Ctrl+Wheel changed opacity
This feature had been there since early on and was not actually useful
for anything. I just added it because it was fun. In retrospect, it's
not a very good feature and I only ever activated it by accident.
2021-06-18 17:40:05 +02:00
Andreas Kling
e4e94cd43d WindowServer: Allow each WindowStack to have an active window
A window with an inner stack needs to keep track of which inner window
is active.
2021-06-18 17:40:05 +02:00
Andreas Kling
2b0e0b602c WindowServer: Keep track of which WindowStack a Window is part of
Each Window now knows which WindowStack it's part of. We call this the
Window::outer_stack(), in preparation for supporting inner stacks. :^)
2021-06-18 17:40:05 +02:00
Andreas Kling
d0bc3d6002 WindowServer: Convert WindowManager to east-const style 2021-06-18 17:40:05 +02:00
Andreas Kling
d257f58306 WindowServer: Add WindowStack concept
This patch moves the window stack out of WindowManager and into its own
WindowStack class.

A WindowStack is an ordered list of windows with an optional highlight
window. The highlight window mechanism is used during Super+Tab window
switching to temporarily bring a window to the front.

This is mostly mechanical, just moving the code to its own class.
2021-06-18 17:40:05 +02:00
Jesse Buhagiar
906d3e9f44 LibUSBDB: Fix vendor id decoding
This was broken because the whole line was being passed in instead
of a substring..
2021-06-18 19:41:25 +04:30
Gunnar Beutner
94f56b5f6d Ports: Add port for DOSBox Staging 2021-06-18 16:35:15 +02:00
Gunnar Beutner
cf79b499f6 LibC: Add definition for PRIuPTR 2021-06-18 16:35:15 +02:00
Idan Horowitz
7fa5f6be7d CI: Remove discord build status notifications
While these look nice, they require the discord workflow to sit around
and wait for the build-and-lint workflow to finish in order to get its
status which means we waste an extra workflow runner that does nothing
for each build-and-lint run.
2021-06-18 13:45:18 +01:00
Jesse Buhagiar
01cd474930 Userland/Libraries: Add LibUSBDB library
Simple clone of LibPCIDB to support USB IDs instead of PCI
ones. The format is basically identical, besides a few changes
of the double tab fields.
2021-06-18 17:04:57 +04:30
Jesse Buhagiar
119b8a2692 Userland: Add lsusb :^) 2021-06-18 17:04:57 +04:30
Jesse Buhagiar
f2ff55dd09 Kernel: Add /proc/bus/usb to store information about connected devices 2021-06-18 17:04:57 +04:30
Jesse Buhagiar
71c9572e74 USB: Store device descriptor on enumeration
We now store the device descriptor obtained from the device
during enumeration in the device's object in memory instead
of exposing all of the different members contained within it.
2021-06-18 17:04:57 +04:30
Jesse Buhagiar
7b42146f33 USB: Store devices in globally accessible array
USB Devices are now stored so that they may be later retrieved and
operated on (i.e, fetching their assigned device address via
ProcFS)
2021-06-18 17:04:57 +04:30
Sam Atkins
0e680cb17a Meta: Ensure long messages fit in commit tweet
Abbreviating the commit message to 240 characters was not always enough.
As a bonus, we now add an ellipsis to abbreviated messages.
2021-06-18 13:34:17 +01:00
Gunnar Beutner
22b0cbe1fe Kernel: Fix crash when changing screen resolution
Steps to reproduce:

1. Change resolution to 640x480.
2. Change resolution to 1280x1024.
3. Observe the following kernel panic:

Kernel::__panic(char const*, unsigned int, char const*) +0x55
Kernel::handle_crash(Kernel::RegisterState&, char const*, ...) +0x112
page_fault_handler +0x1130
page_fault_asm_entry +0x26
Kernel::VirtualConsole::refresh_after_resolution_change() +0x35e4
Kernel::ConsoleManagement::resolution_was_changed() +0x38b
Kernel::Graphics::FramebufferConsole::set_resolution(...) +0x3e1
Kernel::BochsGraphicsAdapter::try_to_set_resolution(...) +0x319
.L4213 +0x40a
Kernel::Process::sys$ioctl(int, unsigned int, unsigned int) +0x2fa
Kernel::Syscall::handle(Kernel::RegisterState&, ...) +0xfdc
syscall_handler +0x19c0
Kernel::syscall_asm_entry_dummy() +0x31
2021-06-18 13:45:21 +02:00
Luke
02de3cbce3 LibJS: Add Number.parseInt
This is initialized to be the same function object as the initial value
of the parseInt function on the global object.
2021-06-18 10:29:33 +01:00
Idan Horowitz
b6a74b6bd9 LibJS: Use existing attributes if any are missing in the new descriptor
The specification defines that we should only change attributes that
exist in the incoming descriptor, but since we currently just overwrite
the existing descriptor with the new one, we can just set the missing
attributes to the existing values manually.
2021-06-18 10:22:09 +02:00
Luke
50f33bb98e LibJS: Add missing exception check in Date.prototype.toJSON
It was missing an exception check on the call to to_primitive.
This fixes test/built-ins/Date/prototype/toJSON/called-as-function.js
from test262 crashing, but does not fix the test itself.
2021-06-18 10:21:29 +02:00
Stéphane Travostino
35e7c44dd4 Documentation/WSL: add a workaround for slow emulation on HiDPI screens 2021-06-18 10:21:09 +02:00
Marco Cutecchia
24c243942d Browser: Add setting to change homepage URL 2021-06-18 10:20:24 +02:00
Gavin Downard
3c6d99f696 Ports: Fix less by disabling wctype
The commit c2b47c067 (LibC: Add stubs for wctype and iswctype,
2021-05-27) introduced the wctype.h header, which caused the less port
to try to build with wchar support. This patches the header generated by
the configure script to remove wchar support.
2021-06-18 10:19:00 +02:00
Kyle Ambroff-Kao
d173945dad Tests: Add a test for ProcFS fd interaction
Co-authored-by: Tim Schumacher <timschumi@gmx.de>
2021-06-18 10:15:14 +02:00
Tim Schumacher
9559ac9dd6 Kernel: Correctly decode proc_file_type from identifier
inode identifiers in ProcFS are encoded in a way that the parent ID is
shifted 12 bits to the left and the PID is shifted by 16 bits. This
means that the rightmost 12 bits are reserved for the file type or the
fd.

Since the to_fd and to_proc_file_type decoders only decoded the
rightmost 8 bits, decoded values would wrap around beyond values of 255,
resulting in a different value compared to what was originally encoded.
2021-06-18 10:15:14 +02:00
Jean-Baptiste Boric
8cd96f031d Kernel: Fix CPUID usage inside cpu_detect()
Since no features inside the 0x80000001 leaf are required for
SerenityOS to work, don't assert if it's unavailable.
2021-06-18 01:02:25 +02:00
Jean-Baptiste Boric
fb3447f7ec Kernel: Use FXSR feature only if supported by CPU
If FXSR is not present, fall back to fnsave and frstor instructions.
These instructions aren't available on the canonical i686 CPU which is
the Pentium Pro processor.
2021-06-18 01:02:25 +02:00
Jean-Baptiste Boric
fea23d0ec1 Kernel: Detect support for CPUID FXSR
The fxsave and fxrstor instructions are available only if the FXSR
feature is present.
2021-06-18 01:02:25 +02:00
Elliot Maisl
90873781c1 PixelPaint: Add new selection moving modes
If you press "spacebar" while moving a selection, it will now move the
origin point of the selection; and if you press "control" it will move
it relatively to the center.
2021-06-17 23:02:53 +02:00
sin-ack
e2215cc0e1 Lagom: Add an install target
This is used by libjs-test262-runner to be able to copy the libraries
within its own build directory in order to link with them.
2021-06-17 21:20:24 +01:00
brapru
c62804df46 passwd: Do not allow empty passwords
The user should use the delete flag when wanting to issue an empty
password. passwd should return an error after receiving empty input.
2021-06-17 19:54:38 +02:00
brapru
1a9d0dee2c passwd: Provide more verbose output regarding status of changed passwd
passwd should explicitly indicate the status of the password change.
2021-06-17 19:54:38 +02:00
brapru
4fd842f566 passwd: Retype password to confirm
Previously passwd would accept the first password input by the user. It
should ask the user to re-type the password to check for mismatches and
prevent typos in the password.
2021-06-17 19:54:38 +02:00
brapru
b0f8bccd08 passwd: Prompt for the current password before setting new password
This changes passwd to authenticate non-root users before prompting for
new password.
2021-06-17 19:54:38 +02:00
Erik Sommer
96588adbd4
PixelPaint: Update debug message in the copy action to the used method (#8113) 2021-06-17 19:53:45 +02:00
Gunnar Beutner
58c182b19e Kernel: Update check in Inode::read_entire
The nread variable can't be less than zero anymore.
2021-06-17 19:52:54 +02:00
Gunnar Beutner
bf779e182e Kernel: Remove obsolete size_t casts 2021-06-17 19:52:54 +02:00