#include <screen/screen.h> int screen_create_context( screen_context_t *pctx, int flags );
- A pointer to a screen_context_t where the function can store a handle for the new context.
- The type of context that will be created. The value of type
must be one of the following constants:
- This type allows a process to create its own windows and control some of the window properties. Applications cannot modify windows that were created by other applications and cannot send events outside their process space. Application contexts aren't aware of other top-level windows in the system, neither are they allowed to operate on them. Application contexts are allowed to parent other windows, even if they are created in other contexts in other processes, and are allowed to control those windows.
- This type requests a privileged context that allows a process to modify all windows in the system when new application windows are created or destroyed. The context also receives notifications when applications create new windows, existing application windows are destroyed, or when an application tries to change certain window properties. A process must have an effective user ID of root to create a context of this type successfully.
- This type requests a privileged context that allows a process to send events to any application in the system. This context does not receive notifications when applications create new windows, when applications destroy existing windows, or when an application attempts to change certain window properties. A process must have an effective user ID of root to create a context of this type successfully.
- This type provides access to power management functionality.
The screen_create_context() function tries to establish communication with the composited windowing system resource manager (screen). To do this, the function opens /dev/screen and sends the proper connect sequence. If the call succeeds, memory is allocated to store context state, and the composition manager creates an event queue and associates it with the connecting process. Once connected, you can use the context to create and control windows, get and send events, and query and set state variables.
The connection remains active until you call screen_destroy_context(). Each context has its own event queue, even when several contexts are created in the same process. Permissions are also per context, not per process.
- The function succeeded and created a new context.
- An error occurred (errno is set).