Mir
mir_surface.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012-2016 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 
113  int width,
114  int height,
115  MirPixelFormat format,
116  MirSurface* parent,
117  MirRectangle* zone)
118  __attribute__((deprecated));
119 
147  int width,
148  int height,
149  MirPixelFormat format,
150  MirSurface* parent,
151  MirRectangle* rect,
152  MirEdgeAttachment edge);
153 
178  int width,
179  int height,
180  MirPixelFormat format,
181  MirSurface* parent);
182 
202  int width,
203  int height,
204  MirPixelFormat format);
205 
219 
231 
244 MirWaitHandle* mir_surface_create(MirSurfaceSpec* requested_specification,
245  mir_surface_callback callback, void* context);
246 
253 MirSurface* mir_surface_create_sync(MirSurfaceSpec* requested_specification);
254 
262 
281 
293 void mir_surface_spec_set_name(MirSurfaceSpec* spec, char const* name);
294 
304 void mir_surface_spec_set_width(MirSurfaceSpec* spec, unsigned width);
305 
316 
328 void mir_surface_spec_set_width_increment(MirSurfaceSpec* spec, unsigned width_inc);
329 
341 void mir_surface_spec_set_height_increment(MirSurfaceSpec* spec, unsigned height_inc);
342 
352 void mir_surface_spec_set_min_width(MirSurfaceSpec* spec, unsigned min_width);
353 
363 void mir_surface_spec_set_min_height(MirSurfaceSpec* spec, unsigned min_height);
373 void mir_surface_spec_set_max_width(MirSurfaceSpec* spec, unsigned max_width);
374 
384 void mir_surface_spec_set_max_height(MirSurfaceSpec* spec, unsigned max_height);
385 
397 void mir_surface_spec_set_min_aspect_ratio(MirSurfaceSpec* spec, unsigned width, unsigned height);
398 
410 void mir_surface_spec_set_max_aspect_ratio(MirSurfaceSpec* spec, unsigned width, unsigned height);
411 
422 
433 
442 void mir_surface_spec_set_fullscreen_on_output(MirSurfaceSpec* spec, uint32_t output_id);
443 
453 
474  MirPersistentId* parent,
475  MirRectangle* attachment_rect,
476  MirEdgeAttachment edge);
477 
487 
494 
514  MirBufferStreamInfo* streams,
515  unsigned int num_streams);
516 
530  MirRectangle const *rectangles,
531  size_t n_rects);
532 
545  MirSurfaceSpec* spec,
547  void* context);
548 
549 
558 
568 
593  MirSurfaceSpec* spec,
594  const MirRectangle* rect,
595  MirPlacementGravity rect_gravity,
596  MirPlacementGravity surface_gravity,
597  MirPlacementHints placement_hints,
598  int offset_dx,
599  int offset_dy);
600 
614  void* context);
615 
630 
637 bool mir_surface_is_valid(MirSurface *surface);
638 
648 char const *mir_surface_get_error_message(MirSurface *surface);
649 
657 
671  MirSurface *surface,
672  mir_surface_callback callback,
673  void *context);
674 
680 void mir_surface_release_sync(MirSurface *surface);
681 
688 
696  MirSurfaceState state);
697 
704 
719 MirWaitHandle* mir_surface_set_swapinterval(MirSurface* surface, int interval);
720 
730 
736 int mir_surface_get_dpi(MirSurface* surface);
737 
744 
751 
763 
770 
780 
787 
800  int width,
801  int height,
802  MirPixelFormat format);
803 
811 void mir_surface_apply_spec(MirSurface* surface, MirSurfaceSpec* spec);
812 
827 
835 
844 
852 
862 
868 MirPersistentId* mir_persistent_id_from_string(char const* string_representation);
869 
877 void mir_surface_raise(MirSurface* surface, MirCookie const* cookie);
878 
879 #ifdef __cplusplus
880 }
882 #endif
883 
884 #endif /* MIR_TOOLKIT_MIR_SURFACE_H_ */
void mir_surface_spec_release(MirSurfaceSpec *spec)
Release the resources held by a MirSurfaceSpec.
void mir_surface_spec_set_type(MirSurfaceSpec *spec, MirSurfaceType type)
Update a surface specification with a surface type.
void mir_surface_spec_set_max_aspect_ratio(MirSurfaceSpec *spec, unsigned width, unsigned height)
Set the maximum aspect ratio.
struct MirBufferStream MirBufferStream
Definition: client_types.h:46
void(* mir_surface_id_callback)(MirSurface *surface, MirPersistentId *id, void *context)
Definition: client_types.h:151
struct MirCursorConfiguration MirCursorConfiguration
Opaque structure containing cursor parameterization.
Definition: mir_cursor_configuration.h:28
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...
void mir_surface_spec_set_min_aspect_ratio(MirSurfaceSpec *spec, unsigned width, unsigned height)
Set the minimum aspect ratio.
MirSurfaceType mir_surface_get_type(MirSurface *surface)
Get the type (purpose) of a surface.
MirWaitHandle * mir_surface_set_preferred_orientation(MirSurface *surface, MirOrientationMode orientation)
Request to set the preferred orientations of a surface.
MirSurfaceSpec * mir_connection_create_spec_for_tooltip(MirConnection *connection, int width, int height, MirPixelFormat format, MirSurface *parent, MirRectangle *zone) __attribute__((deprecated))
Create a surface specification for a tooltip surface.
MirPlacementHints
Positioning hints for aligning a window relative to a rectangle.
Definition: common.h:284
MirPersistentId * mir_persistent_id_from_string(char const *string_representation)
Deserialise a string representation of a MirSurfaceId.
MirSurfaceSpec * mir_connection_create_spec_for_changes(MirConnection *connection)
Create a surface specification for updating a surface.
void mir_surface_spec_set_shell_chrome(MirSurfaceSpec *spec, MirShellChrome style)
Ask the shell to customize "chrome" for this surface.
void(* mir_surface_event_callback)(MirSurface *surface, MirEvent const *event, void *context)
Callback for handling of surface events.
Definition: client_types.h:104
void mir_surface_spec_set_min_width(MirSurfaceSpec *spec, unsigned min_width)
Set the minimum width, in pixels.
void mir_surface_spec_set_buffer_usage(MirSurfaceSpec *spec, MirBufferUsage usage)
Set the requested buffer usage.
MirWaitHandle * mir_surface_set_state(MirSurface *surface, MirSurfaceState state)
Change the state of a surface.
bool mir_persistent_id_is_valid(MirPersistentId *id)
Check the validity of a MirPersistentId.
The displacement from the top-left corner of the surface.
Definition: client_types.h:346
MirPointerConfinementState
Pointer Confinement.
Definition: common.h:359
char const * mir_surface_get_error_message(MirSurface *surface)
Retrieve a text description of the error.
void mir_surface_release_sync(MirSurface *surface)
Release the specified surface like in mir_surface_release(), but also wait for the operation to compl...
MirSurfaceFocusState mir_surface_get_focus(MirSurface *surface)
Query the focus state for a surface.
char const * mir_persistent_id_as_string(MirPersistentId *id)
Get a string representation of a MirSurfaceId.
void mir_surface_raise(MirSurface *surface, MirCookie const *cookie)
Attempts to raise the surface to the front.
void mir_surface_spec_set_pixel_format(MirSurfaceSpec *spec, MirPixelFormat format)
Set the requested pixel format.
MirWaitHandle * mir_surface_set_swapinterval(MirSurface *surface, int interval)
Set the swapinterval for the default stream.
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...
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.
MirSurfaceVisibility mir_surface_get_visibility(MirSurface *surface)
Query the visibility state for a surface.
unsigned int height
Definition: mir_image.h:27
MirSurfaceState mir_surface_get_state(MirSurface *surface)
Get the current state of a surface.
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.
int mir_surface_get_swapinterval(MirSurface *surface)
Query the swapinterval that the surface is operating with.
MirOrientation
Direction relative to the "natural" orientation of the display.
Definition: common.h:186
MirWaitHandle * mir_surface_release(MirSurface *surface, mir_surface_callback callback, void *context)
Release the supplied surface and any associated buffer.
void mir_surface_spec_set_height(MirSurfaceSpec *spec, unsigned height)
Set the requested height, in pixels.
struct MirPersistentId MirPersistentId
Definition: client_types.h:47
void mir_surface_spec_set_max_height(MirSurfaceSpec *spec, unsigned max_height)
Set the maximum height, in pixels.
void mir_persistent_id_release(MirPersistentId *id)
Free a MirPersistentId.
unsigned int width
Definition: mir_image.h:26
struct MirWaitHandle MirWaitHandle
Returned by asynchronous functions.
Definition: client_types.h:66
struct MirSurface MirSurface
Definition: client_types.h:41
void mir_surface_spec_set_parent(MirSurfaceSpec *spec, MirSurface *parent)
Set the requested parent.
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.
MirSurfaceSpec * mir_connection_create_spec_for_tip(MirConnection *connection, int width, int height, MirPixelFormat format, MirSurface *parent, MirRectangle *rect, MirEdgeAttachment edge)
Create a surface specification for a tip surface.
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.
void mir_surface_spec_set_event_handler(MirSurfaceSpec *spec, mir_surface_event_callback callback, void *context)
Set the event handler to be called when events arrive for a surface.
void mir_surface_spec_set_width(MirSurfaceSpec *spec, unsigned width)
Set the requested width, in pixels.
bool mir_surface_is_valid(MirSurface *surface)
Test for a valid surface.
void mir_surface_spec_set_fullscreen_on_output(MirSurfaceSpec *spec, uint32_t output_id)
struct MirConnection MirConnection
Definition: client_types.h:40
void mir_surface_spec_set_width_increment(MirSurfaceSpec *spec, unsigned width_inc)
Set the requested width increment, in pixels.
struct MirCookie MirCookie
Definition: event.h:65
MirBufferStream * mir_surface_get_buffer_stream(MirSurface *surface)
Retrieve the primary MirBufferStream associated with a surface (to advance buffers, obtain EGLNativeWindow, etc...)
MirBufferUsage
MirBufferUsage specifies how a surface can and will be used.
Definition: client_types.h:159
MirSurfaceType
Definition: common.h:48
void mir_surface_spec_set_state(MirSurfaceSpec *spec, MirSurfaceState state)
Set the requested state.
void mir_surface_spec_set_pointer_confinement(MirSurfaceSpec *spec, MirPointerConfinementState state)
Attempts to set the pointer confinement spec for this surface.
int mir_surface_get_dpi(MirSurface *surface)
Query the DPI value of the surface (dots per inch).
MirPixelFormat
32-bit pixel formats (8888): The order of components in the enum matches the order of the components ...
Definition: common.h:156
void(* mir_surface_callback)(MirSurface *surface, void *client_context)
Callback to be passed when calling:
Definition: client_types.h:87
MirSurfaceFocusState
Definition: common.h:82
struct MirSurfaceSpec MirSurfaceSpec
Definition: client_types.h:42
MirSurfaceVisibility
Definition: common.h:88
void mir_surface_spec_set_max_width(MirSurfaceSpec *spec, unsigned max_width)
Set the maximum width, in pixels.
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.
MirShellChrome
Shell chrome.
Definition: common.h:349
MirOrientationMode mir_surface_get_preferred_orientation(MirSurface *surface)
Get the preferred orientation modes of a surface.
void mir_surface_spec_set_preferred_orientation(MirSurfaceSpec *spec, MirOrientationMode mode)
Set the requested preferred orientation mode.
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.
MirSurfaceSpec * mir_create_surface_spec(MirConnection *connection)
Create a surface specification.
void mir_surface_spec_set_streams(MirSurfaceSpec *spec, MirBufferStreamInfo *streams, unsigned int num_streams)
Set the streams associated with the spec.
void mir_surface_get_parameters(MirSurface *surface, MirSurfaceParameters *parameters)
Get a surface&#39;s parameters.
Definition: client_types.h:353
MirSurfaceSpec * mir_connection_create_spec_for_dialog(MirConnection *connection, int width, int height, MirPixelFormat format)
Create a surface specification for a parentless dialog surface.
MirOrientation mir_surface_get_orientation(MirSurface *surface)
Get the orientation of a surface.
void mir_surface_spec_set_placement(MirSurfaceSpec *spec, const MirRectangle *rect, MirPlacementGravity rect_gravity, MirPlacementGravity surface_gravity, MirPlacementHints placement_hints, int offset_dx, int offset_dy)
Set the surface placement on the spec.
MirSurface * mir_surface_create_sync(MirSurfaceSpec *requested_specification)
Create a surface from a given specification and wait for the result.
MirOrientationMode
Definition: common.h:202
MirSurfaceSpec * mir_connection_create_spec_for_normal_surface(MirConnection *connection, int width, int height, MirPixelFormat format)
Create a surface specification for a normal surface.
MirPersistentId * mir_surface_request_persistent_id_sync(MirSurface *surface)
Request a persistent ID for a surface and wait for the result.
void mir_surface_apply_spec(MirSurface *surface, MirSurfaceSpec *spec)
Request changes to the specification of a surface.
MirWaitHandle * mir_surface_create(MirSurfaceSpec *requested_specification, mir_surface_callback callback, void *context)
Create a surface from a given specification.
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.
void mir_surface_spec_set_min_height(MirSurfaceSpec *spec, unsigned min_height)
Set the minimum height, in pixels.
void mir_surface_spec_set_name(MirSurfaceSpec *spec, char const *name)
Set the requested name.
MirSurfaceParameters is the structure of minimum required information that you must provide to Mir in...
Definition: client_types.h:169
MirPlacementGravity
Reference point for aligning a surface relative to a rectangle.
Definition: common.h:229
MirEdgeAttachment
Definition: common.h:216

Copyright © 2012-2016 Canonical Ltd.
Generated on Sat Dec 3 12:48:59 UTC 2016