ui: prefer gtk3 and sdl2, various fixes.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJZQOuuAAoJEEy22O7T6HE4EJUQAIN9hvQZJEwDFN8qk0PaIVWd 55J6zGl+v+ExDeb5bWx/vu2DdQIuWHbodpnhhKu7HbITnQ1/sRSdQExaHdjl7niS HgGaP6VPanxHNbJvfsGq5D4zV2BU4VxknUrBA6BM+gtk+2WvW0Sd/3TlXQ8biItZ limyNaV78QTUXeALHQbw+NHfa703T+wnuxnEhSjw2ERAXCSIsqhPK/oDMIMnY/IO HECIWWcKRpSIO/X64y2lobTQzNzpH2H5R2dUBAJqbkkrPmR4V/GpNuKQ1PJdS5t3 yT+sECL5igw5mwsptDMPBHU4iEggcf+v7J0xfBm/s8HEpLGGQDVN5DRveLm15mJj o6isbGhPvK6Hkg9aOnOuLVQysWFz2DhhSrDDmWpIu/XMYtwt09tHuT1gw7FfHdgN L54kpoFRnMiZiCfkaXXOe0F2W9KpsMdHTH+N3ltpbCc/gOYhZlXtHdFYv5yOXheD C7IdifS3aqsQbF2p9gQuGKqtNka+tRRJBc0dXdHAv2wzKp/Jz+u8D/P9y635Seao C81T7yJGN1ymPS2rpi9LYlqZZ3sG1ku/C3mACWNBubwtnW7oP5i4KgBnj11xTpOB P0LJnW/vH+DyD6x6wqn2ZgFgq184twJf/TxQBQmvMk58E5E1/gbeH66b+YFyjUVX dIOXyOaa03VCgL9VkmxM =J7o8 -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20170614-1' into staging ui: prefer gtk3 and sdl2, various fixes. # gpg: Signature made Wed 14 Jun 2017 08:54:22 BST # gpg: using RSA key 0x4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/pull-ui-20170614-1: spice: don't enter opengl mode in case another UI provides opengl support sdl: prefer sdl2 over sdl1 gtk: prefer gtk3 over gtk2 spice: Use proper enum type for kbd led state Improve Cocoa modifier key handling Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
30ff7d1d0b
24
configure
vendored
24
configure
vendored
|
@ -2301,14 +2301,14 @@ fi
|
|||
# GTK probe
|
||||
|
||||
if test "$gtkabi" = ""; then
|
||||
# The GTK ABI was not specified explicitly, so try whether 2.0 is available.
|
||||
# Use 3.0 as a fallback if that is available.
|
||||
if $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then
|
||||
gtkabi=2.0
|
||||
elif $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then
|
||||
# The GTK ABI was not specified explicitly, so try whether 3.0 is available.
|
||||
# Use 2.0 as a fallback if that is available.
|
||||
if $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then
|
||||
gtkabi=3.0
|
||||
else
|
||||
elif $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then
|
||||
gtkabi=2.0
|
||||
else
|
||||
gtkabi=3.0
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -2331,7 +2331,7 @@ if test "$gtk" != "no"; then
|
|||
libs_softmmu="$gtk_libs $libs_softmmu"
|
||||
gtk="yes"
|
||||
elif test "$gtk" = "yes"; then
|
||||
feature_not_found "gtk" "Install gtk2 or gtk3 devel"
|
||||
feature_not_found "gtk" "Install gtk3-devel"
|
||||
else
|
||||
gtk="no"
|
||||
fi
|
||||
|
@ -2598,12 +2598,12 @@ fi
|
|||
# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
|
||||
|
||||
if test "$sdlabi" = ""; then
|
||||
if $pkg_config --exists "sdl"; then
|
||||
sdlabi=1.2
|
||||
elif $pkg_config --exists "sdl2"; then
|
||||
if $pkg_config --exists "sdl2"; then
|
||||
sdlabi=2.0
|
||||
else
|
||||
elif $pkg_config --exists "sdl"; then
|
||||
sdlabi=1.2
|
||||
else
|
||||
sdlabi=2.0
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -2630,7 +2630,7 @@ elif has ${sdl_config}; then
|
|||
sdlversion=$($sdlconfig --version)
|
||||
else
|
||||
if test "$sdl" = "yes" ; then
|
||||
feature_not_found "sdl" "Install SDL devel"
|
||||
feature_not_found "sdl" "Install SDL2-devel"
|
||||
fi
|
||||
sdl=no
|
||||
fi
|
||||
|
|
|
@ -140,6 +140,8 @@ struct SimpleSpiceCursor {
|
|||
QXLCursor cursor;
|
||||
};
|
||||
|
||||
extern bool spice_opengl;
|
||||
|
||||
int qemu_spice_rect_is_empty(const QXLRect* r);
|
||||
void qemu_spice_rect_union(QXLRect *dest, const QXLRect *r);
|
||||
|
||||
|
|
60
ui/cocoa.m
60
ui/cocoa.m
|
@ -52,6 +52,8 @@
|
|||
/* macOS 10.12 deprecated many constants, #define the new names for older SDKs */
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12
|
||||
#define NSEventMaskAny NSAnyEventMask
|
||||
#define NSEventModifierFlagCapsLock NSAlphaShiftKeyMask
|
||||
#define NSEventModifierFlagShift NSShiftKeyMask
|
||||
#define NSEventModifierFlagCommand NSCommandKeyMask
|
||||
#define NSEventModifierFlagControl NSControlKeyMask
|
||||
#define NSEventModifierFlagOption NSAlternateKeyMask
|
||||
|
@ -268,7 +270,7 @@ static void handleAnyDeviceErrors(Error * err)
|
|||
NSWindow *fullScreenWindow;
|
||||
float cx,cy,cw,ch,cdx,cdy;
|
||||
CGDataProviderRef dataProviderRef;
|
||||
int modifiers_state[256];
|
||||
BOOL modifiers_state[256];
|
||||
BOOL isMouseGrabbed;
|
||||
BOOL isFullscreen;
|
||||
BOOL isAbsoluteEnabled;
|
||||
|
@ -536,18 +538,59 @@ QemuCocoaView *cocoaView;
|
|||
}
|
||||
}
|
||||
|
||||
- (void) toggleModifier: (int)keycode {
|
||||
// Toggle the stored state.
|
||||
modifiers_state[keycode] = !modifiers_state[keycode];
|
||||
// Send a keyup or keydown depending on the state.
|
||||
qemu_input_event_send_key_qcode(dcl->con, keycode, modifiers_state[keycode]);
|
||||
}
|
||||
|
||||
- (void) toggleStatefulModifier: (int)keycode {
|
||||
// Toggle the stored state.
|
||||
modifiers_state[keycode] = !modifiers_state[keycode];
|
||||
// Generate keydown and keyup.
|
||||
qemu_input_event_send_key_qcode(dcl->con, keycode, true);
|
||||
qemu_input_event_send_key_qcode(dcl->con, keycode, false);
|
||||
}
|
||||
|
||||
- (void) handleEvent:(NSEvent *)event
|
||||
{
|
||||
COCOA_DEBUG("QemuCocoaView: handleEvent\n");
|
||||
|
||||
int buttons = 0;
|
||||
int keycode;
|
||||
int keycode = 0;
|
||||
bool mouse_event = false;
|
||||
NSPoint p = [event locationInWindow];
|
||||
|
||||
switch ([event type]) {
|
||||
case NSEventTypeFlagsChanged:
|
||||
keycode = cocoa_keycode_to_qemu([event keyCode]);
|
||||
if ([event keyCode] == 0) {
|
||||
// When the Cocoa keyCode is zero that means keys should be
|
||||
// synthesized based on the values in in the eventModifiers
|
||||
// bitmask.
|
||||
|
||||
if (qemu_console_is_graphic(NULL)) {
|
||||
NSEventModifierFlags modifiers = [event modifierFlags];
|
||||
|
||||
if (!!(modifiers & NSEventModifierFlagCapsLock) != !!modifiers_state[Q_KEY_CODE_CAPS_LOCK]) {
|
||||
[self toggleStatefulModifier:Q_KEY_CODE_CAPS_LOCK];
|
||||
}
|
||||
if (!!(modifiers & NSEventModifierFlagShift) != !!modifiers_state[Q_KEY_CODE_SHIFT]) {
|
||||
[self toggleModifier:Q_KEY_CODE_SHIFT];
|
||||
}
|
||||
if (!!(modifiers & NSEventModifierFlagControl) != !!modifiers_state[Q_KEY_CODE_CTRL]) {
|
||||
[self toggleModifier:Q_KEY_CODE_CTRL];
|
||||
}
|
||||
if (!!(modifiers & NSEventModifierFlagOption) != !!modifiers_state[Q_KEY_CODE_ALT]) {
|
||||
[self toggleModifier:Q_KEY_CODE_ALT];
|
||||
}
|
||||
if (!!(modifiers & NSEventModifierFlagCommand) != !!modifiers_state[Q_KEY_CODE_META_L]) {
|
||||
[self toggleModifier:Q_KEY_CODE_META_L];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
keycode = cocoa_keycode_to_qemu([event keyCode]);
|
||||
}
|
||||
|
||||
if ((keycode == Q_KEY_CODE_META_L || keycode == Q_KEY_CODE_META_R)
|
||||
&& !isMouseGrabbed) {
|
||||
|
@ -559,16 +602,9 @@ QemuCocoaView *cocoaView;
|
|||
// emulate caps lock and num lock keydown and keyup
|
||||
if (keycode == Q_KEY_CODE_CAPS_LOCK ||
|
||||
keycode == Q_KEY_CODE_NUM_LOCK) {
|
||||
qemu_input_event_send_key_qcode(dcl->con, keycode, true);
|
||||
qemu_input_event_send_key_qcode(dcl->con, keycode, false);
|
||||
[self toggleStatefulModifier:keycode];
|
||||
} else if (qemu_console_is_graphic(NULL)) {
|
||||
if (modifiers_state[keycode] == 0) { // keydown
|
||||
qemu_input_event_send_key_qcode(dcl->con, keycode, true);
|
||||
modifiers_state[keycode] = 1;
|
||||
} else { // keyup
|
||||
qemu_input_event_send_key_qcode(dcl->con, keycode, false);
|
||||
modifiers_state[keycode] = 0;
|
||||
}
|
||||
[self toggleModifier:keycode];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -847,6 +847,7 @@ void qemu_spice_init(void)
|
|||
exit(1);
|
||||
}
|
||||
display_opengl = 1;
|
||||
spice_opengl = 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "ui/spice-display.h"
|
||||
|
||||
static int debug = 0;
|
||||
bool spice_opengl;
|
||||
|
||||
static void GCC_FMT_ATTR(2, 3) dprint(int level, const char *fmt, ...)
|
||||
{
|
||||
|
@ -1013,7 +1014,7 @@ static void qemu_spice_display_init_one(QemuConsole *con)
|
|||
|
||||
ssd->dcl.ops = &display_listener_ops;
|
||||
#ifdef HAVE_SPICE_GL
|
||||
if (display_opengl) {
|
||||
if (spice_opengl) {
|
||||
ssd->dcl.ops = &display_listener_gl_ops;
|
||||
ssd->gl_unblock_bh = qemu_bh_new(qemu_spice_gl_unblock_bh, ssd);
|
||||
ssd->gl_unblock_timer = timer_new_ms(QEMU_CLOCK_REALTIME,
|
||||
|
|
|
@ -87,7 +87,7 @@ static void kbd_leds(void *opaque, int ledstate)
|
|||
if (ledstate & QEMU_CAPS_LOCK_LED) {
|
||||
kbd->ledstate |= SPICE_KEYBOARD_MODIFIER_FLAGS_CAPS_LOCK;
|
||||
}
|
||||
spice_server_kbd_leds(&kbd->sin, ledstate);
|
||||
spice_server_kbd_leds(&kbd->sin, kbd->ledstate);
|
||||
}
|
||||
|
||||
/* mouse bits */
|
||||
|
|
Loading…
Reference in a new issue