summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/xkbsrv.h8
-rw-r--r--xkb/xkbLEDs.c39
2 files changed, 47 insertions, 0 deletions
diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index fef341a8f..7db9eef0b 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -576,6 +576,14 @@ extern XkbSrvLedInfoPtr XkbAllocSrvLedInfo(
unsigned int /* needed_parts */
);
+extern XkbSrvLedInfoPtr XkbCopySrvLedInfo(
+ DeviceIntPtr /* dev */,
+ XkbSrvLedInfoPtr /* src */,
+ KbdFeedbackPtr /* kf */,
+ LedFeedbackPtr /* lf */
+);
+
+
extern XkbSrvLedInfoPtr XkbFindSrvLedInfo(
DeviceIntPtr /* dev */,
unsigned int /* class */,
diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c
index 55ce12aad..d7ada5749 100644
--- a/xkb/xkbLEDs.c
+++ b/xkb/xkbLEDs.c
@@ -615,6 +615,45 @@ XkbFreeSrvLedInfo(XkbSrvLedInfoPtr sli)
return;
}
+/*
+ * XkbSrvLedInfoPtr
+ * XkbCopySrvLedInfo(dev,src,kf,lf)
+ *
+ * Takes the given XkbSrvLedInfoPtr and duplicates it. A deep copy is made,
+ * thus the new copy behaves like the original one and can be freed with
+ * XkbFreeSrvLedInfo.
+ */
+XkbSrvLedInfoPtr
+XkbCopySrvLedInfo( DeviceIntPtr from,
+ XkbSrvLedInfoPtr src,
+ KbdFeedbackPtr kf,
+ LedFeedbackPtr lf)
+{
+ XkbSrvLedInfoPtr sli_new;
+
+ if (!src)
+ goto finish;
+
+ sli_new = _XkbTypedCalloc(1, XkbSrvLedInfoRec);
+ if (!sli_new)
+ goto finish;
+
+ memcpy(src, sli_new, sizeof(XkbSrvLedInfoRec));
+ if (sli_new->class == KbdFeedbackClass)
+ sli_new->fb.kf = kf;
+ else
+ sli_new->fb.lf = lf;
+
+ if (sli_new->flags & XkbSLI_IsDefault) {
+ sli_new->names= _XkbTypedCalloc(XkbNumIndicators,Atom);
+ sli_new->maps= _XkbTypedCalloc(XkbNumIndicators,XkbIndicatorMapRec);
+ } /* else sli_new->names/maps is pointing to
+ dev->key->xkbInfo->desc->names->indicators;
+ dev->key->xkbInfo->desc->names->indicators; */
+
+finish:
+ return sli_new;
+}
/***====================================================================***/