Revision 3af12c86
b/sdl.c | ||
---|---|---|
57 | 57 |
static uint8_t allocator; |
58 | 58 |
static SDL_PixelFormat host_format; |
59 | 59 |
static int scaling_active = 0; |
60 |
static Notifier mouse_mode_notifier; |
|
60 | 61 |
|
61 | 62 |
static void sdl_update(DisplayState *ds, int x, int y, int w, int h) |
62 | 63 |
{ |
... | ... | |
486 | 487 |
sdl_update_caption(); |
487 | 488 |
} |
488 | 489 |
|
490 |
static void sdl_mouse_mode_change(Notifier *notify) |
|
491 |
{ |
|
492 |
if (kbd_mouse_is_absolute()) { |
|
493 |
if (!absolute_enabled) { |
|
494 |
sdl_hide_cursor(); |
|
495 |
if (gui_grab) { |
|
496 |
sdl_grab_end(); |
|
497 |
} |
|
498 |
absolute_enabled = 1; |
|
499 |
} |
|
500 |
} else if (absolute_enabled) { |
|
501 |
sdl_show_cursor(); |
|
502 |
absolute_enabled = 0; |
|
503 |
} |
|
504 |
} |
|
505 |
|
|
489 | 506 |
static void sdl_send_mouse_event(int dx, int dy, int dz, int x, int y, int state) |
490 | 507 |
{ |
491 | 508 |
int buttons; |
... | ... | |
498 | 515 |
buttons |= MOUSE_EVENT_MBUTTON; |
499 | 516 |
|
500 | 517 |
if (kbd_mouse_is_absolute()) { |
501 |
if (!absolute_enabled) { |
|
502 |
sdl_hide_cursor(); |
|
503 |
if (gui_grab) { |
|
504 |
sdl_grab_end(); |
|
505 |
} |
|
506 |
absolute_enabled = 1; |
|
507 |
} |
|
508 |
|
|
509 | 518 |
dx = x * 0x7FFF / (width - 1); |
510 | 519 |
dy = y * 0x7FFF / (height - 1); |
511 |
} else if (absolute_enabled) { |
|
512 |
sdl_show_cursor(); |
|
513 |
absolute_enabled = 0; |
|
514 | 520 |
} else if (guest_cursor) { |
515 | 521 |
x -= guest_x; |
516 | 522 |
y -= guest_y; |
... | ... | |
876 | 882 |
dpy_resize(ds); |
877 | 883 |
} |
878 | 884 |
|
885 |
mouse_mode_notifier.notify = sdl_mouse_mode_change; |
|
886 |
qemu_add_mouse_mode_change_notifier(&mouse_mode_notifier); |
|
887 |
|
|
879 | 888 |
sdl_update_caption(); |
880 | 889 |
SDL_EnableKeyRepeat(250, 50); |
881 | 890 |
gui_grab = 0; |
Also available in: Unified diff