xorg-x11-server/0035-xkb-Factor-out-a-function-to-copy-a-keymap-s-control.patch
Adam Jackson 48dc8f4c68 1.15RC4
- Re-disable int10 on arm
2013-12-17 10:17:41 -05:00

92 lines
2.6 KiB
Diff

From 260ca040db20c397af0803da5c1bf15bc3bc08f2 Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Mon, 21 Oct 2013 14:41:53 +0200
Subject: [PATCH 35/38] xkb: Factor out a function to copy a keymap's controls
unto another
---
include/xkbsrv.h | 3 +++
xkb/xkb.c | 14 +-------------
xkb/xkbUtils.c | 23 +++++++++++++++++++++++
3 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index 83ee1d0..6a2e96e 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -829,6 +829,9 @@ extern void XkbFakeDeviceButton(DeviceIntPtr /* dev */ ,
int /* press */ ,
int /* button */ );
+extern _X_EXPORT void XkbCopyControls(XkbDescPtr /* dst */ ,
+ XkbDescPtr /* src */ );
+
#include "xkbfile.h"
#include "xkbrules.h"
diff --git a/xkb/xkb.c b/xkb/xkb.c
index 7a631b8..6a68e81 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -5950,25 +5950,13 @@ ProcXkbGetKbdByName(ClientPtr client)
if (rep.loaded) {
XkbDescPtr old_xkb;
xkbNewKeyboardNotify nkn;
- int i, nG, nTG;
old_xkb = xkb;
xkb = new;
dev->key->xkbInfo->desc = xkb;
new = old_xkb; /* so it'll get freed automatically */
- *xkb->ctrls = *old_xkb->ctrls;
- for (nG = nTG = 0, i = xkb->min_key_code; i <= xkb->max_key_code; i++) {
- nG = XkbKeyNumGroups(xkb, i);
- if (nG >= XkbNumKbdGroups) {
- nTG = XkbNumKbdGroups;
- break;
- }
- if (nG > nTG) {
- nTG = nG;
- }
- }
- xkb->ctrls->num_groups = nTG;
+ XkbCopyControls(xkb, old_xkb);
nkn.deviceID = nkn.oldDeviceID = dev->id;
nkn.minKeyCode = new->min_key_code;
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 1f8a839..6cf6e79 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -2090,3 +2090,26 @@ XkbMergeLockedPtrBtns(DeviceIntPtr master)
xkbi->lockedPtrButtons |= d->key->xkbInfo->lockedPtrButtons;
}
}
+
+void
+XkbCopyControls(XkbDescPtr dst, XkbDescPtr src)
+{
+ int i, nG, nTG;
+
+ if (!dst || !src)
+ return;
+
+ *dst->ctrls = *src->ctrls;
+
+ for (nG = nTG = 0, i = dst->min_key_code; i <= dst->max_key_code; i++) {
+ nG = XkbKeyNumGroups(dst, i);
+ if (nG >= XkbNumKbdGroups) {
+ nTG = XkbNumKbdGroups;
+ break;
+ }
+ if (nG > nTG) {
+ nTG = nG;
+ }
+ }
+ dst->ctrls->num_groups = nTG;
+}
--
1.8.4.2