mi: List extensions in usage message

Not all extensions can be enabled or disabled at runtime, list the
extensions which can from the help message rather than on error only.

v2:
 * Print the header message in the ListStaticExtensions() (Peter
   Hutterer)
 * Do not export ListStaticExtensions() as Xserver API

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
This commit is contained in:
Olivier Fourdan 2020-09-09 10:51:24 +02:00 committed by Olivier Fourdan
parent a81c98e42a
commit 3cdac5ba07
20 changed files with 128 additions and 14 deletions

View File

@ -65,6 +65,7 @@ Xdmx_SOURCES = dmx.c \
dmxwindow.c \
dmxwindow.h \
$(top_srcdir)/mi/miinitext.c \
$(top_srcdir)/mi/miinitext.h \
$(GLX_SRCS)

View File

@ -20,6 +20,7 @@ srcs = [
'dmxvisual.c',
'dmxwindow.c',
'../../mi/miinitext.c',
'../../mi/miinitext.h',
'../../Xext/panoramiX.c',
]

View File

@ -20,7 +20,8 @@ libkdrive_la_SOURCES = \
kinput.c \
kshadow.c \
$(KDRIVE_XV_SOURCES) \
$(top_srcdir)/mi/miinitext.c
$(top_srcdir)/mi/miinitext.c \
$(top_srcdir)/mi/miinitext.h
if CONFIG_UDEV
libkdrive_la_LIBADD = $(top_builddir)/config/libconfig.la

View File

@ -5,6 +5,7 @@ srcs_kdrive = [
'kinput.c',
'kshadow.c',
'../../../mi/miinitext.c',
'../../../mi/miinitext.h',
]
if build_xv

View File

@ -8,7 +8,8 @@ AM_CFLAGS = -DHAVE_DIX_CONFIG_H \
SRCS = InitInput.c \
InitOutput.c \
$(top_srcdir)/mi/miinitext.c
$(top_srcdir)/mi/miinitext.c \
$(top_srcdir)/mi/miinitext.h
Xvfb_SOURCES = $(SRCS)

View File

