modus
Menu
On this page

The entry compositor

The source src/modules/system/compositor built with the setting DRAWING_THROUGH_MODULE=true. The text after this paragraph is the comment of that source.

It draws its screen in parts, one call of the drawing module for each part.

See: The Picture record in a description in the repository

The assistive face of the compositor: the holders of the assistive role, their marks in the bar, and the magnification that a holder asks for . The rules and the places are in src/library/internal/compositor/bar (assistive.odin), so a host test reads the same table and the same marks.

See: Accessibility: a desktop that each principal can use: The assistive role in the repository

compositor module with an entry

Hash
ad7965b09a17a9e5885910a359666d0910c0d71c765d53fc808b4bc85ce70920
Size
712667 bytes
Exports
25
Imports
1
Imported by
0
License
MIT

The assistive face of the compositor: the holders of the assistive role, their marks in the bar, and the magnification that a holder asks for

FactValue
KindModules with an entry
Sourcesrc/modules/system/compositor
Boot imageyes: in the boot image, 712667 bytes in this build
Build settings
  • DRAWING_THROUGH_MODULE=true
Imports
Imported bynone

Neighbours

What it imports, at its left, and what imports it, at its right: the part of the module graph that touches it.

compositor drawing

Exports

ExportWhat it does
pointer() -> Table(Pointer)gives the place of the pointer on the screen, its buttons, the menu of the bar that is open, the state of the palette, and the name of the pointer shape, as one row
windows() -> Table(Window)gives one row for each window, the front one first: its title, its place and its size with the frame, its order from the front, whether it has the focus, and whether the keys go to it
screen() -> Table(Screen)gives the frames that the compositor drew, the Present records that it received, the damage rectangles that wait for the next frame, whether a change of the desktop itself waits, and how its frames reached the screen, as one row
notify(title: Text, body: Text) -> Integerposts a non-focus-stealing desktop notification card in the top-right corner below the bar and returns its assigned notification identifier, or a negative number with an error record
magnifier(zoom_eighths: Integer) -> Integersets the desktop viewport magnifier zoom factor in eighths (0 disables; 12 to 64 enables 1.5x to 8x zoom centered on the pointer) and returns 1 on success, or a negative number with an error record
powerbox_ask(process_name: Text, resource: Text) -> Integeropens an unforgeable trusted-display grant request dialog for a process requesting a network endpoint or store and returns the request ID, or a negative number with an error record
wide_grant_indicator(active: Integer, grant_id: Integer) -> Integershows (active == 1) or clears (active == 0) the unforgeable wide-grant indicator badge in the top bar and returns 1, or a negative number with an error record
set_decoration(window_order: Integer, mode: Integer) -> Integerswitches a window between default server decorations (0) and borderless client-side decorations (1), returning 1 on success or a negative number with an error record
open_context_menu(x: Integer, y: Integer) -> Integeropens the filterable fuzzy desktop context menu at (x, y) and returns 1, or a negative number with an error record
powerbox_pick_store(process_name: Text, mode: Text) -> Integeropens the unforgeable trusted-display Store Picker dialog for a requesting process (which never sees the store list) and returns the request ID, or a negative number with an error record
bar_position(pos_word: Integer) -> Integermoves the bar of the desktop to Top (1) or Bottom (2), and returns 1, or a negative number with an error record
tray_widget_open(widget_word: Integer) -> Integeropens the card of a tray widget, as a press on its part of the bar does, or closes the card that is open: 0 closes, 1 the control center, 2 the notification center, 3 the calendar
gpu_info() -> Table(Gpu_Info)returns one row describing the VirtIO-GPU 1.2 scanout and Venus capability state discovered by the compositor, or a negative number with an error record
window_grants() -> Table(Window_Grant_Row)gives one row for each requested grant that holds, in the order of their record: its number, the process that holds it, and its object
revoke_grant(grant_id: Integer) -> Integerends a requested grant by its number, as its button in the menu of the windows does
plan_diff_ask(plan_name: Text, added: Text, removed: Text) -> Integershows the difference of a plan on the trusted display: its name, the grants and roles that it adds, and the ones that it removes, each a list of names that commas separate
plan_diff_poll(serial: Integer) -> IntegerReturn the principal's decision for a trusted plan difference dialog
act_ask(act: Text) -> Integershows one act of an agent on the trusted display, for the principal to allow once or refuse: the asker, which is the name of the calling process, and the act, service.export
act_poll(serial: Integer) -> Integergives the decision of the principal on the act that act_ask showed with a serial, to the connection that asked: 0 while the dialog shows, 1 allowed, 2 refused, 3 unknown (a later dialog replaced it, no dialog had the serial, it was the dialog of a plan, or another connection asked for it)
act_cancel(serial: Integer) -> Integercloses the act dialog that act_ask showed with a serial with a refusal, for the connection that asked: the agent withdrew the act
assistive_attach(nickname: Text, kind_word: Integer) -> Integerrecords a holder of the assistive role, which reads the semantic trees of the windows from here on, and gives its number
assistive_detach(holder_id: Integer) -> Integerends a holder of the assistive role by its number
assistive_holders() -> Table(Assistive_Holder_Row)gives one row for each holder of the assistive role that reads the trees, in the order of their marks from the right: its number, its kind and its nickname
assistive_magnify(left: Integer, top: Integer, width: Integer, height: Integer, factor_eighths: Integer) -> Integerdraws a rectangle of the screen larger, over the whole screen, for a holder of the assistive role: the view centers on the rectangle when it fits, else it starts at its left and top edges
assistive_magnify_end() -> Integerends the magnification that a holder of the assistive role asked for
entry()starts the compositor and runs its one loop: it draws the screen until the machine stops

