package ocgtk
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054
doc/ocgtk.gdk/Ocgtk_gdk/Gdk/Wrappers/Surface/index.html
Module Wrappers.Surface
type t = [ `surface | `object_ ] Gobject.objval new_toplevel : [ `display | `object_ ] Gobject.obj -> tCreate a new Surface
Translates coordinates between two surfaces.
Note that this only works if @to and @from are popups or transient-for to the same toplevel (directly or indirectly).
val set_opaque_region : t -> Ocgtk_cairo.Cairo.Wrappers.Region.t option -> unitMarks a region of the `GdkSurface` as opaque.
For optimisation purposes, compositing window managers may like to not draw obscured regions of surfaces, or turn off blending during for these regions. With RGB windows with no transparency, this is just the shape of the window, but with ARGB32 windows, the compositor does not know what regions of the window are transparent or not.
This function only works for toplevel surfaces.
GTK will update this property automatically if the @surface background is opaque, as we know where the opaque regions are. If your surface background is not opaque, please update this property in your GtkWidgetClass.css_changed(../gtk4/vfunc.Widget.css_changed.html) handler.
val set_input_region : t -> Ocgtk_cairo.Cairo.Wrappers.Region.t -> unitApply the region to the surface for the purpose of event handling.
Mouse events which happen while the pointer position corresponds to an unset bit in the mask will be passed on the surface below @surface.
An input region is typically used with RGBA surfaces. The alpha channel of the surface defines which pixels are invisible and allows for nicely antialiased borders, and the input region controls where the surface is “clickable”.
Use method@Gdk.Display.supports_input_shapes to find out if a particular backend supports input regions.
val set_device_cursor :
t ->
[ `device | `object_ ] Gobject.obj ->
[ `cursor | `object_ ] Gobject.obj ->
unitSets a specific `GdkCursor` for a given device when it gets inside @surface.
Passing %NULL for the @cursor argument means that @surface will use the cursor of its parent surface. Most surfaces should use this default.
Use ctor@Gdk.Cursor.new_from_name or ctor@Gdk.Cursor.new_from_texture to create the cursor. To make the cursor invisible, use %GDK_BLANK_CURSOR.
val set_cursor : t -> [ `cursor | `object_ ] Gobject.obj option -> unitSets the default mouse pointer for a `GdkSurface`.
Passing %NULL for the @cursor argument means that @surface will use the cursor of its parent surface. Most surfaces should use this default. Note that @cursor must be for the same display as @surface.
Use ctor@Gdk.Cursor.new_from_name or ctor@Gdk.Cursor.new_from_texture to create the cursor. To make the cursor invisible, use %GDK_BLANK_CURSOR.
val request_layout : t -> unitRequest a layout phase from the surface's frame clock.
See method@Gdk.FrameClock.request_phase.
val queue_render : t -> unitForces a signal@Gdk.Surface::render signal emission for @surface to be scheduled.
This function is useful for implementations that track invalid regions on their own.
val is_destroyed : t -> boolCheck to see if a surface is destroyed.
val hide : t -> unitHide the surface.
For toplevel surfaces, withdraws them, so they will no longer be known to the window manager; for all surfaces, unmaps them, so they won’t be displayed. Normally done automatically as part of gtk_widget_hide()(../gtk4/method.Widget.hide.html).
val get_width : t -> intReturns the width of the given @surface.
Surface size is reported in ”application pixels”, not ”device pixels” (see method@Gdk.Surface.get_scale_factor).
val get_scale_factor : t -> intReturns the internal scale factor that maps from surface coordinates to the actual device pixels.
On traditional systems this is 1, but on very high density outputs this can be a higher value (often 2). A higher value means that drawing is automatically scaled up to a higher resolution, so any code doing drawing will automatically look nicer. However, if you are supplying pixel-based data the scale value can be used to determine whether to use a pixel resource with higher resolution data.
The scale factor may change during the lifetime of the surface.
val get_scale : t -> floatReturns the internal scale that maps from surface coordinates to the actual device pixels.
When the scale is bigger than 1, the windowing system prefers to get buffers with a resolution that is bigger than the surface size (e.g. to show the surface on a high-resolution display, or in a magnifier).
Compare with method@Gdk.Surface.get_scale_factor, which returns the next larger integer.
The scale may change during the lifetime of the surface.
val get_mapped : t -> boolChecks whether the surface has been mapped.
A surface is mapped with method@Gdk.Toplevel.present or method@Gdk.Popup.present.
val get_height : t -> intReturns the height of the given @surface.
Surface size is reported in ”application pixels”, not ”device pixels” (see method@Gdk.Surface.get_scale_factor).
val get_frame_clock : t -> [ `frame_clock | `object_ ] Gobject.objGets the frame clock for the surface.
The frame clock for a surface never changes unless the surface is reparented to a new toplevel surface.
val get_display : t -> [ `display | `object_ ] Gobject.objGets the `GdkDisplay` associated with a `GdkSurface`.
val get_device_position :
t ->
[ `device | `object_ ] Gobject.obj ->
bool * float * float * Gdk_enums.modifiertypeObtains the current device position and modifier state.
The position is given in coordinates relative to the upper left corner of @surface.
val get_device_cursor :
t ->
[ `device | `object_ ] Gobject.obj ->
[ `cursor | `object_ ] Gobject.obj optionRetrieves a `GdkCursor` pointer for the @device currently set on the specified `GdkSurface`.
If the return value is %NULL then there is no custom cursor set on the specified surface, and it is using the cursor for its parent surface.
Use method@Gdk.Surface.set_cursor to unset the cursor of the surface.
val get_cursor : t -> [ `cursor | `object_ ] Gobject.obj optionRetrieves a `GdkCursor` pointer for the cursor currently set on the `GdkSurface`.
If the return value is %NULL then there is no custom cursor set on the surface, and it is using the cursor for its parent surface.
Use method@Gdk.Surface.set_cursor to unset the cursor of the surface.
val destroy : t -> unitDestroys the window system resources associated with @surface and decrements @surface's reference count.
The window system resources for all children of @surface are also destroyed, but the children’s reference counts are not decremented.
Note that a surface will not be destroyed automatically when its reference count reaches zero. You must call this function yourself before that happens.
val create_vulkan_context :
t ->
([ `vulkan_context | `draw_context | `object_ ] Gobject.obj, GError.t) resultSets an error and returns %NULL.
val create_similar_surface :
t ->
Ocgtk_cairo.Cairo.content ->
int ->
int ->
Ocgtk_cairo.Cairo.Wrappers.Surface.tCreate a new Cairo surface that is as compatible as possible with the given @surface.
For example the new surface will have the same fallback resolution and font options as @surface. Generally, the new surface will also use the same backend as @surface, unless that is not possible for some reason. The type of the returned surface may be examined with cairo_surface_get_type().
Initially the surface contents are all 0 (transparent if contents have transparency, black otherwise.)
This function always returns a valid pointer, but it will return a pointer to a “nil” surface if @other is already in an error state or any other error occurs.
val create_gl_context :
t ->
([ `gl_context | `draw_context | `object_ ] Gobject.obj, GError.t) resultCreates a new `GdkGLContext` for the `GdkSurface`.
The context is disconnected from any particular surface or surface. If the creation of the `GdkGLContext` failed, @error will be set. Before using the returned `GdkGLContext`, you will need to call method@Gdk.GLContext.make_current or method@Gdk.GLContext.realize.
val create_cairo_context :
t ->
[ `cairo_context | `draw_context | `object_ ] Gobject.objCreates a new `GdkCairoContext` for rendering on @surface.
val beep : t -> unitEmits a short beep associated to @surface.
If the display of @surface does not support per-surface beeps, emits a short beep on the display just as method@Gdk.Display.beep.
val on_enter_monitor :
?after:bool ->
t ->
callback:(monitor:[ `monitor | `object_ ] Gobject.obj -> unit) ->
Gobject.Signal.handler_idval on_event :
?after:bool ->
t ->
callback:(event:[ `event ] Gobject.obj -> bool) ->
Gobject.Signal.handler_idval on_layout :
?after:bool ->
t ->
callback:(width:int -> height:int -> unit) ->
Gobject.Signal.handler_idval on_leave_monitor :
?after:bool ->
t ->
callback:(monitor:[ `monitor | `object_ ] Gobject.obj -> unit) ->
Gobject.Signal.handler_id