From patchwork Sun Nov 12 10:42:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jind=C5=99ich_Makovi=C4=8Dka?= X-Patchwork-Id: 837146 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="mJJr5aTe"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yZVkw1mZwz9t7r for ; Sun, 12 Nov 2017 21:44:22 +1100 (AEDT) Received: from localhost ([::1]:48581 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eDpkS-0002Xp-Bx for incoming@patchwork.ozlabs.org; Sun, 12 Nov 2017 05:44:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53637) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eDpjh-0002WF-Vb for qemu-devel@nongnu.org; Sun, 12 Nov 2017 05:43:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eDpjh-00045h-5W for qemu-devel@nongnu.org; Sun, 12 Nov 2017 05:43:34 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:34611) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eDpjh-00044y-0L for qemu-devel@nongnu.org; Sun, 12 Nov 2017 05:43:33 -0500 Received: by mail-wm0-x243.google.com with SMTP id n74so10660119wmi.1 for ; Sun, 12 Nov 2017 02:43:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SqneOxSz5jvwjO/jTxKd0QgyPVf4oFyIS1ExiqIbYTo=; b=mJJr5aTeZ2AwKsJU6dnjNGrwWxBuj89sRwfhTmd8OWFTtIIw/okcEo/xQ/ZL4xqElE VRpXrQQPXgiHYyY5Hqr4whbVIMuzUz3nPTZ5T12NHlLmwy5E0ceJdw4Q+2vJtXaCm44e v915QgJ0Jg+U6y3eV0QGMKR1R4jIJh2E8y94swSAfoE+4ooZkBpjEfNPuCSJTwqCLR8Z B1qMQ56WdlQ8Fqfh0g77VZuWL+HloQc1c4hZcwYq/m3UgOlb1ZBzqDPptbJ+DR/9iEKr eMiyP9hknGP7LDqEC2x2myvfeREPX0FL4XgM4pt6tE9qLq7+mowA/OfMZ/XTQarNvf5B mB2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SqneOxSz5jvwjO/jTxKd0QgyPVf4oFyIS1ExiqIbYTo=; b=pjTw4wkxfpNuelwFomr3hAIGKHBgCCnqhyJeIbumM3cD1zkRyIxD/+wFJUNSNn8pP5 /6KWvnCyX80+N8Lem91Ea9wuIP60R1WxfBRueeCcUwcUstozNwX40DZ4UUBULtBfasYz BQ9qd9mfollQJqSbuOU1k894TWb97LWsOFoDTQTE40PHizqj/oVjVJIG0hZfLoIygM4d H9OJl5K5axFFl7mO5DVmMTOWBk7hMW855PhQrDlVBc3qBketPOw7bEvjRQKtUklPUQYM 8MIPTA87+sF0dvb0JzUg5tdDttzgQKVTJFfgSjjE2L3IZIkqeqBsMOJniVdIWZbQzsV0 qSoA== X-Gm-Message-State: AJaThX7p87jpwBUdRU3fKuKfAAi51NKYUPkxNYWOsmxtbb/zTUrZLwwV swh9EMR9AmN3ogvMgpU2lEgD0HzZ X-Google-Smtp-Source: AGs4zMbrMGIzhrsTPDhR+sDWYUeEAYsJZEtxeMiHEQ9FqXr+TDGMHm2lVth/QQXNasM9awLBwAobfw== X-Received: by 10.28.9.197 with SMTP id 188mr2703886wmj.20.1510483411756; Sun, 12 Nov 2017 02:43:31 -0800 (PST) Received: from localhost.localdomain (ip-89-177-122-165.net.upcbroadband.cz. [89.177.122.165]) by smtp.gmail.com with ESMTPSA id g28sm17466342wra.31.2017.11.12.02.43.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Nov 2017 02:43:31 -0800 (PST) From: Jindrich Makovicka To: QEMU Developers , Gerd Hoffmann , Cole Robinson Date: Sun, 12 Nov 2017 11:42:43 +0100 Message-Id: <20171112104246.10007-6-makovick@gmail.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171112104246.10007-1-makovick@gmail.com> References: <20171023210803.20998-1-makovick@gmail.com> <20171112104246.10007-1-makovick@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PATCH 5/8] sdl2 uses surface relative coordinates X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jindrich Makovicka Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This patch fixes mouse positioning with -device usb-tablet and fullscreen or resized window. --- ui/sdl2.c | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/ui/sdl2.c b/ui/sdl2.c index 677c22282d..51721d764e 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -276,32 +276,8 @@ static void sdl_send_mouse_event(struct sdl2_console *scon, int dx, int dy, } if (qemu_input_is_absolute()) { - int scr_w, scr_h; - int max_w = 0, max_h = 0; - int off_x = 0, off_y = 0; - int cur_off_x = 0, cur_off_y = 0; - int i; - - for (i = 0; i < sdl2_num_outputs; i++) { - struct sdl2_console *thiscon = &sdl2_console[i]; - if (thiscon->real_window && thiscon->surface) { - SDL_GetWindowSize(thiscon->real_window, &scr_w, &scr_h); - cur_off_x = thiscon->x; - cur_off_y = thiscon->y; - if (scr_w + cur_off_x > max_w) { - max_w = scr_w + cur_off_x; - } - if (scr_h + cur_off_y > max_h) { - max_h = scr_h + cur_off_y; - } - if (i == scon->idx) { - off_x = cur_off_x; - off_y = cur_off_y; - } - } - } - qemu_input_queue_abs(scon->dcl.con, INPUT_AXIS_X, off_x + x, 0, max_w); - qemu_input_queue_abs(scon->dcl.con, INPUT_AXIS_Y, off_y + y, 0, max_h); + qemu_input_queue_abs(scon->dcl.con, INPUT_AXIS_X, x, 0, surface_width(scon->surface)); + qemu_input_queue_abs(scon->dcl.con, INPUT_AXIS_Y, y, 0, surface_height(scon->surface)); } else { if (guest_cursor) { x -= guest_x;