pointer

pointer() -> ()

pointer gives the place of the pointer on the screen, its buttons, the menu of the bar that is open, the state of the palette, and the name of the pointer shape, as one row. The result is 1, or a negative number with an error record. The error kind: No_Grant (-1, the caller does not act for the principal).

What it is for. A caller that drives the desktop from outside, as the machine test does through the remote service, reads where the pointer is and what is open before it moves the pointer or presses a button. The row is the state after the input records that the compositor took before the call.

The row (Pointer):

  • x, y: the place of the pointer, in pixels from the top left corner. It is the point where a press acts: the hot spot of the picture.
  • buttons: bit 0 the left button, bit 1 the right one, bit 2 the middle one.
  • moves, keys: the pointer records and the key records that the input service sent since the start.
  • keys_waiting: the key records that wait in the compositor for a window whose ring is full. They go to that window, in order, when it reads.
  • keys_refused: the key records that the compositor lost since the start, because the ring of a window and the queue of the compositor for it were both full. It is 0 on a system that works; the log has a line for each loss period.
  • menu: the menu or the card of the bar that is open: start, windows, control_center, notifications, calendar, or empty.
  • palette: the state of the palette: 0 while it is closed; 1 while it is open and the input searches; 2 while it asks for a second Enter; 3 while it waits for what its provider gives; 4 while it shows a result; 5 while its input band is the form of a command with parameters. Open, it takes the keys.
  • shape: the name of the pointer shape on the screen (arrow, move, text...).
  • form: the pointer form on the screen, dark or light: the form of the appearance in force.

Grant: the caller must act for the principal. A caller without it gets the error kind No_Grant, with the result -1: the place of the pointer tells where the input goes.

connect("compositor")
compositor.pointer()

See: Pointer pictures

Parameters
none
Result
()
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:180

windows

windows() -> ()

windows gives one row for each window, the front one first: its title, its place and its size with the frame, its order from the front, whether it has the focus, and whether the keys go to it. The result is the count of rows, or a negative number with an error record. The error kind: No_Grant (-1, the caller does not act for the principal).

What it is for. A caller finds a window by its title, then presses its title bar or its close button at a place that it computes from the row. The machine test does so before each drag.

A row (Window):

  • title: the name of the process of the window.
  • x, y, width, height: the window with its frame and its title bar, in pixels of the screen. The title bar is the top 24 pixels; the close button is the square of 24 pixels at its right end.
  • order: 0 for the window in front, 1 for the one under it, and so on.
  • focus: 1 for the window in front.
  • keyboard: 1 when the keys go to the window: the window in front, while the palette is closed.
  • presents: the Present records that the process of the window sent since it created its surface.
  • waits: 1 while a Present of the process changed a part of the screen and no frame drew it yet. 0: the screen shows the last picture that the process sent before the call.
  • events_sent, events_unread: the event records that the ring of the window took, and the ones in the ring that the process did not read yet.
  • events_waiting: the event records that wait in the compositor while the ring of the window is full (256 at most).
  • keys_refused: the key records of this window that were lost, because 256 records already waited.
  • frames: the frames of the screen that read a picture of the window.
  • pictures_drawn_again: the Present records that named the picture that the compositor already read. A surface has two pictures, and a process draws the one that the compositor does not read: each Present names the other picture. A process that names the same picture again drew in a picture on the screen, and the screen could show it half drawn. It is 0 for a process that shows whole frames.
  • presents_refused: the Present records that the compositor refused, because their picture number names no picture of the surface (it is 0 or 1). Such a record changes nothing on the screen and is not in presents.

