[PATCH] Add a -nocursor option to remove the cursor completely.

Simon Farnsworth simon.farnsworth at onelan.co.uk
Wed Oct 22 08:37:56 PDT 2008


Argh.

Something (either my mail service provider, or Thunderbird) swallowed
the message this is supposed to be a reply to.

This patch is incomplete - as per my mail "Fully disabling the cursor in
xorg-server", the cursor still gets drawn sometimes.

Simon Farnsworth wrote:
> Add -nocursor and -cursor to disable and enable cursor support in DIX. This is
> useful in kiosk applications, where -nocursor lets you use unmodified X11
> applications without worrying that they'll enable an ugly cursor on your
> screen.
> 
> -cursor is the default if no option is specified
> ---
>  dix/cursor.c  |   29 +++++++++++++++++------------
>  include/dix.h |    3 +++
>  os/utils.c    |   10 ++++++++++
>  3 files changed, 30 insertions(+), 12 deletions(-)
> 
> diff --git a/dix/cursor.c b/dix/cursor.c
> index 0ddf9d7..a5bb388 100644
> --- a/dix/cursor.c
> +++ b/dix/cursor.c
> @@ -75,6 +75,8 @@ static GlyphSharePtr sharedGlyphs = (GlyphSharePtr)NULL;
>  static CARD32	cursorSerial;
>  #endif
>  
> +Bool enableCursor = TRUE;
> +
>  static void
>  FreeCursorBits(CursorBitsPtr bits)
>  {
> @@ -138,21 +140,24 @@ FreeCursor(pointer value, XID cid)
>  static void
>  CheckForEmptyMask(CursorBitsPtr bits)
>  {
> -    unsigned char *msk = bits->mask;
> -    int n = BitmapBytePad(bits->width) * bits->height;
> +    if( enableCursor )
> +    {
> +        unsigned char *msk = bits->mask;
> +        int n = BitmapBytePad(bits->width) * bits->height;
>  
> -    bits->emptyMask = FALSE;
> -    while(n--) 
> -	if(*(msk++) != 0) return;
> +        bits->emptyMask = FALSE;
> +        while(n--) 
> +            if(*(msk++) != 0) return;
>  #ifdef ARGB_CURSOR
> -    if (bits->argb)
> -    {
> -	CARD32 *argb = bits->argb;
> -	int n = bits->width * bits->height;
> -	while (n--)
> -	    if (*argb++ & 0xff000000) return;
> -    }
> +        if (bits->argb)
> +        {
> +            CARD32 *argb = bits->argb;
> +            int n = bits->width * bits->height;
> +            while (n--)
> +                if (*argb++ & 0xff000000) return;
> +        }
>  #endif
> +    }
>      bits->emptyMask = TRUE;
>  }
>  
> diff --git a/include/dix.h b/include/dix.h
> index 64035fe..131bf86 100644
> --- a/include/dix.h
> +++ b/include/dix.h
> @@ -601,4 +601,7 @@ extern ClientPtr LookupClient(
>      XID id,
>      ClientPtr client);
>  
> +/* cursor.c */
> +extern Bool enableCursor;
> +
>  #endif /* DIX_H */
> diff --git a/os/utils.c b/os/utils.c
> index f58c763..a545036 100644
> --- a/os/utils.c
> +++ b/os/utils.c
> @@ -581,6 +581,8 @@ void UseMsg(void)
>      ErrorF("-c                     turns off key-click\n");
>      ErrorF("c #                    key-click volume (0-100)\n");
>      ErrorF("-cc int                default color visual class\n");
> +    ErrorF("-cursor                enable the cursor\n");
> +    ErrorF("-nocursor              disable the cursor\n");
>  #ifdef COMMANDLINE_CHALLENGED_OPERATING_SYSTEMS
>      ErrorF("-config file           read options from file\n");
>  #endif
> @@ -793,6 +795,14 @@ ProcessCommandLine(int argc, char *argv[])
>  	    setrlimit (RLIMIT_CORE, &core_limit);
>  #endif
>  	}
> +	else if ( strcmp( argv[i], "-nocursor") == 0)
> +	{
> +	    enableCursor = FALSE;
> +	}
> +	else if ( strcmp( argv[i], "-cursor") == 0)
> +	{
> +	    enableCursor = TRUE;
> +	}
>  	else if ( strcmp( argv[i], "-dpi") == 0)
>  	{
>  	    if(++i < argc)


-- 
Simon Farnsworth
Software Engineer

ONELAN Limited
1st Floor Andersen House
Newtown Road
Henley-on-Thames, OXON
RG9 1HG
United Kingdom

Tel:    +44(0)1491 411400
Fax:    +44(0)1491 579254
Support:+44(0)1491 845282

www.onelan.com




More information about the xorg mailing list