@ -2,6 +2,7 @@ srcs = [
'InitInput.c',
'InitOutput.c',
'../../mi/miinitext.c',
'../../mi/miinitext.h',
]
xvfb_server = executable(

View File

@ -35,5 +35,7 @@ libshadow_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
libshadow_la_LIBADD = $(top_builddir)/miext/shadow/libshadow.la
libshadow_la_SOURCES = shmodule.c
libdixmods_la_SOURCES = $(top_srcdir)/mi/miinitext.c
libdixmods_la_SOURCES = \
$(top_srcdir)/mi/miinitext.c \
$(top_srcdir)/mi/miinitext.h
libdixmods_la_CFLAGS = $(AM_CFLAGS)

View File

@ -40,7 +40,8 @@ subdir('ramdac')
subdir('xkb')
srcs_xorg = [
'../../mi/miinitext.c'
'../../mi/miinitext.c',
'../../mi/miinitext.h',
]
# Extract all the objects so that all symbols get brought into the

View File

@ -41,7 +41,8 @@ SRCS = Args.c \
XNPixmap.h \
XNWindow.h \
xnest-config.h \
$(top_srcdir)/mi/miinitext.c
$(top_srcdir)/mi/miinitext.c \
$(top_srcdir)/mi/miinitext.h
XNEST_LIBS = \
@XNEST_LIBS@ \

View File

@ -16,6 +16,7 @@ srcs = [
'Visual.c',
'Window.c',
'../../mi/miinitext.c',
'../../mi/miinitext.h',
]
executable(

View File

@ -21,6 +21,7 @@ DIST_SUBDIRS = bundle . GL xpr pbproxy mach-startup man
libXquartz_la_SOURCES = \
$(top_srcdir)/mi/miinitext.c \
$(top_srcdir)/mi/miinitext.h \
X11Application.m \
X11Controller.m \
applewm.c \

View File

@ -34,6 +34,7 @@ srcs_libxquartz = [
'quartzRandR.c',
'console_redirect.c',
'../../mi/miinitext.c',
'../../mi/miinitext.h',
]
libxquartz_defs = [

View File

@ -41,7 +41,8 @@ Xwayland_SOURCES = \
xwayland-window-buffers.c \
xwayland-window-buffers.h \
$(top_srcdir)/Xi/stubs.c \
$(top_srcdir)/mi/miinitext.c
$(top_srcdir)/mi/miinitext.c \
$(top_srcdir)/mi/miinitext.h
if GLAMOR
if GLX

View File

@ -25,6 +25,7 @@ srcs = [
'xwayland-window-buffers.c',
'xwayland-window-buffers.h',
'../../mi/miinitext.c',
'../../mi/miinitext.h',
]
scanner_dep = dependency('wayland-scanner', native: true)

View File

@ -88,6 +88,7 @@ SRCS = InitInput.c \
windisplay.h \
XWin.rc \
$(top_srcdir)/mi/miinitext.c \
$(top_srcdir)/mi/miinitext.h \
$(SRCS_CLIPBOARD) \
$(SRCS_MULTIWINDOW) \
$(SRCS_RANDR)

View File

@ -104,6 +104,7 @@ srcs_windows += [
'windisplay.c',
'windisplay.h',
'../../mi/miinitext.c',
'../../mi/miinitext.h',
]
rsrc = windows.compile_resources('XWin.rc', include_directories: include_directories('../../include/'))

View File

@ -107,6 +107,8 @@ SOFTWARE.
#include "os.h"
#include "globals.h"
#include "miinitext.h"
/* List of built-in (statically linked) extensions */
static const ExtensionModule staticExtensions[] = {
{GEExtensionInit, "Generic Event Extension", &noGEExtension},
@ -182,6 +184,21 @@ static const ExtensionModule staticExtensions[] = {
#endif
};
void
ListStaticExtensions(void)
{
const ExtensionModule *ext;
int i;
ErrorF(" Only the following extensions can be run-time enabled/disabled:\n");
for (i = 0; i < ARRAY_SIZE(staticExtensions); i++) {
ext = &staticExtensions[i];
if (ext->disablePtr != NULL) {
ErrorF("\t%s\n", ext->name);
}
}
}
Bool
EnableDisableExtension(const char *name, Bool enable)
{
@ -227,14 +244,7 @@ EnableDisableExtensionError(const char *name, Bool enable)
if (enable == FALSE)
return;
}
ErrorF("[mi] Only the following extensions can be run-time %s:\n",
enable ? "enabled" : "disabled");
for (i = 0; i < ARRAY_SIZE(staticExtensions); i++) {
ext = &staticExtensions[i];
if (ext->disablePtr != NULL) {
ErrorF("[mi] %s\n", ext->name);
}
}
ListStaticExtensions();
}
static ExtensionModule *ExtensionModuleList = NULL;

83
mi/miinitext.h Normal file
View File

@ -0,0 +1,83 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, 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.
******************************************************************/
/*
* Copyright (c) 2000 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef MIINITEXT_H
#define MIINITEXT_H
void ListStaticExtensions(void);
#endif /* MIINITEXT_H */

View File

@ -110,6 +110,8 @@ __stdcall unsigned long GetTickCount(void);
#include "picture.h"
#include "miinitext.h"
Bool noTestExtensions;
#ifdef COMPOSITE
@ -576,6 +578,7 @@ UseMsg(void)
ErrorF("-sigstop Enable SIGSTOP based startup\n");
ErrorF("+extension name Enable extension\n");
ErrorF("-extension name Disable extension\n");
ListStaticExtensions();
#ifdef XDMCP
XdmcpUseMsg();
#endif

View File

@ -122,6 +122,7 @@ if build_xorg
# For now, requires xf86 ddx, could be adjusted to use another
unit_sources = [
'../mi/miinitext.c',
'../mi/miinitext.h',
'fixes.c',
'input.c',
'list.c',