From: Sergio Costas Date: Sat, 21 Dec 2013 09:34:29 +0000 (+0100) Subject: Add xcb-icccm bindings. X-Git-Tag: 0.23.1~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fdd6531f13303dc6adb53331f0e698357157aade;p=thirdparty%2Fvala.git Add xcb-icccm bindings. Fixes bug 720225. --- diff --git a/vapi/Makefile.am b/vapi/Makefile.am index 0ceece799..69612f87e 100644 --- a/vapi/Makefile.am +++ b/vapi/Makefile.am @@ -286,6 +286,7 @@ dist_vapi_DATA = \ webkit-1.0.vapi \ x11.vapi \ xcb.vapi \ + xcb-icccm.vapi \ xtst.vapi \ xtst.deps \ zlib.vapi \ diff --git a/vapi/xcb-icccm.vapi b/vapi/xcb-icccm.vapi new file mode 100644 index 000000000..cdae2b0f7 --- /dev/null +++ b/vapi/xcb-icccm.vapi @@ -0,0 +1,56 @@ +/* xcb-icccm.vapi + * + * Copyright (C) 2013 Sergio Costas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Sergio Costas + */ + +using Xcb; + +namespace Xcb { + + [CCode (lower_case_cprefix = "xcb_icccm_", cheader_filename = "xcb/xcb_icccm.h")] + namespace Icccm { + + /** + * A factory method that creates an Icccm object. It allows to call the Xcb Icccm methods + * @param conn The current Xcb connection + * @return the new Icccm object + */ + public static Icccm new(Xcb.Connection conn) { + unowned Xcb.Icccm.Icccm retval = (Xcb.Icccm.Icccm)conn; + return retval; + } + + // The Icccm class is, in fact, a Xcb.Connection class in disguise + [Compact, CCode (cname = "xcb_connection_t", cprefix = "xcb_icccm_")] + public class Icccm : Xcb.Connection { + public GetPropertyCookie get_wm_class(Window window); + public GetPropertyCookie get_wm_class_unchecked(Window window); + } + + [SimpleType] + [CCode (cname = "xcb_icccm_get_wm_class_reply_t", has_type_id = false)] + public struct GetWmClassFromReply { + unowned string instance_name; + unowned string class_name; + } + + public void get_wm_class_from_reply(out GetWmClassFromReply reply, GetPropertyReply input); + } +} diff --git a/vapi/xcb.vapi b/vapi/xcb.vapi index 0f9839604..229e4d1d5 100644 --- a/vapi/xcb.vapi +++ b/vapi/xcb.vapi @@ -111,6 +111,31 @@ namespace Xcb { public VoidCookie reparent_window(Window window, Window parent, uint16 x, uint16 y); public VoidCookie reparent_window_checked(Window window, Window parent, uint16 x, uint16 y); + + public GetGeometryCookie get_geometry(Drawable drawable); + public GetGeometryCookie get_geometry_unchecked(Drawable drawable); + public GetGeometryReply ? get_geometry_reply(GetGeometryCookie cookie, out GenericError ? e); + } + + [SimpleType] + [IntegerType (rank = 9)] + [CCode (cname = "xcb_get_geometry_cookie_t", has_type_id = false)] + public struct GetGeometryCookie { + } + + [CCode (cname = "xcb_get_geometry_reply_t", ref_function = "", unref_function = "free")] + public class GetGeometryReply { + public uint8 response_type; + public uint8 depth; + public uint16 sequence; + public uint32 length; + public Window root; + public int16 x; + public int16 y; + public uint16 width; + public uint16 height; + public uint16 border_width; + public uint8 pad0[2]; } [SimpleType] @@ -158,10 +183,12 @@ namespace Xcb { [Compact] [CCode (cname = "xcb_get_property_reply_t", ref_function = "", unref_function = "free")] public class GetPropertyReply { + public uint8 format; + public Atom type; [CCode (cname = "xcb_get_property_value_length")] public int32 value_length(); [CCode (cname = "xcb_get_property_value")] - public void *value(); + public unowned void *value(); } [Compact] @@ -525,6 +552,24 @@ namespace Xcb { public uint16 value_mask; } + [Compact] + [CCode (cname = "xcb_configure_notify_event_t", ref_function = "", unref_function = "")] + public class ConfigureNotifyEvent { + public uint8 response_type; + public uint8 pad0; + public uint16 sequence; + public Window event; + public Window window; + public Window above_sibling; + public int16 x; + public int16 y; + public uint16 width; + public uint16 height; + public uint16 border_width; + public uint8 override_redirect; + public uint8 pad1; + } + [CCode (cname = "xcb_cw_t", has_type_id = false)] public enum CW { BACK_PIXMAP, @@ -655,10 +700,12 @@ namespace Xcb { public uint16 height; } + [SimpleType] [CCode (cname = "xcb_visualid_t", has_type_id = false)] public struct VisualID : uint32 { } + [SimpleType] [CCode (cname = "xcb_button_t", has_type_id = false)] public struct Button : uint8 { }