xserver: Branch 'master' - 4 commits
Peter Hutterer
whot at kemper.freedesktop.org
Thu Apr 16 17:09:21 PDT 2009
Xi/allowev.c | 12 ++++++------
Xi/exevents.c | 13 +++----------
Xi/xiproperty.h | 6 +++---
dix/devices.c | 4 +---
dix/events.c | 19 +++++++++----------
hw/vfb/InitInput.c | 4 +---
hw/xnest/Keyboard.c | 9 +--------
hw/xquartz/quartzKeyboard.c | 4 +---
include/dix.h | 3 +--
xkb/xkbInit.c | 31 ++++++++++++++++++++++++++++++-
10 files changed, 56 insertions(+), 49 deletions(-)
New commits:
commit 56a5955c8cd87137248edb2cbc65d384376d72ad
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Apr 14 17:05:04 2009 +1000
xkb: strdup the values returned by XkbGetRulesDflts
XkbGetRulesDftls may get a copy of what will later be freed when passed into
XkbSetRulesDftls.
On the second run of XkbGet/SetRulesDflts:
XkbGetRulesDflts(rmlvo)
rmlvo->rules = current-rules
XkbSetRulesDflts(rmlvo)
free(current-rules)
current-rules = strdup(rmlvo->rules)
Leaving us with garbage in current-rules.
This patch requires callers of XkbGetRulesDflts to free the associated memory.
See also
http://lists.freedesktop.org/archives/xorg-devel/2009-February/000305.html
Reported-by: Benjamin Close <Benjamin.Close at clearchain.com>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
Acked-by: Benjamin Close <Benjamin.Close at clearchain.com>
Signed-off-by: Daniel Stone <daniel at fooishbar.org>
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index 2e75612..9d4d9a2 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -111,6 +111,10 @@ static Bool XkbWantRulesProp= XKB_DFLT_RULES_PROP;
/***====================================================================***/
+/**
+ * Get the current default XKB rules.
+ * Caller must free the data in rmlvo.
+ */
void
XkbGetRulesDflts(XkbRMLVOSet *rmlvo)
{
@@ -124,6 +128,12 @@ XkbGetRulesDflts(XkbRMLVOSet *rmlvo)
else rmlvo->variant= XKB_DFLT_VARIANT;
if (XkbOptionsDflt) rmlvo->options= XkbOptionsDflt;
else rmlvo->options= XKB_DFLT_OPTIONS;
+
+ rmlvo->rules = strdup(rmlvo->rules);
+ rmlvo->model = strdup(rmlvo->model);
+ rmlvo->layout = strdup(rmlvo->layout);
+ rmlvo->variant = strdup(rmlvo->variant);
+ rmlvo->options = strdup(rmlvo->options);
}
static Bool
@@ -586,6 +596,17 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet *rmlvo,
XkbSetRulesDflts(rmlvo);
XkbSetRulesUsed(rmlvo);
+ if (rmlvo_dflts.rules)
+ xfree(rmlvo_dflts.rules);
+ if (rmlvo_dflts.model)
+ xfree(rmlvo_dflts.model);
+ if (rmlvo_dflts.layout)
+ xfree(rmlvo_dflts.layout);
+ if (rmlvo_dflts.variant)
+ xfree(rmlvo_dflts.variant);
+ if (rmlvo_dflts.options)
+ xfree(rmlvo_dflts.options);
+
return TRUE;
unwind_desc:
commit b406886bbffadaa52864a99f2a0520999eadc15d
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Apr 14 16:57:29 2009 +1000
input: allow NULL as XkbRMVLOSet in InitKeyboardDeviceStruct.
Virtually all callers use
XkbGetRulesDefault(&rmlvo);
InitKeyboardDeviceStruct(..., rmlvo);
Let's save them the trouble and accept NULL as a hint to take the
default RMLVO.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
Acked-by: Benjamin Close <Benjamin.Close at clearchain.com>
Signed-off-by: Daniel Stone <daniel at fooishbar.org>
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 4788665..cfae57d 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -226,11 +226,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
to->kbdfeed = classes->kbdfeed;
if (!to->kbdfeed)
- {
- XkbRMLVOSet rmlvo;
- XkbGetRulesDflts(&rmlvo);
- InitKeyboardDeviceStruct(to, &rmlvo, NULL, NULL);
- }
+ InitKeyboardDeviceStruct(to, NULL, NULL, NULL);
}
k = &to->kbdfeed;
@@ -473,11 +469,8 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to)
UnusedClassesPrivateKey);
to->key = classes->key;
if (!to->key)
- {
- XkbRMLVOSet rmlvo;
- XkbGetRulesDflts(&rmlvo);
- InitKeyboardDeviceStruct(to, &rmlvo, NULL, NULL);
- } else
+ InitKeyboardDeviceStruct(to, NULL, NULL, NULL);
+ else
classes->key = NULL;
}
diff --git a/dix/devices.c b/dix/devices.c
index b9d1c85..d14eddd 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -471,12 +471,10 @@ CoreKeyboardCtl(DeviceIntPtr pDev, KeybdCtrl *ctrl)
static int
CoreKeyboardProc(DeviceIntPtr pDev, int what)
{
- XkbRMLVOSet rmlvo;
switch (what) {
case DEVICE_INIT:
- XkbGetRulesDflts(&rmlvo);
- if (!InitKeyboardDeviceStruct(pDev, &rmlvo, CoreKeyboardBell,
+ if (!InitKeyboardDeviceStruct(pDev, NULL, CoreKeyboardBell,
CoreKeyboardCtl))
{
ErrorF("Keyboard initialization failed. This could be a missing "
diff --git a/hw/vfb/InitInput.c b/hw/vfb/InitInput.c
index aa90252..4c8c996 100644
--- a/hw/vfb/InitInput.c
+++ b/hw/vfb/InitInput.c
@@ -66,13 +66,11 @@ static int
vfbKeybdProc(DeviceIntPtr pDevice, int onoff)
{
DevicePtr pDev = (DevicePtr)pDevice;
- XkbRMLVOSet rmlvo;
switch (onoff)
{
case DEVICE_INIT:
- XkbGetRulesDflts(&rmlvo);
- InitKeyboardDeviceStruct(pDevice, &rmlvo, NULL, NULL);
+ InitKeyboardDeviceStruct(pDevice, NULL, NULL, NULL);
break;
case DEVICE_ON:
pDev->on = TRUE;
diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c
index 8404c8b..f94e260 100644
--- a/hw/xnest/Keyboard.c
+++ b/hw/xnest/Keyboard.c
@@ -121,7 +121,6 @@ xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
int i;
XKeyboardState values;
XkbDescPtr xkb;
- XkbRMLVOSet rmlvo;
int op, event, error, major, minor;
switch (onoff)
@@ -165,13 +164,7 @@ xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
}
XkbGetControls(xnestDisplay, XkbAllControlsMask, xkb);
- rmlvo.rules = XKB_DFLT_RULES;
- rmlvo.model = XKB_DFLT_MODEL;
- rmlvo.layout = XKB_DFLT_LAYOUT;
- rmlvo.variant = XKB_DFLT_VARIANT;
- rmlvo.options = XKB_DFLT_OPTIONS;
-
- InitKeyboardDeviceStruct(pDev, &rmlvo,
+ InitKeyboardDeviceStruct(pDev, NULL,
xnestBell, xnestChangeKeyboardControl);
XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls);
XkbFreeKeyboard(xkb, 0, False);
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 823c2e6..2b8cb13 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -317,7 +317,6 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
XkbComponentNamesRec names;
CFIndex value;
BOOL ok;
- XkbRMLVOSet rmlvo;
// Open a shared connection to the HID System.
// Note that the Event Status Driver is really just a wrapper
@@ -328,8 +327,7 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
bzero(&names, sizeof(names));
- XkbGetRulesDflts(&rmlvo);
- InitKeyboardDeviceStruct(pDev, &rmlvo, QuartzBell,
+ InitKeyboardDeviceStruct(pDev, NULL, QuartzBell,
DarwinChangeKeyboardControl);
/* Get our key repeat settings from GlobalPreferences */
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index 1f5f8dc..2e75612 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -474,10 +474,18 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet *rmlvo,
XkbSrvLedInfoPtr sli;
XkbChangesRec changes;
XkbEventCauseRec cause;
+ XkbRMLVOSet rmlvo_dflts = { NULL };
- if (dev->key || dev->kbdfeed || !rmlvo)
+ if (dev->key || dev->kbdfeed)
return False;
+ if (!rmlvo)
+ {
+ rmlvo = &rmlvo_dflts;
+ XkbGetRulesDflts(rmlvo);
+ }
+
+
memset(&changes, 0, sizeof(changes));
XkbSetCauseUnknown(&cause);
commit 4e4e263bc073bf452f19c932b937c4881ae71f64
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Wed Apr 15 22:16:49 2009 +1000
dix: remove un-used parameter "core" from AllowSome
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/Xi/allowev.c b/Xi/allowev.c
index 5f0753d..96f3b54 100644
--- a/Xi/allowev.c
+++ b/Xi/allowev.c
@@ -104,22 +104,22 @@ ProcXAllowDeviceEvents(ClientPtr client)
switch (stuff->mode) {
case ReplayThisDevice:
- AllowSome(client, time, thisdev, NOT_GRABBED, FALSE);
+ AllowSome(client, time, thisdev, NOT_GRABBED);
break;
case SyncThisDevice:
- AllowSome(client, time, thisdev, FREEZE_NEXT_EVENT, FALSE);
+ AllowSome(client, time, thisdev, FREEZE_NEXT_EVENT);
break;
case AsyncThisDevice:
- AllowSome(client, time, thisdev, THAWED, FALSE);
+ AllowSome(client, time, thisdev, THAWED);
break;
case AsyncOtherDevices:
- AllowSome(client, time, thisdev, THAW_OTHERS, FALSE);
+ AllowSome(client, time, thisdev, THAW_OTHERS);
break;
case SyncAll:
- AllowSome(client, time, thisdev, FREEZE_BOTH_NEXT_EVENT, FALSE);
+ AllowSome(client, time, thisdev, FREEZE_BOTH_NEXT_EVENT);
break;
case AsyncAll:
- AllowSome(client, time, thisdev, THAWED_BOTH, FALSE);
+ AllowSome(client, time, thisdev, THAWED_BOTH);
break;
default:
client->errorValue = stuff->mode;
diff --git a/dix/events.c b/dix/events.c
index e73044e..faa8425 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1573,8 +1573,7 @@ void
AllowSome(ClientPtr client,
TimeStamp time,
DeviceIntPtr thisDev,
- int newState,
- Bool core)
+ int newState)
{
Bool thisGrabbed, otherGrabbed, othersFrozen, thisSynced;
TimeStamp grabTime;
@@ -1716,28 +1715,28 @@ ProcAllowEvents(ClientPtr client)
switch (stuff->mode)
{
case ReplayPointer:
- AllowSome(client, time, mouse, NOT_GRABBED, True);
+ AllowSome(client, time, mouse, NOT_GRABBED);
break;
case SyncPointer:
- AllowSome(client, time, mouse, FREEZE_NEXT_EVENT, True);
+ AllowSome(client, time, mouse, FREEZE_NEXT_EVENT);
break;
case AsyncPointer:
- AllowSome(client, time, mouse, THAWED, True);
+ AllowSome(client, time, mouse, THAWED);
break;
case ReplayKeyboard:
- AllowSome(client, time, keybd, NOT_GRABBED, True);
+ AllowSome(client, time, keybd, NOT_GRABBED);
break;
case SyncKeyboard:
- AllowSome(client, time, keybd, FREEZE_NEXT_EVENT, True);
+ AllowSome(client, time, keybd, FREEZE_NEXT_EVENT);
break;
case AsyncKeyboard:
- AllowSome(client, time, keybd, THAWED, True);
+ AllowSome(client, time, keybd, THAWED);
break;
case SyncBoth:
- AllowSome(client, time, keybd, FREEZE_BOTH_NEXT_EVENT, True);
+ AllowSome(client, time, keybd, FREEZE_BOTH_NEXT_EVENT);
break;
case AsyncBoth:
- AllowSome(client, time, keybd, THAWED_BOTH, True);
+ AllowSome(client, time, keybd, THAWED_BOTH);
break;
default:
client->errorValue = stuff->mode;
diff --git a/include/dix.h b/include/dix.h
index 552a2d0..b1333dc 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -353,8 +353,7 @@ extern _X_EXPORT void AllowSome(
ClientPtr /* client */,
TimeStamp /* time */,
DeviceIntPtr /* thisDev */,
- int /* newState */,
- Bool /* core */);
+ int /* newState */);
extern _X_EXPORT void ReleaseActiveGrabs(
ClientPtr client);
commit dd6e8a14ec1c8f4ed9c51ca2764261e6e48d13b3
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Sat Apr 11 11:19:29 2009 +1000
Xi: fix a typo in a #ifdef
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/Xi/xiproperty.h b/Xi/xiproperty.h
index bf562b1..e66b447 100644
--- a/Xi/xiproperty.h
+++ b/Xi/xiproperty.h
@@ -23,8 +23,8 @@
* Author: Peter Hutterer
*/
-#ifndef XIPROPERTY_C
-#define XIPROPERTY_C
+#ifndef XIPROPERTY_H
+#define XIPROPERTY_H
int ProcXListDeviceProperties (ClientPtr client);
int ProcXChangeDeviceProperty (ClientPtr client);
@@ -43,4 +43,4 @@ void SRepXListDeviceProperties(ClientPtr client, int size,
void SRepXGetDeviceProperty(ClientPtr client, int size,
xGetDevicePropertyReply *rep);
-#endif /* XIPROPERTY_C */
+#endif /* XIPROPERTY_H */
More information about the xorg-commit
mailing list