~ubuntu-branches/ubuntu/trusty/vice/trusty-proposed

« back to all changes in this revision

Viewing changes to src/arch/unix/macosx/cocoa/mousedrv.m

  • Committer: Bazaar Package Importer
  • Author(s): Gerfried Fuchs
  • Date: 2008-10-16 20:28:53 UTC
  • mfrom: (1.2.1 upstream) (9.1.6 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081016202853-vo9c1g9pd15wl7zu
Tags: 1.22.dfsg1-0.1
* NMU to fix release-critical bugs.
* Add data/PRINTER/mps803 to mangle-source.sh check, it's not a multiple of
  2048. Also fix the bashism in the script by replacing $[ ] with $(( )) in
  the calculation part.
* Mangled the source with above fixed script (closes: #442924, #501143)
* do delete -size 6c files and not -empty, they contain "dummy\n"
* Remove README.Debian entry about Xaw3d and Gnome because it's not valid
  anymore (closes: #501135)
* Remove the following Build-Depends as they aren't used because of no xaw3d
  build: xaw3dg-dev, libxaw7-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * mousedrv.m - MacVICE mouse driver
 
3
 *
 
4
 * Written by
 
5
 *  Christian Vogelgsang <chris@vogelgsang.org>
 
6
 *
 
7
 * This file is part of VICE, the Versatile Commodore Emulator.
 
8
 * See README for copyright notice.
 
9
 *
 
10
 *  This program is free software; you can redistribute it and/or modify
 
11
 *  it under the terms of the GNU General Public License as published by
 
12
 *  the Free Software Foundation; either version 2 of the License, or
 
13
 *  (at your option) any later version.
 
14
 *
 
15
 *  This program is distributed in the hope that it will be useful,
 
16
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
 *  GNU General Public License for more details.
 
19
 *
 
20
 *  You should have received a copy of the GNU General Public License
 
21
 *  along with this program; if not, write to the Free Software
 
22
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 
23
 *  02111-1307  USA.
 
24
 *
 
25
 */
 
26
 
 
27
#include "mousedrv.h"
 
28
#include "vicemachine.h"
 
29
 
 
30
// mouse.c
 
31
extern int _mouse_enabled;
 
32
static int ptr_x=0,ptr_y=0;
 
33
static int hw_x=0,hw_y=0;
 
34
 
 
35
int mousedrv_resources_init(void)
 
36
{
 
37
    return 0;
 
38
}
 
39
 
 
40
int mousedrv_cmdline_options_init(void)
 
41
{
 
42
    return 0;
 
43
}
 
44
 
 
45
void mousedrv_init(void)
 
46
{
 
47
}
 
48
 
 
49
void mousedrv_mouse_changed(void)
 
50
{
 
51
    [[theVICEMachine machineNotifier] postToggleMouseNotification:_mouse_enabled];
 
52
}
 
53
 
 
54
#define MAX_DELTA  16
 
55
 
 
56
BYTE mousedrv_get_x(void)
 
57
{
 
58
    int dx = ptr_x - hw_x;
 
59
    if(dx < -MAX_DELTA)
 
60
        dx = -MAX_DELTA;
 
61
    else if(dx > MAX_DELTA)
 
62
        dx = MAX_DELTA;
 
63
    hw_x += dx;
 
64
    return (BYTE)((hw_x&0x3f) << 1);
 
65
}
 
66
 
 
67
BYTE mousedrv_get_y(void)
 
68
{
 
69
    int dy = ptr_y - hw_y;
 
70
    if(dy < -MAX_DELTA)
 
71
        dy = -MAX_DELTA;
 
72
    else if(dy > MAX_DELTA)
 
73
        dy = MAX_DELTA;
 
74
    hw_y += dy;
 
75
    return (BYTE)((hw_y&0x3f) << 1);
 
76
}
 
77
 
 
78
void mouse_move(int x, int y)
 
79
{
 
80
    ptr_x = x;
 
81
    ptr_y = y;
 
82
}