Mir
mir_surface.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012-2014 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 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_SURFACE_H_
19 #define MIR_TOOLKIT_MIR_SURFACE_H_
20 
23 #include <mir_toolkit/common.h>
25 
26 #include <stdbool.h>
27 
28 #ifdef __cplusplus
29 
33 extern "C" {
34 #endif
35 
49  int width,
50  int height,
51  MirPixelFormat format);
52 
80  int width,
81  int height,
82  MirPixelFormat format,
83  MirSurface* parent,
84  MirRectangle* rect,
85  MirEdgeAttachment edge);
86 
112  int width,
113  int height,
114  MirPixelFormat format,
115  MirSurface* parent,
116  MirRectangle* zone);
117 
142  int width,
143  int height,
144  MirPixelFormat format,
145  MirSurface* parent);
146 
166  int width,
167  int height,
168  MirPixelFormat format);
169 
183 
195 
208 MirWaitHandle* mir_surface_create(MirSurfaceSpec* requested_specification,
209  mir_surface_callback callback, void* context);
210 
217 MirSurface* mir_surface_create_sync(MirSurfaceSpec* requested_specification);
218 
226 
245 
257 void mir_surface_spec_set_name(MirSurfaceSpec* spec, char const* name);
258 
268 void mir_surface_spec_set_width(MirSurfaceSpec* spec, unsigned width);
269 
280 
292 void mir_surface_spec_set_width_increment(MirSurfaceSpec* spec, unsigned width_inc);
293 
305 void mir_surface_spec_set_height_increment(MirSurfaceSpec* spec, unsigned height_inc);
306 
316 void mir_surface_spec_set_min_width(MirSurfaceSpec* spec, unsigned min_width);
317 
327 void mir_surface_spec_set_min_height(MirSurfaceSpec* spec, unsigned min_height);
337 void mir_surface_spec_set_max_width(MirSurfaceSpec* spec, unsigned max_width);
338 
348 void mir_surface_spec_set_max_height(MirSurfaceSpec* spec, unsigned max_height);
349 
361 void mir_surface_spec_set_min_aspect_ratio(MirSurfaceSpec* spec, unsigned width, unsigned height);
362 
374 void mir_surface_spec_set_max_aspect_ratio(MirSurfaceSpec* spec, unsigned width, unsigned height);
375 
386 
397 
406 void mir_surface_spec_set_fullscreen_on_output(MirSurfaceSpec* spec, uint32_t output_id);
407 
417 
438  MirPersistentId* parent,
439  MirRectangle* attachment_rect,
440  MirEdgeAttachment edge);
441 
451 
458 
478  MirBufferStreamInfo* streams,
479  unsigned int num_streams);
480 
494  MirRectangle const *rectangles,
495  size_t n_rects);
496 
498  MirSurfaceSpec* spec,
500  void* context);
501 
515  void* context);
516 
524 
531 bool mir_surface_is_valid(MirSurface *surface);
532 
542 char const *mir_surface_get_error_message(MirSurface *surface);
543 
551 
565  MirSurface *surface,
566  mir_surface_callback callback,
567  void *context);
568 
574 void mir_surface_release_sync(MirSurface *surface);
575 
582 
590  MirSurfaceState state);
591 
598 
609 MirWaitHandle* mir_surface_set_swapinterval(MirSurface* surface, int interval);
610 
619 
625 int mir_surface_get_dpi(MirSurface* surface);
626 
633 
640 
652 
659 
669 
676 
689  int width,
690  int height,
691  MirPixelFormat format);
692 
700 void mir_surface_apply_spec(MirSurface* surface, MirSurfaceSpec* spec);
701 
716 
724 
733 
741 
751 
757 MirPersistentId* mir_persistent_id_from_string(char const* string_representation);
758 
759 #ifdef __cplusplus
760 }
762 #endif
763 
764 #endif /* MIR_TOOLKIT_MIR_SURFACE_H_ */
void mir_surface_spec_release(MirSurfaceSpec *spec)
Release the resources held by a MirSurfaceSpec.
Definition: mir_surface_api.cpp:229
Definition: mir_surface.h:77
void mir_surface_spec_set_type(MirSurfaceSpec *spec, MirSurfaceType type)
Update a surface specification with a surface type.
Definition: mir_surface_api.cpp:581
Definition: mir_surface.h:136
void mir_surface_spec_set_max_aspect_ratio(MirSurfaceSpec *spec, unsigned width, unsigned height)
Set the maximum aspect ratio.
Definition: mir_surface_api.cpp:621
struct MirBufferStream MirBufferStream
Definition: client_types.h:45
void(* mir_surface_id_callback)(MirSurface *surface, MirPersistentId *id, void *context)
Definition: client_types.h:139
void mir_surface_spec_set_height_increment(MirSurfaceSpec *spec, unsigned height_inc)
Set the requested height increment, in pixels Defines an arithmetic progression of sizes starting wit...
Definition: mir_surface_api.cpp:601
void(* mir_surface_event_callback)(MirSurface *surface, MirEvent const *event, void *context)
Callback for handling of surface events.
Definition: client_types.h:92
Definition: mir_wait_handle.h:31
void mir_surface_spec_set_min_aspect_ratio(MirSurfaceSpec *spec, unsigned width, unsigned height)
Set the minimum aspect ratio.
Definition: mir_surface_api.cpp:611
MirSurfaceType mir_surface_get_type(MirSurface *surface)
Get the type (purpose) of a surface.
Definition: mir_surface_api.cpp:278
MirWaitHandle * mir_surface_set_preferred_orientation(MirSurface *surface, MirOrientationMode orientation)
Request to set the preferred orientations of a surface.
Definition: mir_surface_api.cpp:473
MirPersistentId * mir_persistent_id_from_string(char const *string_representation)
Deserialise a string representation of a MirSurfaceId.
Definition: mir_surface_api.cpp:693
MirSurfaceSpec * mir_connection_create_spec_for_changes(MirConnection *connection)
Create a surface specification for updating a surface.
Definition: mir_surface_api.cpp:515
void mir_surface_spec_set_min_width(MirSurfaceSpec *spec, unsigned min_width)
Set the minimum width, in pixels.
Definition: mir_surface_api.cpp:176
void mir_surface_spec_set_buffer_usage(MirSurfaceSpec *spec, MirBufferUsage usage)
Set the requested buffer usage.
Definition: mir_surface_api.cpp:201
MirWaitHandle * mir_surface_set_state(MirSurface *surface, MirSurfaceState state)
Change the state of a surface.
Definition: mir_surface_api.cpp:294
bool mir_persistent_id_is_valid(MirPersistentId *id)
Check the validity of a MirPersistentId.
Definition: mir_surface_api.cpp:658
The displacement from the top-left corner of the surface.
Definition: client_types.h:300
char const * mir_surface_get_error_message(MirSurface *surface)
Retrieve a text description of the error.
Definition: mir_surface_api.cpp:246
void mir_surface_release_sync(MirSurface *surface)
Release the specified surface like in mir_surface_release(), but also wait for the operation to compl...
Definition: mir_surface_api.cpp:271
MirSurfaceFocusState mir_surface_get_focus(MirSurface *surface)
Query the focus state for a surface.
Definition: mir_surface_api.cpp:400
char const * mir_persistent_id_as_string(MirPersistentId *id)
Get a string representation of a MirSurfaceId.
Definition: mir_surface_api.cpp:688
void mir_surface_spec_set_pixel_format(MirSurfaceSpec *spec, MirPixelFormat format)
Set the requested pixel format.
Definition: mir_surface_api.cpp:196
MirWaitHandle * mir_surface_set_swapinterval(MirSurface *surface, int interval)
Set the swapinterval for mir_surface_swap_buffers.
Definition: mir_surface_api.cpp:340
MirSurfaceSpec * mir_connection_create_spec_for_tooltip(MirConnection *connection, int width, int height, MirPixelFormat format, MirSurface *parent, MirRectangle *zone)
Create a surface specification for a tooltip surface.
Definition: mir_surface_api.cpp:76
MirWaitHandle * mir_surface_configure_cursor(MirSurface *surface, MirCursorConfiguration const *parameters)
Choose the cursor state for a surface: whether a cursor is shown, and which cursor if so...
Definition: mir_surface_api.cpp:438
bool mir_surface_spec_attach_to_foreign_parent(MirSurfaceSpec *spec, MirPersistentId *parent, MirRectangle *attachment_rect, MirEdgeAttachment edge)
Request that the created surface be attached to a surface of a different client.
Definition: mir_surface_api.cpp:668
MirSurfaceVisibility mir_surface_get_visibility(MirSurface *surface)
Query the visibility state for a surface.
Definition: mir_surface_api.cpp:419
MirSurfaceState mir_surface_get_state(MirSurface *surface)
Get the current state of a surface.
Definition: mir_surface_api.cpp:307
MirSurfaceSpec * mir_connection_create_spec_for_modal_dialog(MirConnection *connection, int width, int height, MirPixelFormat format, MirSurface *parent)
Create a surface specification for a modal dialog surface.
Definition: mir_surface_api.cpp:113
int mir_surface_get_swapinterval(MirSurface *surface)
Query the swapinterval that the surface is operating with.
Definition: mir_surface_api.cpp:361
MirOrientation
Direction relative to the "natural" orientation of the display.
Definition: common.h:164
MirWaitHandle * mir_surface_release(MirSurface *surface, mir_surface_callback callback, void *context)
Release the supplied surface and any associated buffer.
Definition: mir_surface_api.cpp:256
void mir_surface_spec_set_height(MirSurfaceSpec *spec, unsigned height)
Set the requested height, in pixels.
Definition: mir_surface_api.cpp:171
void mir_surface_spec_set_max_height(MirSurfaceSpec *spec, unsigned max_height)
Set the maximum height, in pixels.
Definition: mir_surface_api.cpp:191
void mir_persistent_id_release(MirPersistentId *id)
Free a MirPersistentId.
Definition: mir_surface_api.cpp:663
Definition: mir_surface.h:125
void mir_surface_spec_set_parent(MirSurfaceSpec *spec, MirSurface *parent)
Set the requested parent.
Definition: mir_surface_api.cpp:570
unsigned int width
Definition: black_arrow.c:4
MirWaitHandle * mir_surface_request_persistent_id(MirSurface *surface, mir_surface_id_callback callback, void *context)
Request an ID for the surface that can be shared cross-process and across restarts.
Definition: mir_surface_api.cpp:631
MirSurfaceState
Definition: common.h:64
void mir_surface_spec_set_input_shape(MirSurfaceSpec *spec, MirRectangle const *rectangles, size_t n_rects)
Set a collection of input rectangles assosciated with the spec.
Definition: mir_surface_api.cpp:552
void mir_surface_spec_set_event_handler(MirSurfaceSpec *spec, mir_surface_event_callback callback, void *context)
Definition: mir_surface_api.cpp:222
void mir_surface_spec_set_width(MirSurfaceSpec *spec, unsigned width)
Set the requested width, in pixels.
Definition: mir_surface_api.cpp:166
bool mir_surface_is_valid(MirSurface *surface)
Test for a valid surface.
Definition: mir_surface_api.cpp:241
void mir_surface_spec_set_fullscreen_on_output(MirSurfaceSpec *spec, uint32_t output_id)
Definition: mir_surface_api.cpp:211
void mir_surface_spec_set_width_increment(MirSurfaceSpec *spec, unsigned width_inc)
Set the requested width increment, in pixels.
Definition: mir_surface_api.cpp:591
MirBufferStream * mir_surface_get_buffer_stream(MirSurface *surface)
Retrieve the primary MirBufferStream associated with a surface (to advance buffers, obtain EGLNativeWindow, etc...)
Definition: mir_surface_api.cpp:490
MirBufferUsage
MirBufferUsage specifies how a surface can and will be used.
Definition: client_types.h:147
MirSurfaceType
Definition: common.h:48
void mir_surface_spec_set_state(MirSurfaceSpec *spec, MirSurfaceState state)
Set the requested state.
Definition: mir_surface_api.cpp:206
int mir_surface_get_dpi(MirSurface *surface)
Query the DPI value of the surface (dots per inch).
Definition: mir_surface_api.cpp:381
MirPixelFormat
32-bit pixel formats (8888): The order of components in the enum matches the order of the components ...
Definition: common.h:134
void(* mir_surface_callback)(MirSurface *surface, void *client_context)
Callback to be passed when calling:
Definition: client_types.h:75
Definition: cursor_configuration.h:34
MirSurfaceFocusState
Definition: common.h:82
MirSurfaceVisibility
Definition: common.h:88
void mir_surface_spec_set_max_width(MirSurfaceSpec *spec, unsigned max_width)
Set the maximum width, in pixels.
Definition: mir_surface_api.cpp:186
MirSurfaceSpec * mir_connection_create_spec_for_input_method(MirConnection *connection, int width, int height, MirPixelFormat format)
Create a surface specification for an input method surface.
Definition: mir_surface_api.cpp:103
MirOrientationMode mir_surface_get_preferred_orientation(MirSurface *surface)
Get the preferred orientation modes of a surface.
Definition: mir_surface_api.cpp:455
unsigned int height
Definition: black_arrow.c:5
void mir_surface_spec_set_preferred_orientation(MirSurfaceSpec *spec, MirOrientationMode mode)
Set the requested preferred orientation mode.
Definition: mir_surface_api.cpp:217
MirSurfaceSpec * mir_connection_create_spec_for_menu(MirConnection *connection, int width, int height, MirPixelFormat format, MirSurface *parent, MirRectangle *rect, MirEdgeAttachment edge)
Create a surface specification for a menu surface.
Definition: mir_surface_api.cpp:57
MirSurfaceSpec * mir_create_surface_spec(MirConnection *connection)
Create a surface specification.
Definition: mir_surface_api.cpp:501
void mir_surface_spec_set_streams(MirSurfaceSpec *spec, MirBufferStreamInfo *streams, unsigned int num_streams)
Set the streams associated with the spec.
Definition: mir_surface_api.cpp:534
Definition: mir_connection.h:88
void mir_surface_get_parameters(MirSurface *surface, MirSurfaceParameters *parameters)
Get a surface's parameters.
Definition: mir_surface_api.cpp:251
Definition: client_types.h:307
MirSurfaceSpec * mir_connection_create_spec_for_dialog(MirConnection *connection, int width, int height, MirPixelFormat format)
Create a surface specification for a parentless dialog surface.
Definition: mir_surface_api.cpp:93
MirOrientation mir_surface_get_orientation(MirSurface *surface)
Get the orientation of a surface.
Definition: mir_surface_api.cpp:335
MirSurface * mir_surface_create_sync(MirSurfaceSpec *requested_specification)
Create a surface from a given specification and wait for the result.
Definition: mir_surface_api.cpp:128
MirOrientationMode
Definition: common.h:172
MirSurfaceSpec * mir_connection_create_spec_for_normal_surface(MirConnection *connection, int width, int height, MirPixelFormat format)
Create a surface specification for a normal surface.
Definition: mir_surface_api.cpp:48
MirPersistentId * mir_surface_request_persistent_id_sync(MirSurface *surface)
Request a persistent ID for a surface and wait for the result.
Definition: mir_surface_api.cpp:647
void mir_surface_apply_spec(MirSurface *surface, MirSurfaceSpec *spec)
Request changes to the specification of a surface.
Definition: mir_surface_api.cpp:520
MirWaitHandle * mir_surface_create(MirSurfaceSpec *requested_specification, mir_surface_callback callback, void *context)
Create a surface from a given specification.
Definition: mir_surface_api.cpp:139
void mir_surface_set_event_handler(MirSurface *surface, mir_surface_event_callback callback, void *context)
Set the event handler to be called when events arrive for a surface.
Definition: mir_surface_api.cpp:235
void mir_surface_spec_set_min_height(MirSurfaceSpec *spec, unsigned min_height)
Set the minimum height, in pixels.
Definition: mir_surface_api.cpp:181
void mir_surface_spec_set_name(MirSurfaceSpec *spec, char const *name)
Set the requested name.
Definition: mir_surface_api.cpp:161
MirSurfaceParameters is the structure of minimum required information that you must provide to Mir in...
Definition: client_types.h:157
MirEdgeAttachment
Definition: common.h:186

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Oct 8 16:20:16 UTC 2015