- added mouse wheel support

This commit is contained in:
cebix 1999-10-25 20:22:35 +00:00
parent d42b29ae5d
commit 5e6cc100f8
3 changed files with 27 additions and 2 deletions

View File

@ -14,6 +14,7 @@ V0.8 -
[Alexander R. Pruss]
- Unix/audio_oss_esd.cpp: "silence" in 8-bit mode used wrong fill
value (0 instead of 0x80) [Alexander R. Pruss]
- Unix/video_x.cpp: added mouse wheel support [Alexander R. Pruss]
V0.8 (snapshot) - 21.Oct.1999
- sony.cpp/disk.cpp/cdrom.cpp: disk insertions are now checked for

View File

@ -30,7 +30,9 @@
prefs_desc platform_prefs_items[] = {
{"keycodes", TYPE_BOOLEAN, false}, // Use keycodes rather than keysyms to decode keyboard (video_x.cpp)
{"keycodefile", TYPE_STRING, false}, // File name of keycode translation table (video_x.cpp)
{"fbdevicefile", TYPE_STRING, false}, // File name of frame buffer device specifications
{"fbdevicefile", TYPE_STRING, false}, // File name of frame buffer device specifications (video_x.cpp)
{"mousewheelmode", TYPE_INT16, false}, // Mouse wheel support mode (0=Page up/down, 1=Cursor up/down) (video_x.cpp)
{"mousewheellines", TYPE_INT16, false}, // Number of lines to scroll in mouse whell mode 1 (video_x.cpp)
{NULL, TYPE_END, false} // End of list
};
@ -94,4 +96,6 @@ void AddPlatformPrefsDefaults(void)
{
PrefsAddBool("keycodes", false);
PrefsReplaceString("extfs", "/");
PrefsReplaceInt16("mousewheelmode", 1);
PrefsReplaceInt16("mousewheellines", 3);
}

View File

@ -71,7 +71,10 @@ const char FBDEVICES_FILE_NAME[] = DATADIR "/fbdevices";
// Global variables
static int32 frame_skip;
static int32 frame_skip; // Prefs items
static int16 mouse_wheel_mode = 1;
static int16 mouse_wheel_lines = 3;
static int display_type = DISPLAY_WINDOW; // See enum above
static uint8 *the_buffer; // Mac frame buffer
static bool redraw_thread_active = false; // Flag: Redraw thread installed
@ -611,6 +614,10 @@ bool VideoInit(bool classic)
// Init keycode translation
keycode_init();
// Read prefs
mouse_wheel_mode = PrefsFindInt16("mousewheelmode");
mouse_wheel_lines = PrefsFindInt16("mousewheellines");
// Find screen and root window
screen = XDefaultScreen(x_display);
rootwin = XRootWindow(x_display, screen);
@ -1137,6 +1144,19 @@ static void handle_events(void)
unsigned int button = ((XButtonEvent *)&event)->button;
if (button < 4)
ADBMouseDown(button - 1);
else if (button < 6) { // Wheel mouse
if (mouse_wheel_mode == 0) {
int key = (button == 5) ? 0x79 : 0x74; // Page up/down
ADBKeyDown(key);
ADBKeyUp(key);
} else {
int key = (button == 5) ? 0x3d : 0x3e; // Cursor up/down
for(int i=0; i<mouse_wheel_lines; i++) {
ADBKeyDown(key);
ADBKeyUp(key);
}
}
}
break;
}
case ButtonRelease: {