1 |
|
/* |
2 |
|
* video_x.cpp - Video/graphics emulation, X11 specific stuff |
3 |
|
* |
4 |
< |
* SheepShaver (C) 1997-2002 Marc Hellwig and Christian Bauer |
4 |
> |
* SheepShaver (C) 1997-2003 Marc Hellwig and Christian Bauer |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
54 |
|
|
55 |
|
// Global variables |
56 |
|
static int32 frame_skip; |
57 |
+ |
static int16 mouse_wheel_mode; |
58 |
+ |
static int16 mouse_wheel_lines; |
59 |
|
static bool redraw_thread_active = false; // Flag: Redraw thread installed |
60 |
|
static pthread_t redraw_thread; // Redraw thread |
61 |
|
|
135 |
|
// From sys_unix.cpp |
136 |
|
extern void SysMountFirstFloppy(void); |
137 |
|
|
138 |
+ |
// From clip_unix.cpp |
139 |
+ |
extern void ClipboardSelectionClear(XSelectionClearEvent *); |
140 |
+ |
extern void ClipboardSelectionRequest(XSelectionRequestEvent *); |
141 |
+ |
extern void ClipboardSelectionNotify(XSelectionEvent *req); |
142 |
+ |
|
143 |
|
|
144 |
|
// Video acceleration through SIGSEGV |
145 |
|
#ifdef ENABLE_VOSF |
173 |
|
// Set absolute mouse mode |
174 |
|
ADBSetRelMouseMode(false); |
175 |
|
|
169 |
– |
// Read frame skip prefs |
170 |
– |
frame_skip = PrefsFindInt32("frameskip"); |
171 |
– |
if (frame_skip == 0) |
172 |
– |
frame_skip = 1; |
173 |
– |
|
176 |
|
// Create window |
177 |
|
XSetWindowAttributes wattr; |
178 |
|
wattr.event_mask = eventmask = win_eventmask; |
684 |
|
// Init keycode translation |
685 |
|
keycode_init(); |
686 |
|
|
687 |
+ |
// Read frame skip prefs |
688 |
+ |
frame_skip = PrefsFindInt32("frameskip"); |
689 |
+ |
if (frame_skip == 0) |
690 |
+ |
frame_skip = 1; |
691 |
+ |
|
692 |
+ |
// Read mouse wheel prefs |
693 |
+ |
mouse_wheel_mode = PrefsFindInt32("mousewheelmode"); |
694 |
+ |
mouse_wheel_lines = PrefsFindInt32("mousewheellines"); |
695 |
+ |
|
696 |
|
// Init variables |
697 |
|
private_data = NULL; |
698 |
|
cur_mode = 0; // Window 640x480 |
1186 |
|
for (;;) { |
1187 |
|
XEvent event; |
1188 |
|
|
1189 |
< |
if (!XCheckMaskEvent(x_display, eventmask, &event)) |
1189 |
> |
if (!XCheckMaskEvent(x_display, eventmask, &event)) { |
1190 |
> |
// Handle clipboard events |
1191 |
> |
if (XCheckTypedEvent(x_display, SelectionRequest, &event)) |
1192 |
> |
ClipboardSelectionRequest(&event.xselectionrequest); |
1193 |
> |
else if (XCheckTypedEvent(x_display, SelectionClear, &event)) |
1194 |
> |
ClipboardSelectionClear(&event.xselectionclear); |
1195 |
> |
else if (XCheckTypedEvent(x_display, SelectionNotify, &event)) |
1196 |
> |
ClipboardSelectionNotify(&event.xselection); |
1197 |
|
break; |
1198 |
+ |
} |
1199 |
|
|
1200 |
|
switch (event.type) { |
1201 |
|
// Mouse button |
1203 |
|
unsigned int button = ((XButtonEvent *)&event)->button; |
1204 |
|
if (button < 4) |
1205 |
|
ADBMouseDown(button - 1); |
1206 |
+ |
else if (button < 6) { // Wheel mouse |
1207 |
+ |
if (mouse_wheel_mode == 0) { |
1208 |
+ |
int key = (button == 5) ? 0x79 : 0x74; // Page up/down |
1209 |
+ |
ADBKeyDown(key); |
1210 |
+ |
ADBKeyUp(key); |
1211 |
+ |
} else { |
1212 |
+ |
int key = (button == 5) ? 0x3d : 0x3e; // Cursor up/down |
1213 |
+ |
for(int i=0; i<mouse_wheel_lines; i++) { |
1214 |
+ |
ADBKeyDown(key); |
1215 |
+ |
ADBKeyUp(key); |
1216 |
+ |
} |
1217 |
+ |
} |
1218 |
+ |
} |
1219 |
|
break; |
1220 |
|
} |
1221 |
|
case ButtonRelease: { |