XrdWindow

XrdWindow

Functions

Properties

gfloat initial-height-meters Read / Write / Construct
gfloat initial-width-meters Read / Write / Construct
gpointer native Read / Write / Construct
gfloat scale Read / Write / Construct
guint texture-height Read / Write / Construct
guint texture-width Read / Write / Construct
gchar * title Read / Write / Construct Only

Signals

Types and Values

Object Hierarchy

    GInterface
    ╰── XrdWindow

Prerequisites

XrdWindow requires GObject.

Known Implementations

XrdWindow is implemented by XrdOverlayWindow, XrdSceneDesktopCursor, XrdScenePointerTip and XrdSceneWindow.

Includes

#include <xrdesktop.h>

Description

Functions

xrd_window_add_child ()

void
xrd_window_add_child (XrdWindow *self,
                      XrdWindow *child,
                      graphene_point_t *offset_center);

x axis points right, y axis points up.

Parameters

self

The XrdWindow

 

child

An already existing window.

 

offset_center

The offset of the child window's center to the parent window's center in pixels.

 

xrd_window_emit_grab ()

void
xrd_window_emit_grab (XrdWindow *self,
                      XrdGrabEvent *event);

xrd_window_emit_grab_start ()

void
xrd_window_emit_grab_start (XrdWindow *self,
                            XrdControllerIndexEvent *event);

xrd_window_emit_hover ()

void
xrd_window_emit_hover (XrdWindow *self,
                       XrdHoverEvent *event);

xrd_window_emit_hover_end ()

void
xrd_window_emit_hover_end (XrdWindow *self,
                           XrdControllerIndexEvent *event);

xrd_window_emit_hover_start ()

void
xrd_window_emit_hover_start (XrdWindow *self,
                             XrdControllerIndexEvent *event);

xrd_window_emit_release ()

void
xrd_window_emit_release (XrdWindow *self,
                         XrdControllerIndexEvent *event);

xrd_window_close ()

void
xrd_window_close (XrdWindow *self);

Parameters

self

The XrdWindow MUST be called when destroying a window to free its resources.

 

xrd_window_get_transformation ()

gboolean
xrd_window_get_transformation (XrdWindow *self,
                               graphene_matrix_t *mat);

xrd_window_intersects ()

gboolean
xrd_window_intersects (XrdWindow *self,
                       XrdPointer *pointer,
                       graphene_matrix_t *pointer_transformation,
                       graphene_point3d_t *intersection);

Parameters

self

The XrdWindow

 

pointer

The XrdPointer.

 

pointer_transformation

pose of a pointer ray (like a controller).

 

intersection

The intersection point if there is an intersection.

 

Returns

True if there is an intersection, else false.


xrd_window_poll_event ()

void
xrd_window_poll_event (XrdWindow *self);

Must be called periodically to receive events from this window.

Parameters

self

The XrdWindow

 

xrd_window_set_transformation ()

gboolean
xrd_window_set_transformation (XrdWindow *self,
                               graphene_matrix_t *mat);

xrd_window_submit_texture ()

void
xrd_window_submit_texture (XrdWindow *self,
                           GulkanClient *client,
                           GulkanTexture *texture);

Parameters

self

The XrdWindow

 

client

A GulkanClient, for example an OpenVROverlayUploader.

 

texture

A GulkanTexture that is created and owned by the caller. For performance reasons it is a good idea for the caller to reuse this texture.

 

xrd_window_set_color ()

void
xrd_window_set_color (XrdWindow *self,
                      const graphene_vec3_t *color);

xrd_window_set_flip_y ()

void
xrd_window_set_flip_y (XrdWindow *self,
                       gboolean flip_y);

xrd_window_deselect ()

void
xrd_window_deselect (XrdWindow *self);

xrd_window_end_selection ()

void
xrd_window_end_selection (XrdWindow *self);

xrd_window_get_aspect_ratio ()

float
xrd_window_get_aspect_ratio (XrdWindow *self);

xrd_window_get_current_height_meters ()

float
xrd_window_get_current_height_meters (XrdWindow *self);

Parameters

self

The XrdWindow

 

Returns

The current world space height of the window in meters.


xrd_window_get_current_ppm ()

float
xrd_window_get_current_ppm (XrdWindow *self);

xrd_window_get_current_width_meters ()

float
xrd_window_get_current_width_meters (XrdWindow *self);

Parameters

self

The XrdWindow

 

Returns

The current world space width of the window in meters.


