From nobody Fri Oct 24 21:41:00 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1518792434383507.6633847744291; Fri, 16 Feb 2018 06:47:14 -0800 (PST) Received: from localhost ([::1]:56383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emhI8-0001pZ-So for importer@patchew.org; Fri, 16 Feb 2018 09:47:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emhFc-0000OY-3t for qemu-devel@nongnu.org; Fri, 16 Feb 2018 09:44:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emhFb-0003o5-1t for qemu-devel@nongnu.org; Fri, 16 Feb 2018 09:44:36 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43550 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1emhFa-0003nq-TO for qemu-devel@nongnu.org; Fri, 16 Feb 2018 09:44:34 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 01D52EAEA4 for ; Fri, 16 Feb 2018 14:44:23 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-147.ams2.redhat.com [10.36.116.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7999D213AEE4; Fri, 16 Feb 2018 14:44:19 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id BF8944F29D; Fri, 16 Feb 2018 15:44:18 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 16 Feb 2018 15:44:14 +0100 Message-Id: <20180216144418.21986-2-kraxel@redhat.com> In-Reply-To: <20180216144418.21986-1-kraxel@redhat.com> References: <20180216144418.21986-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 16 Feb 2018 14:44:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 16 Feb 2018 14:44:24 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 1/5] keymap: make struct kbd_layout_t private to ui/keymaps.c 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: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Also use kbd_layout_t pointers instead of void pointers. Signed-off-by: Gerd Hoffmann --- ui/keymaps.h | 28 +++++----------------------- ui/keymaps.c | 31 ++++++++++++++++++++++++------- 2 files changed, 29 insertions(+), 30 deletions(-) diff --git a/ui/keymaps.h b/ui/keymaps.h index 8757465529..5c0898bfcf 100644 --- a/ui/keymaps.h +++ b/ui/keymaps.h @@ -32,25 +32,6 @@ typedef struct { int keysym; } name2keysym_t; =20 -struct key_range { - int start; - int end; - struct key_range *next; -}; - -#define MAX_NORMAL_KEYCODE 512 -#define MAX_EXTRA_COUNT 256 -typedef struct { - uint16_t keysym2keycode[MAX_NORMAL_KEYCODE]; - struct { - int keysym; - uint16_t keycode; - } keysym2keycode_extra[MAX_EXTRA_COUNT]; - int extra_count; - struct key_range *keypad_range; - struct key_range *numlock_range; -} kbd_layout_t; - /* scancode without modifiers */ #define SCANCODE_KEYMASK 0xff /* scancode without grey or up bit */ @@ -69,10 +50,11 @@ typedef struct { #define SCANCODE_ALT 0x400 #define SCANCODE_ALTGR 0x800 =20 +typedef struct kbd_layout_t kbd_layout_t; =20 -void *init_keyboard_layout(const name2keysym_t *table, const char *languag= e); -int keysym2scancode(void *kbd_layout, int keysym); -int keycode_is_keypad(void *kbd_layout, int keycode); -int keysym_is_numlock(void *kbd_layout, int keysym); +kbd_layout_t* init_keyboard_layout(const name2keysym_t *table, const char = *language); +int keysym2scancode(kbd_layout_t *k, int keysym); +int keycode_is_keypad(kbd_layout_t *k, int keycode); +int keysym_is_numlock(kbd_layout_t *k, int keysym); =20 #endif /* QEMU_KEYMAPS_H */ diff --git a/ui/keymaps.c b/ui/keymaps.c index f9762d1497..74d93dee63 100644 --- a/ui/keymaps.c +++ b/ui/keymaps.c @@ -28,6 +28,26 @@ #include "trace.h" #include "qemu/error-report.h" =20 +#define MAX_NORMAL_KEYCODE 512 +#define MAX_EXTRA_COUNT 256 + +struct key_range { + int start; + int end; + struct key_range *next; +}; + +struct kbd_layout_t { + uint16_t keysym2keycode[MAX_NORMAL_KEYCODE]; + struct { + int keysym; + uint16_t keycode; + } keysym2keycode_extra[MAX_EXTRA_COUNT]; + int extra_count; + struct key_range *keypad_range; + struct key_range *numlock_range; +}; + static int get_keysym(const name2keysym_t *table, const char *name) { @@ -186,15 +206,14 @@ static kbd_layout_t *parse_keyboard_layout(const name= 2keysym_t *table, } =20 =20 -void *init_keyboard_layout(const name2keysym_t *table, const char *languag= e) +kbd_layout_t* init_keyboard_layout(const name2keysym_t *table, const char = *language) { return parse_keyboard_layout(table, language, NULL); } =20 =20 -int keysym2scancode(void *kbd_layout, int keysym) +int keysym2scancode(kbd_layout_t *k, int keysym) { - kbd_layout_t *k =3D kbd_layout; if (keysym < MAX_NORMAL_KEYCODE) { if (k->keysym2keycode[keysym] =3D=3D 0) { trace_keymap_unmapped(keysym); @@ -217,9 +236,8 @@ int keysym2scancode(void *kbd_layout, int keysym) return 0; } =20 -int keycode_is_keypad(void *kbd_layout, int keycode) +int keycode_is_keypad(kbd_layout_t *k, int keycode) { - kbd_layout_t *k =3D kbd_layout; struct key_range *kr; =20 for (kr =3D k->keypad_range; kr; kr =3D kr->next) { @@ -230,9 +248,8 @@ int keycode_is_keypad(void *kbd_layout, int keycode) return 0; } =20 -int keysym_is_numlock(void *kbd_layout, int keysym) +int keysym_is_numlock(kbd_layout_t *k, int keysym) { - kbd_layout_t *k =3D kbd_layout; struct key_range *kr; =20 for (kr =3D k->numlock_range; kr; kr =3D kr->next) { --=20 2.9.3