2016-10-16 10:49:17 +02:00
|
|
|
//
|
2016-10-18 17:16:19 +02:00
|
|
|
// xext.vapi: various extensions to the x11 vapi
|
2016-10-16 10:49:17 +02:00
|
|
|
//
|
2020-09-17 09:14:05 +02:00
|
|
|
// Copyright (c) 2016 - 2020, Přemysl Eric Janouch <p.janouch@gmail.com>
|
2016-10-16 10:49:17 +02:00
|
|
|
//
|
|
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
2018-06-24 05:33:30 +02:00
|
|
|
// purpose with or without fee is hereby granted.
|
2016-10-16 10:49:17 +02:00
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
|
|
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
|
|
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
|
|
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
//
|
|
|
|
// vim: set sw=2 ts=2 sts=2 et tw=80:
|
|
|
|
// modules: x11
|
|
|
|
|
|
|
|
namespace X {
|
|
|
|
[CCode (cname = "XErrorHandler", has_target = false)]
|
|
|
|
public delegate int ErrorHandler (Display dpy, ErrorEvent *ee);
|
|
|
|
[CCode (cname = "XSetErrorHandler")]
|
|
|
|
public ErrorHandler set_error_handler (ErrorHandler handler);
|
|
|
|
|
|
|
|
// XXX: can we extend the Display class so that the argument goes away?
|
|
|
|
[CCode (cname = "XSync")]
|
|
|
|
public int sync (Display dpy, bool discard);
|
|
|
|
[CCode (cname = "XSupportsLocale")]
|
|
|
|
public int supports_locale ();
|
|
|
|
|
|
|
|
[CCode (cname = "XTextProperty", has_type_id = false)]
|
|
|
|
public struct TextProperty {
|
|
|
|
// There is always a null byte at the end but it may also appear earlier
|
|
|
|
// depending on the other fields, so this is a bit misleading
|
|
|
|
[CCode (array_null_terminated = true)]
|
|
|
|
// Vala tries to g_free0() owned arrays, you still need to call XFree()
|
|
|
|
public unowned uint8[]? @value;
|
|
|
|
public Atom encoding;
|
|
|
|
public int format;
|
|
|
|
public ulong nitems;
|
|
|
|
}
|
|
|
|
[CCode (cname = "XGetTextProperty")]
|
2016-10-18 17:17:03 +02:00
|
|
|
public int get_text_property (Display dpy,
|
|
|
|
Window window, out TextProperty text_prop_return, Atom property);
|
2016-10-16 10:49:17 +02:00
|
|
|
|
|
|
|
[CCode (cname = "XmbTextPropertyToTextList")]
|
2016-10-18 17:17:03 +02:00
|
|
|
public int mb_text_property_to_text_list (Display dpy,
|
|
|
|
ref TextProperty text_prop,
|
|
|
|
[CCode (type = "char ***")] out uint8 **list_return, out int count_return);
|
2016-10-16 10:49:17 +02:00
|
|
|
[CCode (cname = "XFreeStringList")]
|
|
|
|
public void free_string_list ([CCode (type = "char **")] uint8** list);
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace X {
|
|
|
|
[CCode (cprefix = "", cheader_filename = "X11/extensions/sync.h")]
|
|
|
|
namespace Sync {
|
|
|
|
[CCode (cprefix = "XSync", cname = "int", has_type_id = false)]
|
|
|
|
public enum EventType {
|
|
|
|
CounterNotify,
|
|
|
|
AlarmNotify
|
|
|
|
}
|
|
|
|
|
|
|
|
[CCode (cprefix = "", cname = "int", has_type_id = false)]
|
|
|
|
public enum ErrorCode {
|
|
|
|
[CCode (cname = "XSyncBadCounter")]
|
|
|
|
BAD_COUNTER,
|
|
|
|
[CCode (cname = "XSyncBadAlarm")]
|
|
|
|
BAD_ALARM,
|
|
|
|
[CCode (cname = "XSyncBadFence")]
|
|
|
|
BAD_FENCE
|
|
|
|
}
|
|
|
|
|
|
|
|
[CCode (cprefix = "XSyncCA", cname = "int")]
|
|
|
|
[Flags]
|
|
|
|
public enum CA {
|
|
|
|
Counter,
|
|
|
|
ValueType,
|
|
|
|
Value,
|
|
|
|
TestType,
|
|
|
|
Delta,
|
|
|
|
Events
|
|
|
|
}
|
|
|
|
|
|
|
|
[CCode (cname = "XSyncValueType", cprefix = "XSync")]
|
|
|
|
public enum ValueType {
|
|
|
|
Absolute,
|
|
|
|
Relative
|
|
|
|
}
|
|
|
|
[CCode (cname = "XSyncTestType", cprefix = "XSync")]
|
|
|
|
public enum TestType {
|
|
|
|
PositiveTransition,
|
|
|
|
NegativeTransition,
|
|
|
|
PositiveComparison,
|
|
|
|
NegativeComparison
|
|
|
|
}
|
|
|
|
[CCode (cname = "XSyncAlarmState", cprefix = "XSyncAlarm")]
|
|
|
|
public enum AlarmState {
|
|
|
|
Active,
|
|
|
|
Inactive,
|
|
|
|
Destroyed
|
|
|
|
}
|
|
|
|
|
|
|
|
[CCode (cname = "XSyncValue", has_type_id = false)]
|
|
|
|
[SimpleType]
|
|
|
|
public struct Value {
|
|
|
|
public int hi;
|
|
|
|
public uint lo;
|
|
|
|
}
|
|
|
|
|
|
|
|
[CCode (cname = "XSyncIntToValue")]
|
|
|
|
public void int_to_value (out Value value, int v);
|
|
|
|
[CCode (cname = "XSyncIntsToValue")]
|
|
|
|
public void ints_to_value (out Value value, uint l, int h);
|
|
|
|
|
|
|
|
[CCode (cname = "XSyncValueGreaterThan")]
|
|
|
|
public int value_greater_than (Value a, Value b);
|
|
|
|
[CCode (cname = "XSyncValueLessThan")]
|
|
|
|
public int value_less_than (Value a, Value b);
|
|
|
|
[CCode (cname = "XSyncValueGreaterOrEqual")]
|
|
|
|
public int value_greater_or_equal (Value a, Value b);
|
|
|
|
[CCode (cname = "XSyncValueLessOrEqual")]
|
|
|
|
public int value_less_or_equal (Value a, Value b);
|
|
|
|
[CCode (cname = "XSyncValueEqual")]
|
|
|
|
public int value_equal (Value a, Value b);
|
|
|
|
|
|
|
|
[CCode (cname = "XSyncValueIsNegative")]
|
|
|
|
public int value_is_negative (Value a, Value b);
|
|
|
|
[CCode (cname = "XSyncValueIsZero")]
|
|
|
|
public int value_is_zero (Value a, Value b);
|
|
|
|
[CCode (cname = "XSyncValueIsPositive")]
|
|
|
|
public int value_is_positive (Value a, Value b);
|
|
|
|
|
|
|
|
[CCode (cname = "XSyncValueLow32")]
|
|
|
|
public uint value_low32 (Value value);
|
|
|
|
[CCode (cname = "XSyncValueHigh32")]
|
|
|
|
public int value_high32 (Value value);
|
|
|
|
|
|
|
|
[CCode (cname = "XSyncValueAdd")]
|
2016-10-18 17:17:03 +02:00
|
|
|
public void value_add
|
|
|
|
(out Value result, Value a, Value b, out int poverflow);
|
2016-10-16 10:49:17 +02:00
|
|
|
[CCode (cname = "XSyncValueSubtract")]
|
2016-10-18 17:17:03 +02:00
|
|
|
public void value_subtract
|
|
|
|
(out Value result, Value a, Value b, out int poverflow);
|
2016-10-16 10:49:17 +02:00
|
|
|
|
|
|
|
[CCode (cname = "XSyncMaxValue")]
|
|
|
|
public void max_value (out Value pv);
|
|
|
|
[CCode (cname = "XSyncMinValue")]
|
|
|
|
public void min_value (out Value pv);
|
|
|
|
|
|
|
|
[CCode (cname = "XSyncSystemCounter", has_type_id = false)]
|
|
|
|
public struct SystemCounter {
|
|
|
|
public string name;
|
|
|
|
public X.ID counter;
|
|
|
|
public Value resolution;
|
|
|
|
}
|
|
|
|
[CCode (cname = "XSyncTrigger", has_type_id = false)]
|
|
|
|
public struct Trigger {
|
|
|
|
public X.ID counter;
|
|
|
|
public ValueType value_type;
|
|
|
|
public Value wait_value;
|
|
|
|
public TestType test_type;
|
|
|
|
}
|
|
|
|
[CCode (cname = "XSyncWaitCondition", has_type_id = false)]
|
|
|
|
public struct WaitCondition {
|
|
|
|
public Trigger trigger;
|
|
|
|
public Value event_threshold;
|
|
|
|
}
|
|
|
|
[CCode (cname = "XSyncAlarmAttributes", has_type_id = false)]
|
|
|
|
public struct AlarmAttributes {
|
|
|
|
public Trigger trigger;
|
|
|
|
public Value delta;
|
|
|
|
public int events;
|
|
|
|
public AlarmState state;
|
|
|
|
}
|
|
|
|
|
|
|
|
[CCode (cname = "XSyncCounterNotifyEvent", has_type_id = false)]
|
|
|
|
public struct CounterNotifyEvent {
|
|
|
|
// TODO: other fields
|
|
|
|
public X.ID counter;
|
|
|
|
public Value wait_value;
|
|
|
|
public Value counter_value;
|
|
|
|
}
|
|
|
|
[CCode (cname = "XSyncAlarmNotifyEvent", has_type_id = false)]
|
|
|
|
public struct AlarmNotifyEvent {
|
|
|
|
// TODO: other fields
|
|
|
|
public X.ID alarm;
|
|
|
|
public Value counter_value;
|
|
|
|
public Value alarm_value;
|
|
|
|
public AlarmState state;
|
|
|
|
}
|
|
|
|
|
|
|
|
[CCode (cname = "XSyncQueryExtension")]
|
2016-10-18 17:17:03 +02:00
|
|
|
public X.Status query_extension (X.Display dpy,
|
|
|
|
out int event_base, out int error_base);
|
2016-10-16 10:49:17 +02:00
|
|
|
[CCode (cname = "XSyncInitialize")]
|
2016-10-18 17:17:03 +02:00
|
|
|
public X.Status initialize (X.Display dpy,
|
|
|
|
out int major_version, out int minor_version);
|
2016-10-16 10:49:17 +02:00
|
|
|
[CCode (cname = "XSyncListSystemCounters")]
|
2016-10-18 17:17:03 +02:00
|
|
|
public SystemCounter *list_system_counters (X.Display dpy,
|
|
|
|
out int n_counters);
|
2016-10-16 10:49:17 +02:00
|
|
|
[CCode (cname = "XSyncFreeSystemCounterList")]
|
|
|
|
public void free_system_counter_list (SystemCounter *counters);
|
|
|
|
|
|
|
|
[CCode (cname = "XSyncCreateCounter")]
|
|
|
|
public X.ID create_counter (X.Display dpy, Value initial_value);
|
|
|
|
[CCode (cname = "XSyncSetCounter")]
|
|
|
|
public X.Status set_counter (X.Display dpy, X.ID counter, Value value);
|
|
|
|
[CCode (cname = "XSyncChangeCounter")]
|
|
|
|
public X.Status change_counter (X.Display dpy, X.ID counter, Value value);
|
|
|
|
[CCode (cname = "XSyncDestroyCounter")]
|
|
|
|
public X.Status destroy_counter (X.Display dpy, X.ID counter);
|
|
|
|
[CCode (cname = "XSyncQueryCounter")]
|
2016-10-18 17:17:03 +02:00
|
|
|
public X.Status query_counter (X.Display dpy,
|
|
|
|
X.ID counter, out Value value);
|
2016-10-16 10:49:17 +02:00
|
|
|
|
|
|
|
[CCode (cname = "XSyncAwait")]
|
2016-10-18 17:17:03 +02:00
|
|
|
public X.Status await (X.Display dpy,
|
|
|
|
WaitCondition *wait_list, int n_conditions);
|
2016-10-16 10:49:17 +02:00
|
|
|
|
|
|
|
[CCode (cname = "XSyncCreateAlarm")]
|
2016-10-18 17:17:03 +02:00
|
|
|
public X.ID create_alarm (X.Display dpy,
|
|
|
|
CA values_mask, ref AlarmAttributes values);
|
2016-10-16 10:49:17 +02:00
|
|
|
[CCode (cname = "XSyncDestroyAlarm")]
|
|
|
|
public X.Status destroy_alarm (X.Display dpy, X.ID alarm);
|
|
|
|
[CCode (cname = "XSyncQueryAlarm")]
|
2016-10-18 17:17:03 +02:00
|
|
|
public X.Status query_alarm (X.Display dpy,
|
|
|
|
X.ID alarm, out AlarmAttributes values_return);
|
2016-10-16 10:49:17 +02:00
|
|
|
[CCode (cname = "XSyncChangeAlarm")]
|
2016-10-18 17:17:03 +02:00
|
|
|
public X.Status change_alarm (X.Display dpy,
|
|
|
|
X.ID alarm, CA values_mask, ref AlarmAttributes values);
|
2016-10-16 10:49:17 +02:00
|
|
|
|
|
|
|
[CCode (cname = "XSyncSetPriority")]
|
|
|
|
public X.Status set_priority (X.Display dpy, X.ID alarm, int priority);
|
|
|
|
[CCode (cname = "XSyncGetPriority")]
|
|
|
|
public X.Status get_priority (X.Display dpy, X.ID alarm, out int priority);
|
|
|
|
|
|
|
|
[CCode (cname = "XSyncCreateFence")]
|
2016-10-18 17:17:03 +02:00
|
|
|
public X.ID create_fence (X.Display dpy,
|
|
|
|
X.Drawable d, int initially_triggered);
|
2016-10-16 10:49:17 +02:00
|
|
|
[CCode (cname = "XSyncTriggerFence")]
|
|
|
|
public int trigger_fence (X.Display dpy, X.ID fence);
|
|
|
|
[CCode (cname = "XSyncResetFence")]
|
|
|
|
public int reset_fence (X.Display dpy, X.ID fence);
|
|
|
|
[CCode (cname = "XSyncDestroyFence")]
|
|
|
|
public int destroy_fence (X.Display dpy, X.ID fence);
|
|
|
|
[CCode (cname = "XSyncQueryFence")]
|
|
|
|
public int query_fence (X.Display dpy, X.ID fence, out int triggered);
|
|
|
|
[CCode (cname = "XSyncAwaitFence")]
|
|
|
|
public int await_fence (X.Display dpy, X.ID *fence_list, int n_fences);
|
|
|
|
}
|
|
|
|
}
|