xrd_window_get_data ()

XrdWindowData *
xrd_window_get_data (XrdWindow *self);

xrd_window_get_initial_ppm ()

float
xrd_window_get_initial_ppm (XrdWindow *self);

xrd_window_get_intersection_2d ()

void
xrd_window_get_intersection_2d (XrdWindow *self,
                                graphene_point3d_t *intersection_3d,
                                graphene_point_t *intersection_2d);

Calculates the offset of the intersection relative to the overlay's center, in overlay-relative coordinates, in meters

Parameters

self

The XrdWindow

 

intersection_3d

A graphene_point3d_t intersection point in meters.

 

intersection_2d

Intersection in window coordinates with origin at center in meters.

 

xrd_window_get_intersection_2d_pixels ()

void
xrd_window_get_intersection_2d_pixels (XrdWindow *self,
                                       graphene_point3d_t *intersection_3d,
                                       graphene_point_t *intersection_pixels);

Parameters

self

The XrdWindow

 

intersection_3d

A graphene_point3d_t intersection point in meters.

 

intersection_pixels

Intersection in window coordinates with the origin at top/left in pixels.

 

xrd_window_get_normal ()

void
xrd_window_get_normal (XrdWindow *self,
                       graphene_vec3_t *normal);

xrd_window_get_plane ()

void
xrd_window_get_plane (XrdWindow *self,
                      graphene_plane_t *res);

xrd_window_get_reset_transformation ()

void
xrd_window_get_reset_transformation (XrdWindow *self,
                                     graphene_matrix_t *transform);

xrd_window_get_transformation_no_scale ()

gboolean
xrd_window_get_transformation_no_scale
                               (XrdWindow *self,
                                graphene_matrix_t *mat);

xrd_window_hide ()

void
xrd_window_hide (XrdWindow *self);

xrd_window_is_pinned ()

gboolean
xrd_window_is_pinned (XrdWindow *self);

xrd_window_is_selected ()

gboolean
xrd_window_is_selected (XrdWindow *self);

xrd_window_is_visible ()

gboolean
xrd_window_is_visible (XrdWindow *self);

xrd_window_select ()

void
xrd_window_select (XrdWindow *self);

xrd_window_set_pin ()

void
xrd_window_set_pin (XrdWindow *self,
                    gboolean pinned,
                    gboolean hide_unpinned);

Parameters

self

The XrdWindow

 

pinned

The pin status to set this window to

 

hide_unpinned

If true, the window will be hidden if it is unpinned, and shown if it is pinned. This corresponds to the "show only pinned windows" mode set up in XrdClient. If false, windows are always shown. Note that hide_unpinned only determines initial visibility, and does not keep track of further mode changes.

 

xrd_window_set_reset_transformation ()

void
xrd_window_set_reset_transformation (XrdWindow *self,
                                     graphene_matrix_t *transform);

Parameters

self

The XrdWindow

 

transform

A transformation matrix to save as reset transform.

 

xrd_window_save_reset_transformation ()

void
xrd_window_save_reset_transformation (XrdWindow *self);

Parameters

self

The XrdWindow Saves the current transformation as the reset transformation.

 

xrd_window_show ()

void
xrd_window_show (XrdWindow *self);

xrd_window_update_child ()

void
xrd_window_update_child (XrdWindow *self);

Types and Values

XrdWindow

typedef struct _XrdWindow XrdWindow;

enum XrdWindowFlags

Flags for the window manager.

Members

XRD_WINDOW_HOVERABLE

Set if hover events should be generated.

 

XRD_WINDOW_DRAGGABLE

Set if the window should be draggable.

 

XRD_WINDOW_MANAGED

Set if window should be manipulated by window manager auto alignment.

 

XRD_WINDOW_DESTROY_WITH_PARENT

Set if window should be destroyed with the window manager.

 

XRD_WINDOW_BUTTON

Set if window is a button.

 

struct XrdWindowInterface

struct XrdWindowInterface {
  GTypeInterface parent;

  gboolean
  (*set_transformation) (XrdWindow         *self,
                         graphene_matrix_t *mat);

  gboolean
  (*get_transformation) (XrdWindow         *self,
                         graphene_matrix_t *mat);

  gboolean
  (*get_transformation_no_scale) (XrdWindow         *self,
                                  graphene_matrix_t *mat);

  void
  (*submit_texture) (XrdWindow *self,
                     GulkanClient *client,
                     GulkanTexture *texture);

