mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-22 13:31:08 +00:00
prefs item "mousewheellines" accepts negative value
This commit is contained in:
parent
6d3fbba4cd
commit
ce3e2f3693
@ -108,6 +108,7 @@ const char KEYCODE_FILE_NAME2[] = DATADIR "/BasiliskII_keycodes";
|
|||||||
static uint32 frame_skip; // Prefs items
|
static uint32 frame_skip; // Prefs items
|
||||||
static int16 mouse_wheel_mode;
|
static int16 mouse_wheel_mode;
|
||||||
static int16 mouse_wheel_lines;
|
static int16 mouse_wheel_lines;
|
||||||
|
static bool mouse_wheel_reverse;
|
||||||
|
|
||||||
static uint8 *the_buffer = NULL; // Mac frame buffer (where MacOS draws into)
|
static uint8 *the_buffer = NULL; // Mac frame buffer (where MacOS draws into)
|
||||||
static uint8 *the_buffer_copy = NULL; // Copy of Mac frame buffer (for refreshed modes)
|
static uint8 *the_buffer_copy = NULL; // Copy of Mac frame buffer (for refreshed modes)
|
||||||
@ -1378,6 +1379,8 @@ bool VideoInit(bool classic)
|
|||||||
frame_skip = PrefsFindInt32("frameskip");
|
frame_skip = PrefsFindInt32("frameskip");
|
||||||
mouse_wheel_mode = PrefsFindInt32("mousewheelmode");
|
mouse_wheel_mode = PrefsFindInt32("mousewheelmode");
|
||||||
mouse_wheel_lines = PrefsFindInt32("mousewheellines");
|
mouse_wheel_lines = PrefsFindInt32("mousewheellines");
|
||||||
|
mouse_wheel_reverse = mouse_wheel_lines < 0;
|
||||||
|
if (mouse_wheel_reverse) mouse_wheel_lines = -mouse_wheel_lines;
|
||||||
|
|
||||||
// Get screen mode from preferences
|
// Get screen mode from preferences
|
||||||
migrate_screen_prefs();
|
migrate_screen_prefs();
|
||||||
@ -2322,12 +2325,12 @@ static void handle_events(void)
|
|||||||
case SDL_MOUSEWHEEL:
|
case SDL_MOUSEWHEEL:
|
||||||
if (!event.wheel.y) break;
|
if (!event.wheel.y) break;
|
||||||
if (!mouse_wheel_mode) {
|
if (!mouse_wheel_mode) {
|
||||||
int key = event.wheel.y < 0 ? 0x79 : 0x74; // Page up/down
|
int key = (event.wheel.y < 0) ^ mouse_wheel_reverse ? 0x79 : 0x74; // Page up/down
|
||||||
ADBKeyDown(key);
|
ADBKeyDown(key);
|
||||||
ADBKeyUp(key);
|
ADBKeyUp(key);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int key = event.wheel.y < 0 ? 0x3d : 0x3e; // Cursor up/down
|
int key = (event.wheel.y < 0) ^ mouse_wheel_reverse ? 0x3d : 0x3e; // Cursor up/down
|
||||||
for (int i = 0; i < mouse_wheel_lines; i++) {
|
for (int i = 0; i < mouse_wheel_lines; i++) {
|
||||||
ADBKeyDown(key);
|
ADBKeyDown(key);
|
||||||
ADBKeyUp(key);
|
ADBKeyUp(key);
|
||||||
|
Loading…
Reference in New Issue
Block a user