Only a process that created its surface has a window. If the table of the caller has fewer places than windows, the rows of the windows at the back are missing, and the result still gives the count of all windows.

Grant: the caller must act for the principal; else the error kind No_Grant, with the result -1.

connect("compositor")
where(compositor.windows(), focus = 1)
Parameters
none
Result
()
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:254

screen

screen() -> ()

screen gives the frames that the compositor drew, the Present records that it received, the damage rectangles that wait for the next frame, whether a change of the desktop itself waits, and how its frames reached the screen, as one row. The result is 1, or a negative number with an error record. The error kind: No_Grant (-1, the caller does not act for the principal).

What it is for. A caller that takes a picture of the screen from outside, as the machine test does through the remote service, reads if the screen shows what the compositor received. The compositor draws a frame at most once in 16 ms: between a change and its frame, the screen shows the picture before.

The row (Screen):

  • frames: the frames drawn since the start.
  • presents: the Present records of all the processes since the start.
  • damage: the damage rectangles that wait for the next frame, of the desktop and of the processes.
  • desktop: 1 while a change of the desktop itself waits for the next frame: the pointer, the bar, a menu, the palette, a window that appeared, moved or closed. The Present of a process is not in it: windows() gives it for each window, in waits.
  • page_flips: the page flips since the start. With two screen pages, each frame goes into the page that the display does not show, and a flip shows it whole.
  • frames_on_the_shown_page: the frames that the compositor wrote into the screen page that the display showed, which the display could show in part. It is 0 on a display with two screen pages. With one, or after a flip that the display refused, it counts each frame.

The row counts each record that a process sent before the call: the compositor reads the ring of each window before it answers. It does not say that a process sent its last picture: a process that still computes has sent nothing yet. The state of the threads of the process says that (monitor.processes()).

Grant: the caller must act for the principal; else the error kind No_Grant, with the result -1.

connect("compositor")
compositor.screen()
Parameters
none
Result
()
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:329

notify

notify(title: , body: ) -> 

notify posts a non-focus-stealing desktop notification card in the top-right corner below the bar and returns its assigned notification identifier, or a negative number with an error record.

A caller that acts for the principal posts as the principal. Any other caller posts under its own process name, which the card shows before the title, and holds at most 3 cards at once .

The error kinds:

  • Empty: an empty title (argument 1), or a caller whose connection has no name (argument 0).
  • Too_Long: a title past 96 bytes (argument 1) or a body past 256 bytes (argument 2).
  • Full, unit Requests: the caller shows 3 cards already; limit 3, found the cards that it shows.
  • Full, unit Records: the desktop shows 64 cards already; limit 64.
  • Busy, unit Milliseconds: a post within 500 ms of the last one of the caller; limit 500.
  • Refused: the notifications are off (do not disturb), or the desktop is not ready.

Grant: a connection to the compositor.

See: The tray widgets: The export notify in the repository

Parameters
  • title:
  • body:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:364

magnifier

magnifier(zoom_eighths: ) -> 

magnifier sets the desktop viewport magnifier zoom factor in eighths (0 disables; 12 to 64 enables 1.5x to 8x zoom centered on the pointer) and returns 1 on success, or a negative number with an error record.

Grant: the caller must act for the principal.

Parameters
  • zoom_eighths:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:415

powerbox_ask

powerbox_ask(process_name: , resource: ) -> 

powerbox_ask opens an unforgeable trusted-display grant request dialog for a process requesting a network endpoint or store and returns the request ID, or a negative number with an error record.

Grant: the caller must act for the principal.

Parameters
  • process_name:
  • resource:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:434

wide_grant_indicator

wide_grant_indicator(active: , grant_id: ) -> 

wide_grant_indicator shows (active == 1) or clears (active == 0) the unforgeable wide-grant indicator badge in the top bar and returns 1, or a negative number with an error record.