  void
  (*poll_event) (XrdWindow *self);

  void
  (*emit_grab_start) (XrdWindow *self, XrdControllerIndexEvent *event);

  void
  (*emit_grab) (XrdWindow *self, XrdGrabEvent *event);

  void
  (*emit_release) (XrdWindow *self, XrdControllerIndexEvent *event);

  void
  (*emit_hover_end) (XrdWindow *self, XrdControllerIndexEvent *event);

  void
  (*emit_hover) (XrdWindow *self, XrdHoverEvent *event);

  void
  (*emit_hover_start) (XrdWindow *self, XrdControllerIndexEvent *event);

  void
  (*add_child) (XrdWindow *self, XrdWindow *child,
                graphene_point_t *offset_center);

  void
  (*set_color) (XrdWindow *self, const graphene_vec3_t *color);

  void
  (*set_flip_y) (XrdWindow *self,
                 gboolean flip_y);

  void
  (*show) (XrdWindow *self);

  void
  (*hide) (XrdWindow *self);

  gboolean
  (*is_visible) (XrdWindow *self);

  void
  (*constructed) (GObject *object);

  XrdWindowData*
  (*get_data) (XrdWindow *self);

  guint windows_created;
};

Members

GTypeInterface parent;

parent

 

set_transformation ()

Set a graphene_matrix_t transformation.

 

get_transformation ()

Get a graphene_matrix_t transformation including scale.

 

get_transformation_no_scale ()

Get a graphene_matrix_t transformation without scale.

 

submit_texture ()

Submit a new texture to the window.

 

poll_event ()

Poll events on the window.

 

emit_grab_start ()

Emit an event when the grab action was started.

 

emit_grab ()

Emit a continous event during the grab action.

 

emit_release ()

Emit an event when the grab action was finished.

 

emit_hover_end ()

Emit an event when hovering the window was finished.

 

emit_hover ()

Emit a continous event when the window is hovered.

 

emit_hover_start ()

Emit an event when hovering the window started.

 

add_child ()

Add a child window.

 

set_color ()

Set a color that is multiplied to the texture.

 

set_flip_y ()

Flip the y axis of the texture.

 

show ()

Show the window.

 

hide ()

Hide the window.

 

is_visible ()

Check if the window is currently visible.

 

constructed ()

Common constructor.

 

get_data ()

Get common data struct.

 

guint windows_created;

Static counter how many windows were created, used for creating automatic overlay names.

 

XrdWindowData

typedef struct {
  gpointer native;

  uint32_t texture_width;
  uint32_t texture_height;
  GString *title;

  gboolean selected;

  graphene_point_t initial_size_meters;

  float scale;
  graphene_matrix_t transform;

  struct XrdWindowData *child_window;
  struct XrdWindowData *parent_window;

  graphene_point_t child_offset_center;

  graphene_matrix_t reset_transform;

  gboolean pinned;

  GulkanTexture *texture;

  XrdWindow *xrd_window;
} XrdWindowData;

Common struct for scene and overlay windows.

Members

gpointer native;

A native pointer to a window struct from a window manager.

 

uint32_t texture_width;

The width of the last submitted texture in pixels.

 

uint32_t texture_height;

The height of the last submitted texture in pixels.

 

GString *title;

A window title.

 

gboolean selected;

A gboolean used in selection mode.

 

graphene_point_t initial_size_meters;

The window dimensions in meters without scale.

 

float scale;

A user applied scale.

 

graphene_matrix_t transform;

The transformation graphene_matrix_t of the window.

 

struct XrdWindowData *child_window;

A window that is pinned on top of this window and follows this window's position and scaling.

 

struct XrdWindowData *parent_window;

The parent window, NULL if the window does not have a parent.

 

graphene_point_t child_offset_center;

If the window is a child, this stores the 2D offset to the parent in meters.

 

graphene_matrix_t reset_transform;

The transformation that the window will be reset to.

 

gboolean pinned;

Whether the window will be visible in pinned only mode.

 

GulkanTexture *texture;

Cache of the currently rendered texture.

 

XrdWindow *xrd_window;

A pointer to the XrdWindow this XrdWindowData belongs to. After switching the overlay/scene mode, it will point to a new XrdWindow.

 

XrdControllerIndexEvent

typedef struct {
  guint64 controller_handle;
} XrdControllerIndexEvent;

An event that carries a controller handle.

Members

guint64 controller_handle;

The controller the event was captured on.

 

XrdHoverEvent

