From 461fa1cb64c83fd422f26cc9a78cd8b491aa9fbd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Wed, 26 Feb 2014 17:26:47 -0500 Subject: [PATCH] lib: intro of the x11 module MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/x11.nit | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 lib/x11.nit create mode 100644 tests/sav/x11.res diff --git a/lib/x11.nit b/lib/x11.nit new file mode 100644 index 0000000..b4f51d5 --- /dev/null +++ b/lib/x11.nit @@ -0,0 +1,34 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2014 Alexis Laferrière +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Serices from the X11 library +module x11 is pkgconfig("x11") + +# Open the current display from the environment variables +# +# See +fun x_open_default_display: Pointer `{ + return (void*)(long)XOpenDisplay(NULL); +`} + +# Open a specific display +# +# `name` is in the format: "hostname:number.screen_number" +# +# See +fun x_open_display(name: String): Pointer import String.to_cstring `{ + return (void*)XOpenDisplay(String_to_cstring(name)); +`} diff --git a/tests/sav/x11.res b/tests/sav/x11.res new file mode 100644 index 0000000..e69de29 -- 1.7.9.5