[PATCH] Make -nocursor a runtime option to and remove the compile time NULL_ROOT_CURSOR

Barry Scott barry.scott at onelan.co.uk
Thu Sep 25 09:00:49 PDT 2008


David Greaves wrote:
> (resend - didn't realise xorg was subscribe only)
>
> Hi Keith
>
> After irc discussions I sent this patch in via daniel last december but I guess
> it got dropped.
>
> You seem to be an active committer to xorg/xserver so could you commit this for
> me or let me know what needs changing.
>
> It is against xorg/xserver git from about an hour ago.
>
>   
Am I right in thinking this only disables the cursor over the root 
window and not over the
whole screen?

I'd suggest that you name the option --norootcursor not -nocursor if 
that is the case.

We would love to have a -nocursor that got ride of the cursor from the 
screen
added to Xorg.

We have a patch to do this that we use.

Barry



> Thanks.
>
> David
>
> =======================================
>
> Make -nocursor a runtime option to and remove the compile time NULL_ROOT_CURSOR
>
> This is for use on a picture frame but I guess would be useful on touch screens
> and in other situations too.
>
> Signed-off-by: David Greaves <david at dgreaves.com>
>
> ---
>  configure.ac            |    7 ------
>  dix/cursor.c            |   55 ++++++++++++++++++++++------------------------
>  dix/globals.c           |    1 +
>  doc/Xserver.man.pre     |    4 +++
>  include/dix-config.h.in |    3 --
>  include/opaque.h        |    1 +
>  os/utils.c              |    5 ++++
>  7 files changed, 37 insertions(+), 39 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 60cdc14..88a2c01 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -492,9 +492,6 @@ AC_ARG_ENABLE(install-libxf86config,
>  AC_ARG_ENABLE(builtin-fonts,  AS_HELP_STRING([--enable-builtin-fonts], [Use
> only built-in fonts (default: yes)]),
>                                  [BUILTIN_FONTS=$enableval],
>                                  [BUILTIN_FONTS=yes])
> -AC_ARG_ENABLE(null-root-cursor, AS_HELP_STRING([--enable-null-root-cursor],
> [Use an empty root cursor (default: use core cursor)]),
> -                                 [NULL_ROOT_CURSOR=$enableval],
> -                                 [NULL_ROOT_CURSOR=no])
>
>  dnl GLX build options
>  AC_ARG_WITH(mesa-source,     AS_HELP_STRING([--with-mesa-source=MESA_SOURCE],
> [Path to Mesa source tree]),
> @@ -981,10 +978,6 @@ AC_CHECK_FUNC(strncasecmp, [], AC_DEFINE([NEED_STRNCASECMP], 1,
>  AC_CHECK_FUNC(strcasestr, [], AC_DEFINE([NEED_STRCASESTR], 1,
>                                         [Do not have 'strcasestr'.]))
>
> -if test "x$NULL_ROOT_CURSOR" = xyes; then
> -        AC_DEFINE(NULL_ROOT_CURSOR, 1, [Use an empty root cursor])
> -fi
> -
>  PKG_CHECK_MODULES([XDMCP], [xdmcp], [have_libxdmcp="yes"], [have_libxdmcp="no"])
>  if test "x$have_libxdmcp" = xyes; then
>  	AC_CHECK_LIB(Xdmcp, XdmcpWrap, [have_xdmcpwrap="yes"], [have_xdmcpwrap="no"],
> [$XDMCP_LIBS])
> diff --git a/dix/cursor.c b/dix/cursor.c
> index 81540fd..38224cf 100644
> --- a/dix/cursor.c
> +++ b/dix/cursor.c
> @@ -519,39 +519,36 @@ CursorPtr
>  CreateRootCursor(char *unused1, unsigned int unused2)
>  {
>      CursorPtr 	curs;
> -#ifdef NULL_ROOT_CURSOR
>      CursorMetricRec cm;
> -#else
>      FontPtr 	cursorfont;
>      int	err;
>      XID		fontID;
> -#endif
> -
> -#ifdef NULL_ROOT_CURSOR
> -    cm.width = 0;
> -    cm.height = 0;
> -    cm.xhot = 0;
> -    cm.yhot = 0;
> -
> -    AllocARGBCursor(NULL, NULL, NULL, &cm, 0, 0, 0, 0, 0, 0,
> -		    &curs, serverClient, (XID)0);
> -
> -    if (curs == NullCursor)
> -        return NullCursor;
> -#else
> -    fontID = FakeClientID(0);
> -    err = OpenFont(serverClient, fontID, FontLoadAll | FontOpenSync,
> -	(unsigned)strlen(defaultCursorFont), defaultCursorFont);
> -    if (err != Success)
> -	return NullCursor;
> -
> -    cursorfont = (FontPtr)LookupIDByType(fontID, RT_FONT);
> -    if (!cursorfont)
> -	return NullCursor;
> -    if (AllocGlyphCursor(fontID, 0, fontID, 1, 0, 0, 0, ~0, ~0, ~0,
> -			 &curs, serverClient, (XID)0) != Success)
> -	return NullCursor;
> -#endif
> +	
> +	if (nullRootCursor) {
> +		cm.width = 0;
> +		cm.height = 0;
> +		cm.xhot = 0;
> +		cm.yhot = 0;
> +
> +		AllocARGBCursor(NULL, NULL, NULL, &cm, 0, 0, 0, 0, 0, 0,
> +						&curs, serverClient, (XID)0);
> +
> +		if (curs == NullCursor)
> +			return NullCursor;
> +	} else {
> +		fontID = FakeClientID(0);
> +		err = OpenFont(serverClient, fontID, FontLoadAll | FontOpenSync,
> +					   (unsigned)strlen(defaultCursorFont), defaultCursorFont);
> +		if (err != Success)
> +			return NullCursor;
> +
> +		cursorfont = (FontPtr)LookupIDByType(fontID, RT_FONT);
> +		if (!cursorfont)
> +			return NullCursor;
> +		if (AllocGlyphCursor(fontID, 0, fontID, 1, 0, 0, 0, ~0, ~0, ~0,
> +							 &curs, serverClient, (XID)0) != Success)
> +			return NullCursor;
> +	}
>
>      if (!AddResource(FakeClientID(0), RT_CURSOR, (pointer)curs))
>  	return NullCursor;
> diff --git a/dix/globals.c b/dix/globals.c
> index 60fd9a9..c93a83d 100644
> --- a/dix/globals.c
> +++ b/dix/globals.c
> @@ -141,6 +141,7 @@ FontPtr defaultFont;   /* not declared in dix.h to avoid
> including font.h in
>  CursorPtr rootCursor;
>  Bool party_like_its_1989 = FALSE;
>  Bool whiteRoot = FALSE;
> +Bool nullRootCursor=FALSE;
>
>  _X_EXPORT int cursorScreenDevPriv[MAXSCREENS];
>
> diff --git a/doc/Xserver.man.pre b/doc/Xserver.man.pre
> index 6cf08ce..4fe1cbd 100644
> --- a/doc/Xserver.man.pre
> +++ b/doc/Xserver.man.pre
> @@ -188,6 +188,10 @@ sets the maximum big request to
>  .I size
>  MB.
>  .TP 8
> +.B \-nocursor
> +sets the root cursor to a null glyph instead of the standard cross. This
> +does not disable the pointer; it merely makes it invisble.
> +.TP 8
>  .B \-nolisten \fItrans-type\fP
>  disables a transport type.  For example, TCP/IP connections can be disabled
>  with
> diff --git a/include/dix-config.h.in b/include/dix-config.h.in
> index 06138c5..75a4a28 100644
> --- a/include/dix-config.h.in
> +++ b/include/dix-config.h.in
> @@ -406,9 +406,6 @@
>  /* Use only built-in fonts */
>  #undef BUILTIN_FONTS
>
> -/* Use an empty root cursor */
> -#undef NULL_ROOT_CURSOR
> -
>  /* Have a monotonic clock from clock_gettime() */
>  #undef MONOTONIC_CLOCK
>
> diff --git a/include/opaque.h b/include/opaque.h
> index 07a0715..7f2affc 100644
> --- a/include/opaque.h
> +++ b/include/opaque.h
> @@ -71,6 +71,7 @@ extern Bool defeatAccessControl;
>  extern long maxBigRequestSize;
>  extern Bool party_like_its_1989;
>  extern Bool whiteRoot;
> +extern Bool nullRootCursor;
>
>  extern Bool CoreDump;
>
> diff --git a/os/utils.c b/os/utils.c
> index 709b5df..968345d 100644
> --- a/os/utils.c
> +++ b/os/utils.c
> @@ -494,6 +494,7 @@ void UseMsg(void)
>      ErrorF("c #                    key-click volume (0-100)\n");
>      ErrorF("-cc int                default color visual class\n");
>      ErrorF("-core                  generate core dump on fatal error\n");
> +    ErrorF("-nocursor              no root cursor is displayed by default\n");
>      ErrorF("-dpi int               screen resolution in dots per inch\n");
>  #ifdef DPMSExtension
>      ErrorF("dpms                   enables VESA DPMS monitor control\n");
> @@ -675,6 +676,10 @@ ProcessCommandLine(int argc, char *argv[])
>  	    setrlimit (RLIMIT_CORE, &core_limit);
>  #endif
>  	}
> +	else if ( strcmp( argv[i], "-nocursor") == 0)
> +	{
> +	    nullRootCursor = TRUE;
> +	}
>  	else if ( strcmp( argv[i], "-dpi") == 0)
>  	{
>  	    if(++i < argc)
>
>
>   




More information about the xorg mailing list