A wide grant lets an agent see and drive the screen: the indicator is how the principal knows. So a caller that can show the indicator cannot clear it: only the collector clears it, and the one-press revocation key clears it on the local keyboard. Any other caller, remote or local, gets No_Grant with the unit Grants when it clears an indicator that shows.

Grant: the caller must act for the principal to show the indicator, and must be the collector to clear it.

Parameters
  • active:
  • grant_id:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:465

set_decoration

set_decoration(window_order: , mode: ) -> 

set_decoration switches a window between default server decorations (0) and borderless client-side decorations (1), returning 1 on success or a negative number with an error record.

Grant: the caller must act for the principal.

Parameters
  • window_order:
  • mode:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:491

open_context_menu

open_context_menu(x: , y: ) -> 

open_context_menu opens the filterable fuzzy desktop context menu at (x, y) and returns 1, or a negative number with an error record.

Grant: the caller must act for the principal.

Parameters
  • x:
  • y:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:513

powerbox_pick_store

powerbox_pick_store(process_name: , mode: ) -> 

powerbox_pick_store opens the unforgeable trusted-display Store Picker dialog for a requesting process (which never sees the store list) and returns the request ID, or a negative number with an error record.

Grant: the caller must act for the principal.

Parameters
  • process_name:
  • mode:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:527

bar_position

bar_position(pos_word: ) -> 

bar_position moves the bar of the desktop to Top (1) or Bottom (2), and returns 1, or a negative number with an error record. Left (3) and Right (4) are taken and keep the bar at the top: the compositor draws no vertical bar yet.

Grant: the caller must act for the principal.

See: The edge of the bar in the repository

Parameters
  • pos_word:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:548

tray_widget_open

tray_widget_open(widget_word: ) -> 

tray_widget_open opens the card of a tray widget, as a press on its part of the bar does, or closes the card that is open: 0 closes, 1 the control center, 2 the notification center, 3 the calendar. Opening a card closes the start menu, the menu of the windows, the list of the viewers and the context menu of the desktop. The result is 1, or a negative number with an error record. The error kinds: No_Grant (-1, the caller does not act for the principal); Bad_Value (-1, a word that names no tray widget).

The field menu of pointer() names the open card: control_center, notifications or calendar.

Grant: the caller must act for the principal; else the error kind No_Grant, with the result -1.

connect("compositor")
compositor.tray_widget_open(3)

See: The tray widgets in the repository

Parameters
  • widget_word:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:573

gpu_info

gpu_info() -> ()

gpu_info returns one row describing the VirtIO-GPU 1.2 scanout and Venus capability state discovered by the compositor, or a negative number with an error record.

Grant: the caller must act for the principal.

Parameters
none
Result
()
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:591

window_grants

window_grants() -> ()

window_grants gives one row for each requested grant that holds, in the order of their record: its number, the process that holds it, and its object. The result is the count of the grants, or a negative number with an error record. The error kind: No_Grant (-1, the caller does not act for the principal).

What it is for. The menu of the windows lists the same grants under the window of their process, each with a button that revokes it. A caller reads them here, and revokes one with revoke_grant.

A row (Window_Grant_Row):

  • grant: the number of the grant, from 1, never given twice in one run.
  • window: the name of the process, the title of its window.
  • resource: the object of the grant: an endpoint, or the store that the principal picked with the mode that the process asked for.

If the table of the caller has fewer places than grants, the last grants are missing, and the result still gives the count of all.

Grant: the caller must act for the principal; else the error kind No_Grant, with the result -1.

connect("compositor")
compositor.window_grants()
Parameters
none
Result
()
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:633

revoke_grant

revoke_grant(grant_id: ) -> 

revoke_grant ends a requested grant by its number, as its button in the menu of the windows does. The result is 1, or a negative number with an error record. The error kinds: No_Grant (-1, the caller does not act for the principal); Bad_Value (-1, a number under 1); Absent (-1, no grant of that number holds).

Grant: the caller must act for the principal; else the error kind No_Grant, with the result -1.

connect("compositor")
compositor.revoke_grant(1)
Parameters
  • grant_id:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:656

plan_diff_ask

plan_diff_ask(plan_name: , added: , removed: ) -> 

