Mutter Reference Manual: MetaBarrier

## MetaBarrier MetaBarrier — Pointer barriers |

## Synopsis

    struct              MetaBarrier;
    struct              MetaBarrierClass;
    gboolean            meta_barrier_is_active              (MetaBarrier *barrier);
    void                meta_barrier_destroy                (MetaBarrier *barrier);
    void                meta_barrier_release                (MetaBarrier *barrier,
                                                             MetaBarrierEvent *event);
    enum                MetaBarrierDirection;
    struct              MetaBarrierEvent;

## Object Hierarchy

      GObject
       +----MetaBarrier

      GBoxed
       +----MetaBarrierEvent

## Properties

      "directions"               MetaBarrierDirection  : Read / Write / Construct Only
      "display"                  MetaDisplay*          : Read / Write / Construct Only
      "x1"                       gint                  : Read / Write / Construct Only
      "x2"                       gint                  : Read / Write / Construct Only
      "y1"                       gint                  : Read / Write / Construct Only
      "y2"                       gint                  : Read / Write / Construct Only

## Signals

      "hit"                                            : Run First
      "left"                                           : Run First

## Description

## Details

### struct MetaBarrier

    struct MetaBarrier;

The MetaBarrier structure contains only private data and should be accessed using the provided API

### struct MetaBarrierClass

    struct MetaBarrierClass {
    };

The MetaBarrierClass structure contains only private data.

### meta_barrier_is_active ()

    gboolean            meta_barrier_is_active              (MetaBarrier *barrier);

### meta_barrier_destroy ()

    void                meta_barrier_destroy                (MetaBarrier *barrier);

### meta_barrier_release ()

    void                meta_barrier_release                (MetaBarrier *barrier,
                                                             MetaBarrierEvent *event);

In XI2.3, pointer barriers provide a feature where they can be temporarily released so that the pointer goes through them. Pass a MetaBarrierEvent to release the barrier for this event sequence.

`barrier` : | The barrier to release
`event` : | The event to release the pointer for

### enum MetaBarrierDirection

    typedef enum {
      META_BARRIER_DIRECTION_POSITIVE_X = 1 << 0,
      META_BARRIER_DIRECTION_POSITIVE_Y = 1 << 1,
      META_BARRIER_DIRECTION_NEGATIVE_X = 1 << 2,
      META_BARRIER_DIRECTION_NEGATIVE_Y = 1 << 3,
    } MetaBarrierDirection;

`META_BARRIER_DIRECTION_POSITIVE_X` | Positive direction in the X axis
`META_BARRIER_DIRECTION_POSITIVE_Y` | Positive direction in the Y axis
`META_BARRIER_DIRECTION_NEGATIVE_X` | Negative direction in the X axis
`META_BARRIER_DIRECTION_NEGATIVE_Y` | Negative direction in the Y axis

### struct MetaBarrierEvent

    struct MetaBarrierEvent {
      int event_id;
      int dt;
      guint32 time;
      double x;
      double y;
      double dx;
      double dy;
      gboolean released;
      gboolean grabbed;
    };

int `event_id`; | A unique integer ID identifying a consecutive series of motions at or along the barrier
int `dt`; | Server time, in milliseconds, since the last event sent for this barrier
guint32 `time`; | Server time, in milliseconds
double `x`; | The cursor X position in screen coordinates
double `y`; | The cursor Y position in screen coordinates.
double `dx`; | If the cursor hadn't been constrained, the delta of X movement past the barrier, in screen coordinates
double `dy`; | If the cursor hadn't been constrained, the delta of X movement past the barrier, in screen coordinates
gboolean `released`; | A boolean flag, `TRUE` if this event generated by the pointer leaving the barrier as a result of a client calling `meta_barrier_release()` (will be set only for MetaBarrier::leave signals)
gboolean `grabbed`; | A boolean flag, `TRUE` if the pointer was grabbed at the time this event was sent

## Property Details

### The `"directions"` property

      "directions"               MetaBarrierDirection  : Read / Write / Construct Only

A set of directions to let the pointer through.

### The `"display"` property

      "display"                  MetaDisplay*          : Read / Write / Construct Only

The display to construct the pointer barrier on.

### The `"x1"` property

      "x1"                       gint                  : Read / Write / Construct Only

The first X coordinate of the barrier.

Allowed values: [0,32767]

Default value: 0

### The `"x2"` property

      "x2"                       gint                  : Read / Write / Construct Only

The second X coordinate of the barrier.

Allowed values: [0,32767]

Default value: 32767

### The `"y1"` property

      "y1"                       gint                  : Read / Write / Construct Only

The first Y coordinate of the barrier.

Allowed values: [0,32767]

Default value: 0

### The `"y2"` property

      "y2"                       gint                  : Read / Write / Construct Only

The second Y coordinate of the barrier.

Allowed values: [0,32767]

Default value: 32767

## Signal Details

### The `"hit"` signal

    void                user_function                      (MetaBarrier      *barrier,
                                                            MetaBarrierEvent *event,
                                                            gpointer          user_data)      : Run First

When a pointer barrier is hit, this will trigger. This requires an XI2-enabled server.

`barrier` : | The MetaBarrier that was hit
`event` : | A MetaBarrierEvent that has the details of how the barrier was hit.
`user_data` : | user data set when the signal handler was connected.

### The `"left"` signal

    void                user_function                      (MetaBarrier      *barrier,
                                                            MetaBarrierEvent *event,
                                                            gpointer          user_data)      : Run First

When a pointer barrier hitbox was left, this will trigger. This requires an XI2-enabled server.

`barrier` : | The MetaBarrier that was left
`event` : | A MetaBarrierEvent that has the details of how the barrier was left.
`user_data` : | user data set when the signal handler was connected.