Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/cursor.c
blob: 6d12daaa917842959103cb5d7af582dcd3275ebb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
  cursor.c

  For Tux Paint
  Bitmapped mouse pointer (cursor)

  Copyright (c) 2002-2007 by Bill Kendrick and others
  bill@newbreedsoftware.com
  http://www.tuxpaint.org/

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program 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 General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  (See COPYING.txt)

  June 14, 2002 - May 15, 2007
  $Id: cursor.c,v 1.6 2011/08/29 22:48:18 scottmc Exp $
*/

#include "cursor.h"
#include "debug.h"

#define UNUSED(arg) ((void)(arg))

SDL_Cursor *cursor_hand, *cursor_arrow, *cursor_watch,
  *cursor_up, *cursor_down, *cursor_tiny, *cursor_crosshair,
  *cursor_brush, *cursor_wand, *cursor_insertion, *cursor_rotate;

#ifdef NOKIA_770
int hide_cursor = 1;
#else
int hide_cursor;
#endif

#if defined(NOKIA_770) || defined(__BEOS__) || defined(__HAIKU__)
// Fancy cursors on BeOS are buggy in SDL
int no_fancy_cursors = 1;
#else
int no_fancy_cursors;
#endif

void do_setcursor(SDL_Cursor * c)
{
  /* Shut GCC up over the fact that the XBMs are #included within cursor.h
     but used in tuxpaint.c (and not cursor.c) */

  UNUSED(watch_bits);
  UNUSED(watch_mask_bits);
  UNUSED(hand_bits);
  UNUSED(hand_mask_bits);
  UNUSED(wand_bits);
  UNUSED(wand_mask_bits);
  UNUSED(insertion_bits);
  UNUSED(insertion_mask_bits);
  UNUSED(brush_bits);
  UNUSED(brush_mask_bits);
  UNUSED(crosshair_bits);
  UNUSED(crosshair_mask_bits);
  UNUSED(rotate_bits);
  UNUSED(rotate_mask_bits);
  UNUSED(up_bits);
  UNUSED(up_mask_bits);
  UNUSED(down_bits);
  UNUSED(down_mask_bits);
  UNUSED(tiny_bits);
  UNUSED(tiny_mask_bits);
  UNUSED(arrow_bits);
  UNUSED(arrow_mask_bits);

  if (!hide_cursor && !no_fancy_cursors)
    SDL_SetCursor(c);
}

void free_cursor(SDL_Cursor ** cursor)
{
  if (*cursor)
  {
    SDL_FreeCursor(*cursor);
    *cursor = NULL;
  }
}