plan_diff_ask shows the difference of a plan on the trusted display: its name, the grants and roles that it adds, and the ones that it removes, each a list of names that commas separate. The principal accepts or refuses it whole; the log says the decision. The result is the serial of the dialog, or a negative number with an error record. The error kinds: No_Grant (-1, the caller does not act for the principal); Busy (-1, a dialog of the trusted display shows); Empty (-1, no name, or nothing added and nothing removed); Too_Long (-1, a name past 48 bytes, or more than 8 items on one side); Bad_Value (-1, an empty item in a list).

The act. The focus starts on Refuse. An act counts 500 ms after the dialog showed: Enter acts on the button that has the focus, Tab and the arrows move it, a press on a button acts on it. Escape refuses at once. While the dialog shows, no window receives a key or a press.

Grant: the caller must be the holder of the role Plans, which the root service names in the amount of its grant, or act for the principal; else the error kind No_Grant, with the result -1.

connect("compositor")
compositor.plan_diff_ask("home", "notes: store documents", "paint: network")
Parameters
  • plan_name:
  • added:
  • removed:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:685

plan_diff_poll

plan_diff_poll(serial: ) -> 

Return the principal's decision for a trusted plan difference dialog.

What it is for. The service plans asks for a difference, then reads the decision here, and commits the plan only when the principal accepted it on the trusted display. The dialog keeps the decision of the last dialog only.

Grant: the caller must be the holder of the role Plans, which the root service names in the amount of its grant, or act for the principal; else the error kind No_Grant, with the result -1.

connect("compositor")
compositor.plan_diff_poll(1)
Parameters
  • serial:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:736

act_ask

act_ask(act: ) -> 

act_ask shows one act of an agent on the trusted display, for the principal to allow once or refuse: the asker, which is the name of the calling process, and the act, service.export. The result is the serial of the dialog, or a negative number with an error record. The error kinds: No_Grant (-1, the caller may not ask an act, or the call comes from no connection); Busy (-1, a dialog of the trusted display shows); Bad_Value (-1, the act is not two identifiers with a period between them, or the name of the caller is no identifier).

What it is for. An agent proposes acts to the principal through a window such as the assistant. An act that the bridge stops needs a decision that the agent cannot give: this dialog. It shows no word of the agent: the asker comes from the connection, and the act is two identifiers that it checks.

The act. The focus starts on Refuse, and Enter acts on the button that has it 500 ms after the dialog showed. Tab and the arrows move the focus only after that time, and each move starts the time again; a press on the other button moves the focus the same way, and a press on the button that has it acts. Escape refuses at once. The dialog closes with a refusal when the connection of its asker ends.

Grant: the caller must have the right to ask an act, which the root service names in the amount of its grant, or act for the principal; else the error kind No_Grant, with the result -1.

compositor.act_ask("plans.apply")

See: The assistant: The act dialog: a face of the trusted display for one act in the repository

Parameters
  • act:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:807

act_poll

act_poll(serial: ) -> 

act_poll gives the decision of the principal on the act that act_ask showed with a serial, to the connection that asked: 0 while the dialog shows, 1 allowed, 2 refused, 3 unknown (a later dialog replaced it, no dialog had the serial, it was the dialog of a plan, or another connection asked for it). The result is the decision, or a negative number with an error record. The error kinds: No_Grant (-1, the caller may not ask an act, or the call comes from no connection); Bad_Value (-1, a serial under 1).

Grant: the caller must have the right to ask an act, or act for the principal; else the error kind No_Grant, with the result -1.

compositor.act_poll(1)
Parameters
  • serial:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:835

act_cancel

act_cancel(serial: ) -> 

act_cancel closes the act dialog that act_ask showed with a serial with a refusal, for the connection that asked: the agent withdrew the act. The result is 1 when the dialog closed, 0 when no act dialog of the caller with that serial shows, or a negative number with an error record. The error kinds: No_Grant (-1, the caller may not ask an act, or the call comes from no connection); Bad_Value (-1, a serial under 1).

What it is for. A window that asked for an act dialog and no longer shows the act, as when the entry of the act leaves its conversation, closes the dialog: the principal never decides an act that the window does not show.

Grant: the caller must have the right to ask an act, or act for the principal; else the error kind No_Grant, with the result -1.

compositor.act_cancel(1)
Parameters
  • serial:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:855

assistive_attach

assistive_attach(nickname: , kind_word: ) -> 

