diff --git a/Headers/headless/HeadlessContext.h b/Headers/headless/HeadlessContext.h new file mode 100644 index 0000000..288c53a --- /dev/null +++ b/Headers/headless/HeadlessContext.h @@ -0,0 +1,30 @@ +/* HeadlessContext.c - Headless Context + * + * Copyright (c) 2023 Keysight Technologies + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef HeadlessContext_h_INCLUDE +#define HeadlessContext_h_INCLUDE + +#include "gsc/GSContext.h" + +@interface HeadlessContext : GSContext +{ +} +@end + +#endif \ No newline at end of file diff --git a/Headers/headless/HeadlessServer.h b/Headers/headless/HeadlessServer.h new file mode 100644 index 0000000..a34f2d7 --- /dev/null +++ b/Headers/headless/HeadlessServer.h @@ -0,0 +1,32 @@ +/* HeadlessServer.c - Headless Server + * + * Copyright (c) 2023 Keysight Technologies + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef HeadlessServer_h_INCLUDE +#define HeadlessServer_h_INCLUDE + +#include "config.h" + +#include + +@interface HeadlessServer : GSDisplayServer +{ +} +@end + +#endif /* HeadlessServer_h_INCLUDE */ \ No newline at end of file diff --git a/Source/GSBackend.m b/Source/GSBackend.m index eb89388..47f85ac 100644 --- a/Source/GSBackend.m +++ b/Source/GSBackend.m @@ -50,6 +50,11 @@ @interface WaylandServer (Initialize) + (void) initializeBackend; @end +#elif BUILD_SERVER == SERVER_headless +#include +@interface HeadlessServer (Initialize) ++ (void) initializeBackend; +@end #endif /* Call the correct initalization routines for the choosen @@ -70,6 +75,8 @@ [WIN32Server initializeBackend]; #elif BUILD_SERVER == SERVER_wayland [WaylandServer initializeBackend]; +#elif BUILD_SERVER == SERVER_xheadless + [HeadlessServer initializeBackend]; #else [NSException raise: NSInternalInconsistencyException format: @"No Window Server configured in backend"]; @@ -96,6 +103,8 @@ context = @"CairoContext"; #elif (BUILD_GRAPHICS==GRAPHICS_opal) context = @"OpalContext"; +#elif (BUILD_GRAPHICS==GRAPHICS_headless) + context = @"HeadlessContext"; #else #error INVALID build graphics type #endif diff --git a/Source/headless/GNUmakefile b/Source/headless/GNUmakefile new file mode 100644 index 0000000..4014504 --- /dev/null +++ b/Source/headless/GNUmakefile @@ -0,0 +1,42 @@ +# +# Main makefile for GNUstep Headless Backend +# +# Copyright (C) 2002 Free Software Foundation, Inc. +# +# Author: Adam Fedor +# +# This file is part of the GNUstep Backend. +# +# 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 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; see the file COPYING.LIB. +# If not, see or write to the +# Free Software Foundation, 51 Franklin Street, Fifth Floor, + +PACKAGE_NAME = gnustep-back +GNUSTEP_LOCAL_ADDITIONAL_MAKEFILES=../../back.make + +include $(GNUSTEP_MAKEFILES)/common.make + +include ../../config.make + +# The library to be compiled, as a library or as a bundle +SUBPROJECT_NAME=xheadless + +# The Objective-C source files to be compiled +xheadless_OBJC_FILES = + +-include GNUmakefile.preamble + +include $(GNUSTEP_MAKEFILES)/subproject.make + +-include GNUmakefile.postamble \ No newline at end of file diff --git a/Source/headless/GNUmakefile.preamble b/Source/headless/GNUmakefile.preamble new file mode 100644 index 0000000..92d366b --- /dev/null +++ b/Source/headless/GNUmakefile.preamble @@ -0,0 +1,51 @@ +# +# GNUmakefile.preamble +# +# Copyright (C) 2002 Free Software Foundation, Inc. +# +# Author: Adam Fedor +# +# This file is part of the GNUstep Backend. +# +# 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 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; see the file COPYING.LIB. +# If not, see or write to the +# Free Software Foundation, 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. + +# +# Flags dealing with compiling and linking +# + +# Additional flags to pass to the preprocessor +ADDITIONAL_CPPFLAGS += -Wall $(CONFIG_SYSTEM_DEFS) + +# Additional flags to pass to the Objective-C compiler +ADDITIONAL_OBJCFLAGS = + +# Additional flags to pass to the C compiler +ADDITIONAL_CFLAGS = + +# Additional include directories the compiler should search +ADDITIONAL_INCLUDE_DIRS += -I../../Headers \ + -I../$(GNUSTEP_TARGET_DIR) $(GRAPHIC_CFLAGS) + +# Additional LDFLAGS to pass to the linker +ADDITIONAL_LDFLAGS = + +# Additional library directories the linker should search +ADDITIONAL_LIB_DIRS = + +# +# Flags dealing with installing and uninstalling +# diff --git a/Source/headless/HeadlessContext.m b/Source/headless/HeadlessContext.m new file mode 100644 index 0000000..cba28d2 --- /dev/null +++ b/Source/headless/HeadlessContext.m @@ -0,0 +1,26 @@ +/* HeadlessContext.m - Headless Context + * + * Copyright (c) 2023 Keysight Technologies + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "config.h" + +#include "Headless/HeadlessContext.h" + +@implementation HeadlessContext + +@end \ No newline at end of file diff --git a/Source/headless/HeadlessServer.m b/Source/headless/HeadlessServer.m new file mode 100644 index 0000000..bad5bea --- /dev/null +++ b/Source/headless/HeadlessServer.m @@ -0,0 +1,26 @@ +/* HeadlessServer.m - Headless Server + * + * Copyright (c) 2023 Keysight Technologies + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "config.h" + +#include "Headless/HeadlessServer.h" + +@implementation HeadlessServer + +@end \ No newline at end of file diff --git a/configure.ac b/configure.ac index 88a80f5..93b8ba1 100644 --- a/configure.ac +++ b/configure.ac @@ -565,10 +565,10 @@ case $target_os in esac AC_ARG_ENABLE(server, - [ --enable-server=SRV Build server type: x11, win32, wayland],, + [ --enable-server=SRV Build server type: x11, win32, wayland, headless],, enable_server=$BUILD_SERVER) AC_ARG_ENABLE(graphics, - [ --enable-graphics=GPH Build graphics: xlib, xdps, winlib, art, cairo, opal],, + [ --enable-graphics=GPH Build graphics: xlib, xdps, winlib, art, cairo, opal, headless],, enable_graphics="$BUILD_GRAPHICS") BUILD_SERVER=$enable_server @@ -658,8 +658,6 @@ if test x"$BUILD_GRAPHICS" = "xcairo"; then CAIRO_LIBS="$CAIRO_LIBS $XFT_LIBS" CAIRO_CFLAGS="$CAIRO_CFLAGS" LIBS="-lwayland-client -lwayland-cursor -lxkbcommon $LIBS" - else - AC_MSG_ERROR([Invalid Cairo installation]) fi LIBS="$CAIRO_LIBS $LIBS" CPPFLAGS="$CAIRO_CFLAGS $CPPFLAGS" @@ -717,6 +715,8 @@ elif test x"$BUILD_GRAPHICS" = "xopal"; then fi AC_MSG_NOTICE([Switching to $BUILD_GRAPHICS]) fi +elif test x"$BUILD_GRAPHICS" = "xheadless"; then + : # Nothing to do else AC_MSG_ERROR([Invalid graphics backend $BUILD_GRAPHICS]) fi @@ -757,15 +757,17 @@ if test $BUILD_SERVER = win32; then fi AH_TOP([ -#define SERVER_x11 1 -#define SERVER_win32 2 -#define SERVER_wayland 3 -#define GRAPHICS_xdps 0 -#define GRAPHICS_art 1 -#define GRAPHICS_xlib 2 -#define GRAPHICS_winlib 3 -#define GRAPHICS_cairo 4 -#define GRAPHICS_opal 5 +#define SERVER_x11 1 +#define SERVER_win32 2 +#define SERVER_wayland 3 +#define SERVER_headless 4 +#define GRAPHICS_xdps 0 +#define GRAPHICS_art 1 +#define GRAPHICS_xlib 2 +#define GRAPHICS_winlib 3 +#define GRAPHICS_cairo 4 +#define GRAPHICS_opal 5 +#define GRAPHICS_headless 6 ]) AC_DEFINE_UNQUOTED(BUILD_SERVER,SERVER_$BUILD_SERVER, [Define to type of window server to build])