Mir
mir_window.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2017 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License version 2 or 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  */
17 
18 #ifndef MIR_TOOLKIT_MIR_WINDOW_H_
19 #define MIR_TOOLKIT_MIR_WINDOW_H_
20 
23 #include <mir_toolkit/common.h>
26 
27 #include <stdbool.h>
28 
29 #ifdef __cplusplus
30 
34 extern "C" {
35 #endif
36 
50  int width, int height);
51 
78  int width, int height,
79  MirWindow* parent,
80  MirRectangle* rect,
81  MirEdgeAttachment edge);
82 
109  int width, int height,
110  MirWindow* parent,
111  MirRectangle* rect,
112  MirEdgeAttachment edge);
113 
137  int width, int height,
138  MirWindow* parent);
139 
157  int width, int height);
158 
171  int width, int height);
172 
183 
195 
206 
217 
230 
240 
248 
267 
279 void mir_window_spec_set_name(MirWindowSpec* spec, char const* name);
280 
290 void mir_window_spec_set_width(MirWindowSpec* spec, unsigned width);
291 
301 void mir_window_spec_set_height(MirWindowSpec* spec, unsigned height);
302 
314 void mir_window_spec_set_width_increment(MirWindowSpec* spec, unsigned width_inc);
315 
327 void mir_window_spec_set_height_increment(MirWindowSpec* spec, unsigned height_inc);
328 
338 void mir_window_spec_set_min_width(MirWindowSpec* spec, unsigned min_width);
339 
349 void mir_window_spec_set_min_height(MirWindowSpec* spec, unsigned min_height);
350 
360 void mir_window_spec_set_max_width(MirWindowSpec* spec, unsigned max_width);
361 
371 void mir_window_spec_set_max_height(MirWindowSpec* spec, unsigned max_height);
372 
384 void mir_window_spec_set_min_aspect_ratio(MirWindowSpec* spec, unsigned width, unsigned height);
385 
397 void mir_window_spec_set_max_aspect_ratio(MirWindowSpec* spec, unsigned width, unsigned height);
398 
408 
418 
439  MirWindowId* parent,
440  MirRectangle* attachment_rect,
441  MirEdgeAttachment edge);
442 
452 
466  MirRectangle const *rectangles,
467  size_t n_rects);
468 
481  MirWindowEventCallback callback,
482  void* context);
483 
492 
502 
527  const MirRectangle* rect,
528  MirPlacementGravity rect_gravity,
529  MirPlacementGravity window_gravity,
530  MirPlacementHints placement_hints,
531  int offset_dx,
532  int offset_dy);
533 
539 void mir_window_spec_set_cursor_name(MirWindowSpec* spec, char const* name);
540 
556 MIR_FOR_REMOVAL_IN_VERSION_1("Use mir_connection_allocate_buffer/mir_render_surface_get_buffer_stream instead");
557 
570 #pragma GCC diagnostic push
571 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
573 MIR_FOR_REMOVAL_IN_VERSION_1("No longer applicable, use mir_render_surface apis");
574 #pragma GCC diagnostic pop
575 
596  MirBufferStreamInfo* streams,
597  unsigned int num_streams)
598 MIR_FOR_REMOVAL_IN_VERSION_1("Use mir_window_spec_add_render_surface instead");
599 
606 
614 void mir_window_apply_spec(MirWindow* window, MirWindowSpec* spec);
615 
627 void mir_create_window(MirWindowSpec* requested_specification,
628  MirWindowCallback callback, void* context);
629 
636 MirWindow* mir_create_window_sync(MirWindowSpec* requested_specification);
637 
649 void mir_window_release(
650  MirWindow* window,
651  MirWindowCallback callback,
652  void *context);
653 
659 void mir_window_release_sync(MirWindow* window);
660 
667 bool mir_window_is_valid(MirWindow* window);
668 
681  MirWindowEventCallback callback,
682  void* context);
683 
698 MIR_FOR_REMOVAL_IN_VERSION_1("Use mir_window_spec_add_render_surface during window creation/modification instead");
708 char const* mir_window_get_error_message(MirWindow* window);
709 
717 #pragma GCC diagnostic push
718 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
719 void mir_window_get_parameters(MirWindow* window, MirWindowParameters* parameters)
720 MIR_FOR_REMOVAL_IN_VERSION_1("Use mir_window_get_xxx apis or listen to state/attribute change events instead");
721 #pragma GCC diagnostic pop
722 
723 
730 
738 void mir_window_raise(MirWindow* window, MirCookie const* cookie);
739 
747 void mir_window_request_user_move(MirWindow* window, MirCookie const* cookie);
748 
757 void mir_window_request_user_resize(MirWindow* window, MirResizeEdge edge, MirCookie const* cookie);
758 
765 
771 void mir_window_set_state(MirWindow* window,
772  MirWindowState state);
773 
780 
787 
794 
800 int mir_window_get_dpi(MirWindow* window);
801 
811 #pragma GCC diagnostic push
812 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
813 void mir_window_configure_cursor(MirWindow* window, MirCursorConfiguration const* parameters)
814 MIR_FOR_REMOVAL_IN_VERSION_1("Use mir_window_spec_set_cursor_name/mir_window_spec_set_cursor_render_surface instead");
815 #pragma GCC diagnostic pop
816 
824 
831 
844 void mir_window_request_persistent_id(MirWindow* window, MirWindowIdCallback callback, void* context)
845 MIR_FOR_REMOVAL_IN_VERSION_1("Use mir_window_request_window_id() instead");
846 void mir_window_request_window_id(MirWindow* window, MirWindowIdCallback callback, void* context);
847 
854 MirPersistentId* mir_window_request_persistent_id_sync(MirWindow* window)
855 MIR_FOR_REMOVAL_IN_VERSION_1("Use mir_window_request_window_id_sync");
857 #ifdef __cplusplus
858 }
860 #endif
861 
862 #endif /* MIR_TOOLKIT_MIR_WINDOW_H_ */
void mir_window_set_event_handler(MirWindow *window, MirWindowEventCallback callback, void *context)
Set the event handler to be called when events arrive for a window.
void mir_window_spec_set_min_width(MirWindowSpec *spec, unsigned min_width)
Set the minimum width, in pixels.
struct MirSurface MirWindow
Definition: client_types.h:43
void mir_create_window(MirWindowSpec *requested_specification, MirWindowCallback callback, void *context)
Create a window from a given specification.
MirResizeEdge
Hints for resizing a window.
Definition: common.h:412
struct MirBufferStream MirBufferStream
Definition: client_types.h:49
void mir_window_spec_set_max_aspect_ratio(MirWindowSpec *spec, unsigned width, unsigned height)
Set the maximum aspect ratio.
struct MirPersistentId MirWindowId
Definition: client_types.h:51
void mir_window_spec_set_min_height(MirWindowSpec *spec, unsigned min_height)
Set the minimum height, in pixels.
MirWindowSpec * mir_create_modal_dialog_window_spec(MirConnection *connection, int width, int height, MirWindow *parent)
Create a window specification for a modal dialog window.
void mir_window_spec_set_width_increment(MirWindowSpec *spec, unsigned width_inc)
Set the requested width increment, in pixels.
MirPlacementHints
Positioning hints for aligning a window relative to a rectangle.
Definition: common.h:372
MirWindowSpec * mir_create_menu_window_spec(MirConnection *connection, int width, int height, MirWindow *parent, MirRectangle *rect, MirEdgeAttachment edge)
Create a window specification for a menu window.
void mir_window_spec_set_width(MirWindowSpec *spec, unsigned width)
Set the requested width, in pixels.
void mir_window_spec_set_streams(MirWindowSpec *spec, MirBufferStreamInfo *streams, unsigned int num_streams) MIR_FOR_REMOVAL_IN_VERSION_1("Use mir_window_spec_add_render_surface instead")
Set the streams associated with the spec.
void mir_window_spec_set_cursor_name(MirWindowSpec *spec, char const *name)
Set the name for the cursor from the system cursor theme.
MirWindowType mir_window_get_type(MirWindow *window)
Get the type (purpose) of a window.
MirWindowFocusState
Definition: common.h:164
#define MIR_FOR_REMOVAL_IN_VERSION_1(message)
Definition: deprecations.h:30
MirWindowVisibility
Definition: common.h:176
The displacement from the top-left corner of the surface.
Definition: client_types.h:391
MirPointerConfinementState
Pointer Confinement.
Definition: common.h:469
int mir_window_get_dpi(MirWindow *window)
Query the DPI value of the window (dots per inch).
MirWindowSpec * mir_create_satellite_window_spec(MirConnection *connection, int width, int height, MirWindow *parent)
Create a window specification for a satellite window.
MirOrientationMode mir_window_get_preferred_orientation(MirWindow *window)
Get the preferred orientation modes of a window.
MirPersistentId * mir_window_request_persistent_id_sync(MirWindow *window) MIR_FOR_REMOVAL_IN_VERSION_1("Use mir_window_request_window_id_sync")
Request a persistent ID for a window and wait for the result.
void mir_window_spec_set_max_width(MirWindowSpec *spec, unsigned max_width)
Set the maximum width, in pixels.
MirWindowSpec * mir_create_tip_window_spec(MirConnection *connection, int width, int height, MirWindow *parent, MirRectangle *rect, MirEdgeAttachment edge)
Create a window specification for a tip window.
MirWindowState mir_window_get_state(MirWindow *window)
Get the current state of a window.
int height
Definition: client_types.h:179
void mir_window_spec_set_fullscreen_on_output(MirWindowSpec *spec, uint32_t output_id)
void mir_window_request_window_id(MirWindow *window, MirWindowIdCallback callback, void *context)
MirBufferStream * mir_window_get_buffer_stream(MirWindow *window) MIR_FOR_REMOVAL_IN_VERSION_1("Use mir_window_spec_add_render_surface during window creation/modification instead")
Retrieve the primary MirBufferStream associated with a window (to advance buffers,...
MirOrientation
Direction relative to the "natural" orientation of the display.
Definition: common.h:274
MirWindowSpec * mir_create_window_spec(MirConnection *connection)
Create a window specification.
void(* MirWindowCallback)(MirWindow *window, void *client_context)
Callback to be passed when calling window functions :
Definition: client_types.h:100
void mir_window_spec_set_max_height(MirWindowSpec *spec, unsigned max_height)
Set the maximum height, in pixels.
void mir_window_raise(MirWindow *window, MirCookie const *cookie)
Attempts to raise the window to the front.
MirWindowSpec * mir_create_normal_window_spec(MirConnection *connection, int width, int height)
Create a window specification for a normal window.
bool mir_window_spec_attach_to_foreign_parent(MirWindowSpec *spec, MirWindowId *parent, MirRectangle *attachment_rect, MirEdgeAttachment edge)
Request that the created window be attached to a window of a different client.
void mir_window_request_user_move(MirWindow *window, MirCookie const *cookie)
Informs the window manager that the user is moving the window.
MirWindow * mir_create_window_sync(MirWindowSpec *requested_specification)
Create a window from a given specification and wait for the result.
void mir_window_spec_set_input_shape(MirWindowSpec *spec, MirRectangle const *rectangles, size_t n_rects)
Set a collection of input rectangles associated with the spec.
void mir_window_spec_set_height(MirWindowSpec *spec, unsigned height)
Set the requested height, in pixels.
MirWindowSpec * mir_create_input_method_window_spec(MirConnection *connection, int width, int height)
Create a window specification for an input method window.
MirWindowSpec * mir_create_freestyle_window_spec(MirConnection *connection, int width, int height)
Create a window specification for a freestyle window.
void mir_window_apply_spec(MirWindow *window, MirWindowSpec *spec)
Request changes to the specification of a window.
void mir_window_spec_set_event_handler(MirWindowSpec *spec, MirWindowEventCallback callback, void *context)
Set the event handler to be called when events arrive for a window.
void mir_window_spec_set_type(MirWindowSpec *spec, MirWindowType type)
Update a window specification with a window type.
struct MirConnection MirConnection
Definition: client_types.h:41
void(* MirWindowIdCallback)(MirWindow *window, MirPersistentId *id, void *context)
Definition: client_types.h:176
MirWindowType
Definition: common.h:109
void mir_window_spec_set_pointer_confinement(MirWindowSpec *spec, MirPointerConfinementState state)
Attempts to set the pointer confinement spec for this window.
bool mir_window_is_valid(MirWindow *window)
Test for a valid window.
void mir_window_spec_set_height_increment(MirWindowSpec *spec, unsigned height_inc)
Set the requested height increment, in pixels Defines an arithmetic progression of sizes starting wit...
struct MirCookie MirCookie
Definition: event.h:82
void mir_window_spec_set_state(MirWindowSpec *spec, MirWindowState state)
Set the requested state.
MirBufferUsage
MirBufferUsage specifies how a surface can and will be used.
Definition: client_types.h:185
void mir_window_spec_set_placement(MirWindowSpec *spec, const MirRectangle *rect, MirPlacementGravity rect_gravity, MirPlacementGravity window_gravity, MirPlacementHints placement_hints, int offset_dx, int offset_dy)
Set the window placement on the spec.
MirPixelFormat
32-bit pixel formats (8888): The order of components in the enum matches the order of the components ...
Definition: common.h:244
struct MirSurfaceSpec MirWindowSpec
Definition: client_types.h:45
MirWindowSpec * mir_create_dialog_window_spec(MirConnection *connection, int width, int height)
Create a window specification for a parentless dialog window.
MirConnection * mir_window_get_connection(MirWindow *window)
Retrieve the connection.
MirOrientation mir_window_get_orientation(MirWindow *window)
Get the orientation of a window.
MirWindowFocusState mir_window_get_focus_state(MirWindow *window)
Query the focus state for a window.
void mir_window_spec_release(MirWindowSpec *spec)
Release the resources held by a MirWindowSpec.
void mir_window_set_preferred_orientation(MirWindow *window, MirOrientationMode orientation)
Request to set the preferred orientations of a window.
void mir_window_request_user_resize(MirWindow *window, MirResizeEdge edge, MirCookie const *cookie)
Informs the window manager that the user is resizing the window.
void mir_window_spec_set_min_aspect_ratio(MirWindowSpec *spec, unsigned width, unsigned height)
Set the minimum aspect ratio.
MirShellChrome
Shell chrome.
Definition: common.h:457
void mir_window_spec_set_preferred_orientation(MirWindowSpec *spec, MirOrientationMode mode)
Set the requested preferred orientation mode.
void mir_window_release_sync(MirWindow *window)
Release the specified window like in mir_window_release(), but also wait for the operation to complet...
void(* MirWindowEventCallback)(MirWindow *window, MirEvent const *event, void *context)
Callback for handling of window events.
Definition: client_types.h:120
void mir_window_spec_set_buffer_usage(MirWindowSpec *spec, MirBufferUsage usage) MIR_FOR_REMOVAL_IN_VERSION_1("No longer applicable
char const * name
Definition: client_types.h:177
void mir_window_configure_cursor(MirWindow *window, MirCursorConfiguration const *parameters) MIR_FOR_REMOVAL_IN_VERSION_1("Use mir_window_spec_set_cursor_name/mir_window_spec_set_cursor_render_surface instead")
Choose the cursor state for a window: whether a cursor is shown, and which cursor if so.
MirWindowId * mir_window_request_window_id_sync(MirWindow *window)
void mir_window_spec_set_pixel_format(MirWindowSpec *spec, MirPixelFormat format) MIR_FOR_REMOVAL_IN_VERSION_1("Use mir_connection_allocate_buffer/mir_render_surface_get_buffer_stream instead")
Set the requested pixel format.
void mir_window_release(MirWindow *window, MirWindowCallback callback, void *context)
Release the supplied window and any associated buffer.
Definition: client_types.h:398
void mir_window_spec_set_parent(MirWindowSpec *spec, MirWindow *parent)
Set the requested parent.
MirWindowVisibility mir_window_get_visibility(MirWindow *window)
Query the visibility state for a window.
void mir_window_spec_set_shell_chrome(MirWindowSpec *spec, MirShellChrome style)
Ask the shell to customize "chrome" for this window.
void mir_window_request_persistent_id(MirWindow *window, MirWindowIdCallback callback, void *context) MIR_FOR_REMOVAL_IN_VERSION_1("Use mir_window_request_window_id() instead")
Request an ID for the window that can be shared cross-process and across restarts.
uint32_t output_id
The id of the output to place the surface in.
Definition: client_types.h:194
MirOrientationMode
Definition: common.h:290
MirWindowState
Definition: common.h:141
char const * mir_window_get_error_message(MirWindow *window)
Retrieve a text description of the error.
MirWindowSpec * mir_create_utility_window_spec(MirConnection *connection, int width, int height)
Create a window specification for a utility window.
void mir_window_get_parameters(MirWindow *window, MirWindowParameters *parameters) MIR_FOR_REMOVAL_IN_VERSION_1("Use mir_window_get_xxx apis or listen to state/attribute change events instead")
Get a window's parameters.
void use mir_render_surface apis
Definition: mir_window.h:573
int width
Definition: client_types.h:178
void mir_window_spec_set_name(MirWindowSpec *spec, char const *name)
Set the requested name.
MirWindowSpec * mir_create_gloss_window_spec(MirConnection *connection, int width, int height)
Create a window specification for a gloss window.
void mir_window_set_state(MirWindow *window, MirWindowState state)
Change the state of a window.
MirPlacementGravity
Reference point for aligning a surface relative to a rectangle.
Definition: common.h:317
MirEdgeAttachment
Definition: common.h:304
MirPixelFormat the EGL implementation will now set correct pixel format
Definition: mir_connection.h:350

Copyright © 2012-2019 Canonical Ltd.
Generated on Wed Aug 28 00:46:47 UTC 2019
This documentation is licensed under the GPL version 2 or 3.