assistive_attach records a holder of the assistive role, which reads the semantic trees of the windows from here on, and gives its number. The bar shows a mark in the warning color with the word assistive and the nickname while it reads. The result is the number of the holder, or a negative number with an error record. The error kinds: No_Grant (-1, the caller does not act for the principal); Empty (-1, no nickname); Too_Long (-1, a nickname past 31 bytes); Bad_Value (-1, a nickname with a control byte or a damaged character, or a kind that names no holder: 1 screen reader, 2 magnifier, 3 switch input); Full (-1, 4 holders read already).

Several holders at once. A principal with low vision uses a magnifier and a screen reader together, so each holder has its own number and its own mark.

Grant: the caller must act for the principal; else the error kind No_Grant, with the result -1.

connect("compositor")
compositor.assistive_attach("screen_reader", 1)
Parameters
  • nickname:
  • kind_word:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:887

assistive_detach

assistive_detach(holder_id: ) -> 

assistive_detach ends a holder of the assistive role by its number. Its mark leaves the bar; with the last holder, a magnification that a holder asked for ends too. The result is 1, or a negative number with an error record. The error kinds: No_Grant (-1, the caller does not act for the principal); Bad_Value (-1, a number under 1); Absent (-1, no holder of that number reads).

Grant: the caller must act for the principal; else the error kind No_Grant, with the result -1.

connect("compositor")
compositor.assistive_detach(1)
Parameters
  • holder_id:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:923

assistive_holders

assistive_holders() -> ()

assistive_holders gives one row for each holder of the assistive role that reads the trees, in the order of their marks from the right: its number, its kind and its nickname. The result is the count of the holders, or a negative number with an error record. The error kind: No_Grant (-1, the caller does not act for the principal).

If the table of the caller has fewer places than holders, the last holders are missing, and the result still gives the count of all.

Grant: the caller must act for the principal; else the error kind No_Grant, with the result -1.

connect("compositor")
compositor.assistive_holders()
Parameters
none
Result
()
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:949

assistive_magnify

assistive_magnify(left: , top: , width: , height: , factor_eighths: ) -> 

assistive_magnify draws a rectangle of the screen larger, over the whole screen, for a holder of the assistive role: the view centers on the rectangle when it fits, else it starts at its left and top edges. The rectangle is in logical pixels; the factor is in eighths, from 12 (1.5 times) to 64 (8 times). No pixel leaves the compositor. The result is 1, or a negative number with an error record. The error kinds: No_Grant (-1, the caller does not act for the principal); Absent (-1, no assistive holder reads, so no mark would explain the magnification); Bad_Value (-1, a factor past its bounds, or a width or a height under 1); Out_Of_Range (-1, a part of the rectangle is off the screen: argument 1 for the left and the width, 2 for the top and the height).

Grant: the caller must act for the principal; else the error kind No_Grant, with the result -1.

connect("compositor")
compositor.assistive_magnify(100, 80, 200, 24, 16)
Parameters
  • left:
  • top:
  • width:
  • height:
  • factor_eighths:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:978

assistive_magnify_end

assistive_magnify_end() -> 

assistive_magnify_end ends the magnification that a holder of the assistive role asked for. The result is 1 when a magnification ended, 0 when none was on, or a negative number with an error record. The error kinds: No_Grant (-1, the caller does not act for the principal); Absent (-1, no assistive holder reads).

Grant: the caller must act for the principal; else the error kind No_Grant, with the result -1.

connect("compositor")
compositor.assistive_magnify_end()
Parameters
none
Result
When it fails
a negative result, and the error record
Source
src/modules/system/compositor/exports.odin:1015

entry

entry()

entry starts the compositor and runs its one loop: it draws the screen until the machine stops.

What it sets up: the framebuffer, the ring of the input service and the control ring of the root service; the frame and the background, each the size of the screen; the mark of the bar; the pointer theme; the service ring of its exports; the text settings and the interface font. It writes compositor: ok <width>x<height> and the measures of the bar and of a title bar.