typedef struct {
  graphene_point3d_t point;
  graphene_matrix_t  pose;
  float              distance;
  guint64            controller_handle;
} XrdHoverEvent;

An event that gets emitted when a controller hovers a window.

Members

graphene_point3d_t point;

The point in 3D world space.

 

graphene_matrix_t pose;

A graphene_matrix_t pose.

 

float distance;

Distance from the controller.

 

guint64 controller_handle;

The controller the event was captured on.

 

XrdGrabEvent

typedef struct {
  graphene_matrix_t  pose;
  guint64            controller_handle;
} XrdGrabEvent;

An event that gets emitted when a window get grabbed.

Members

graphene_matrix_t pose;

A graphene_matrix_t pose.

 

guint64 controller_handle;

The controller the event was captured on.

 

XrdPixelSize

typedef struct {
  uint32_t width;
  uint32_t height;
} XrdPixelSize;

A 2D size in pixels.

Members

uint32_t width;

The width in uint32_t

 

uint32_t height;

The height in uint32_t

 

XRD_TYPE_WINDOW

#define XRD_TYPE_WINDOW xrd_window_get_type()

Property Details

The “initial-height-meters” property

  “initial-height-meters”    gfloat

Initial window height in meters.

Flags: Read / Write / Construct

Allowed values: [0.01,1000]

Default value: 1


The “initial-width-meters” property

  “initial-width-meters”     gfloat

Initial window width in meters.

Flags: Read / Write / Construct

Allowed values: [0.01,1000]

Default value: 1


The “native” property

  “native”                   gpointer

A pointer to an (opaque) native window struct.

Flags: Read / Write / Construct


The “scale” property

  “scale”                    gfloat

Scaling Factor of this Window.

Flags: Read / Write / Construct

Allowed values: [0.05,15]

Default value: 1


The “texture-height” property

  “texture-height”           guint

The height of the set texture.

Flags: Read / Write / Construct

Allowed values: <= 32768

Default value: 0


The “texture-width” property

  “texture-width”            guint

The width of the set texture.

Flags: Read / Write / Construct

Allowed values: <= 32768

Default value: 0


The “title” property

  “title”                    gchar *

Title of the Window.

Flags: Read / Write / Construct Only

Default value: "Untitled"

Signal Details

The “button-press-event” signal

void
user_function (XrdWindow *xrdwindow,
               GdkEvent  *arg1,
               gpointer   user_data)

Flags: Run Last


The “button-release-event” signal

void
user_function (XrdWindow *xrdwindow,
               GdkEvent  *arg1,
               gpointer   user_data)

Flags: Run Last


The “destroy” signal

void
user_function (XrdWindow *xrdwindow,
               gpointer   user_data)

Flags: No Hooks


The “grab-event” signal

void
user_function (XrdWindow *xrdwindow,
               GdkEvent  *arg1,
               gpointer   user_data)

Flags: Run First


The “grab-start-event” signal

void
user_function (XrdWindow *xrdwindow,
               GdkEvent  *arg1,
               gpointer   user_data)

Flags: Run First


The “hover-end-event” signal

void
user_function (XrdWindow *xrdwindow,
               GdkEvent  *arg1,
               gpointer   user_data)

Flags: Run Last


The “hover-event” signal

void
user_function (XrdWindow *xrdwindow,
               GdkEvent  *arg1,
               gpointer   user_data)

Flags: Run Last


The “hover-start-event” signal

void
user_function (XrdWindow *xrdwindow,
               GdkEvent  *arg1,
               gpointer   user_data)

Flags: Run Last


The “keyboard-close-event” signal

void
user_function (XrdWindow *xrdwindow,
               gpointer   user_data)

Flags: Run First


The “keyboard-press-event” signal

void
user_function (XrdWindow *xrdwindow,
               GdkEvent  *arg1,
               gpointer   user_data)

Flags: Run Last


The “motion-notify-event” signal

void
user_function (XrdWindow *xrdwindow,
               GdkEvent  *arg1,
               gpointer   user_data)

Flags: Run Last


The “release-event” signal

void
user_function (XrdWindow *xrdwindow,
               GdkEvent  *arg1,
               gpointer   user_data)

Flags: Run First


The “scroll-event” signal

void
user_function (XrdWindow *xrdwindow,
               GdkEvent  *arg1,
               gpointer   user_data)

Flags: Run Last


The “show” signal

void
user_function (XrdWindow *xrdwindow,
               gpointer   user_data)

Flags: Run First