N
N
nano_e_t_42020-02-05 17:06:03
linux
nano_e_t_4, 2020-02-05 17:06:03

How does the event handling by the operating system work?

Hello everyone
The question is this (using the chromium browser as an example):
there is an event, for example, a mouse click on a button in a browser tab (several tabs are open). How does this event end up flying directly to the render engine, which is already rendering the event hidden behind the button?

I read the chromium docks for developers, understanding appears, but very vague so far. If anyone knows or has lit this story, please tell

Answer the question

In order to leave comments, you need to log in

5 answer(s)
K
Karpion, 2020-02-06
@nano_e_t_4

The mouse click goes through many handlers, starting with the hardware interrupt handler. Those. this is first processed in the kernel, then passed to the X server, where it is mapped to a specific window, and the window is mapped to its application owner. Next, the X server communicates through the kernel with the owner of the window (in this case, the browser) and passes the handler to it. In the browser, click processing is also done in many stages in different software components, including the JS interpreter; and he is already transmitting commands to the renderer. Moreover, rendering is first a browser, then (again through the kernel) it is transmitted to the X server.
And some clicks (on objects that do not have a JS handler assigned - of course, are processed without a JS interpreter, by built-in handlers.
Judging by the last phrase, you are only interested in what happens in the browser. I didn't dig, I don't know.

P
pfg21, 2020-02-05
@pfg21

https://habr.com/ru/post/174057/
https://habr.com/ru/company/htmlacademy/blog/254825/
https://habr.com/ru/company/dataart/blog/304138/
well, google questions - look for articles that suit your mind

A
alfss, 2020-02-05
@alfss

Events within Linux are implemented by the X server. The browser uses a UI library that wraps signals from the X server and allows them to be processed within its abstractions.

V
Vladimir Korotenko, 2020-02-06
@firedragon

I’ll tell you only about windows
Inside windows there are a lot of primitives, the main primitive is messages with the symbolic name WM_ *
All other systems operate with them, at the level of frameworks and different languages ​​​​there are their own abstractions, but it is she who is translated into the kernel.
https://docs.microsoft.com/en-us/windows/win32/api...
Due to this, Windows renders graphics quite quickly and responds to user input. This has its downsides as well. But for the most part, everything is now closed.

R
res2001, 2020-02-05
@res2001

The GUI application has an event loop that receives the next event from the OS and processes it.
Usually the event loop is hidden deep in the wilds of the library used in the GUI application (for example, Qt).
To understand, you need to look at how it is written at a low level. Google about writing a "window procedure" - that's for Windows. In niks everything is about the same.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question