The loop. One wait covers the control ring, the input ring, the service ring, the ring of each window and the change count of the settings page. The deadline is the next frame when the screen has damage, else the next second of the clock in the bar, or the next frame of an animated pointer. After the wait, in this order:

  1. 1. A change of the settings: the new font, the new pointer theme, and an event to each window, which draws again.
  2. 2. The control ring: a window to add or to remove, the palette provider to add or to remove.
  3. 3. The input ring: a key goes to the palette, or to the window in front; a move or a button of the pointer moves the pointer, drags a window, opens a menu or starts a process. Before the new records, the records that wait for a window whose ring was full go to it, in order (window_events.odin).
  4. 4. The ring of each window: Surface_Create, Present (the changed rectangle becomes damage), Pointer_Shape, Resizable and Surface_Resize.
  5. 5. The calls of pointer, windows and screen, after the input and after the rings of the windows, so that they give the place of now and count each Present that a process sent before the call.
  6. 6. A frame, at most one each 16 ms, when the screen has damage.

The stop. With no framebuffer (modus:screen_presence), the compositor writes compositor: no framebuffer and stops with Failed; with no input ring or no control ring, it writes compositor: no input ring or no control ring and stops with Failed. When its budget cannot pay the frame and the background of the screen, it writes compositor: a screen of <width>x<height> needs <n> pages, the budget holds <m> and stops with Failed. Without the memory of its frame, it writes compositor: no memory and stops. Else it never returns.

Form
The entry of the module: one parameter, an address, fixed by the contract.
Source
src/modules/system/compositor/main.odin:731

Read from the source of the module, as the build reads it to describe the exports (tools/modustool/build/describe.odin).

What the root service gives it

WhatValueAs the root service says
GrantsThe screen, the input ring and the control ring of this service (display_holder_start); its exports serve the processes.
Other terms of its start grant setnone
Budget that it asks for
  • working memory pages 10717
  • pages of its threads 91
  • pages of the pictures of its window 0
  • pages of the module and its imports from the files of the build
  • processes 1
  • threads 2

Its loop, and the thread that makes the lists of the palette. The working memory is the sum of these parts, at the reference screen of 1920 x 1080:

  • the frame and the background, each the size of the screen: 2 x 2025 pages, and 2 x 5 page tables (8.1 MB need 4 tables of 2 MiB, and one more when the start is not on a 2 MiB edge);
  • the two screen pages: device memory, which costs no page, but 15.8 MiB of it need up to 9 page tables;
  • each of these three spans can cross a 1 GiB edge, and then needs a second page directory: 3 pages;
  • the page of the display registers: a page table and a page directory, 2 pages;
  • its tables and the other mappings: 1647 pages;
  • the mapping of the surface of each window: the largest surface, display.SURFACE_SCREEN_LIMIT, 4096 x 4096 pixels of the screen (2048 logical pixels at the largest scale, 2) of 8 bytes for two pictures, is 128 MiB, whose mapping takes at most 65 page tables of 2 MiB (its start need not be on a 2 MiB edge) and 2 page directories (it can cross a 1 GiB edge): 67 pages. 32 clients: 32 x 67 = 2144 pages. These two parts were the 2255 pages counted at the scale 1, with surfaces of 2048 x 2048 and 19 pages each: 2255 - 32 x 19 = 1647;
  • a resize maps the new surface of a window beside its old one until its Present: one more such mapping for each client, 2144 pages. A rescale holds one surface at a time: the window releases the old one first;
  • the glyph memory of its two copies of the text rendering, its own (its bar, its menus, its titles) and the one of the drawing module: each draws every glyph of its text into its own private glyph cache, and reserves its memory at its first glyph: 2 x 354 pages (display.TEXT_MEMORY_PAGES) = 708 pages. 4050 + 10 + 9 + 3 + 2 + 1647 + 2144 + 2144 + 708 = 10717. A screen whose frame and background the budget cannot pay is named on one line, and the compositor stops (entry).
See: Windows that the principal resizes in the repository

The start grant set is read from start_grant_sets in src/modules/system/root/start_grant_sets.odin. The stated budget is read from the constant MODULE_BUDGET of the source of the module (its line); the build adds the counted parts and writes the sum in the module (tools/modustool/build/budget_count.odin); the root service accepts it up to the largest budget of a process, and adds the limits of processor time and of log records (src/modules/system/root/budgets.odin).

Table wire form

A wire form of the module contract: one word of a call. Records of one description that follow each other (a table).

Pointer record of a module

A record of the module compositor: 120 bytes, aligned on 8 bytes, 0 bytes of padding.

  • xi6408 bytes
  • yi6488 bytes
  • buttonsi64168 bytes
  • movesi64248 bytes
  • keysi64328 bytes
  • keys_waitingi64408 bytes
  • keys_refusedi64488 bytes
  • menuText(16)5616 bytes

and 3 more

Error_Record record of a module

A record of the module compositor: 56 bytes, aligned on 8 bytes, 0 bytes of padding.

  • kindi6408 bytes
  • uniti6488 bytes
  • operationi64168 bytes
  • argumenti64248 bytes
  • valuei64328 bytes
  • limiti64408 bytes
  • foundi64488 bytes

Window record of a module

A record of the module compositor: 168 bytes, aligned on 8 bytes, 0 bytes of padding.

  • titleText(32)032 bytes
  • xi64328 bytes
  • yi64408 bytes
  • widthi64488 bytes
  • heighti64568 bytes
  • orderi64648 bytes
  • focusi64728 bytes
  • keyboardi64808 bytes

and 10 more

Screen record of a module

A record of the module compositor: 48 bytes, aligned on 8 bytes, 0 bytes of padding.

  • framesi6408 bytes
  • presentsi6488 bytes
  • damagei64168 bytes
  • desktopi64248 bytes
  • page_flipsi64328 bytes
  • frames_on_the_shown_pagei64408 bytes

Text wire form

A wire form of the module contract: one word of a call. The address of a slice record {address, count} of UTF-8 bytes.

Integer wire form

A wire form of the module contract: one word of a call. A signed integer of 64 bits, in a register.

Gpu_Info record of a module

A record of the module compositor: 56 bytes, aligned on 8 bytes, 0 bytes of padding.

  • presenti6408 bytes
  • attachedi6488 bytes
  • widthi64168 bytes
  • heighti64248 bytes
  • venusi64328 bytes
  • venus_max_versioni64408 bytes
  • presentsi64488 bytes

Window_Grant_Row record of a module

A record of the module compositor: 136 bytes, aligned on 8 bytes, 0 bytes of padding.

  • granti6408 bytes
  • windowText(32)832 bytes
  • resourceText(96)4096 bytes

Assistive_Holder_Row record of a module

A record of the module compositor: 56 bytes, aligned on 8 bytes, 0 bytes of padding.

  • holderi6408 bytes
  • kindText(16)816 bytes
  • nicknameText(32)2432 bytes

Error_Record struct

A struct of the package errors: 56 bytes, aligned on 8 bytes, 0 bytes of padding. The error record: what a call that failed says about why, as seven integers.

  • kindi6408 bytes
  • uniti6488 bytes
  • operationi64168 bytes
  • argumenti64248 bytes
  • valuei64328 bytes
  • limiti64408 bytes
  • foundi64488 bytes

windows procedure of the package compositor

windows :: proc "c" (result: ^[]Window, error: ^errors.) -> i64

windows gives one row for each window, the front one first: its title, its place and its size with the frame, its order from the front, whether it has the focus, and whether the keys go to it.

src/modules/system/compositor/exports.odin:254

page_flips global variable of the package compositor

page_flips: u64

The page flips since the start.

src/modules/system/compositor/main.odin:320

frames_on_the_shown_page global variable of the package compositor

frames_on_the_shown_page: u64

The frames written into the screen page that the display showed.

src/modules/system/compositor/main.odin:321

processes procedure of the package monitor

processes :: proc "c" (result: ^[]Process, error: ^errors.) -> i64

processes gives one row for each process that runs, from the reports of the kernel: its slot, its name, its state, the stop cause of a stopped process and the stop outcome of a process that stopped itself, its resident pages (the mapped pages with a page frame) and its mapped pages, its handles, threads, processor time in milliseconds, kernel entries, the time of its start in microseconds, and the hash of the file of a disk process.

src/modules/system/monitor/exports.odin:121

pointer procedure of the package compositor

pointer :: proc "c" (result: ^[]Pointer, error: ^errors.) -> i64

pointer gives the place of the pointer on the screen, its buttons, the menu of the bar that is open, the state of the palette, and the name of the pointer shape, as one row.

src/modules/system/compositor/exports.odin:180

Window_Grant_Row type of the package compositor

Window_Grant_Row :: struct {...}

One row for each requested grant that holds: window_grants().

src/modules/system/compositor/exports.odin:89

Pointer_Shape type of the package pointer_pictures

Pointer_Shape :: enum u32 {...}

The pointer shapes of the system.

src/library/modus/contract/pointer_pictures/pointer_pictures.odin:57