aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/xkb
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/xkb')
-rw-r--r--xorg-server/xkb/XKBAlloc.c6
-rw-r--r--xorg-server/xkb/XKBGAlloc.c30
-rw-r--r--xorg-server/xkb/XKBMAlloc.c40
-rw-r--r--xorg-server/xkb/ddxLoad.c6
-rw-r--r--xorg-server/xkb/xkbActions.c13
5 files changed, 36 insertions, 59 deletions
diff --git a/xorg-server/xkb/XKBAlloc.c b/xorg-server/xkb/XKBAlloc.c
index 9dab41c5e..8c439ba0b 100644
--- a/xorg-server/xkb/XKBAlloc.c
+++ b/xorg-server/xkb/XKBAlloc.c
@@ -212,10 +212,8 @@ XkbNamesPtr names;
register XkbKeyTypePtr type;
type= map->types;
for (i=0;i<map->num_types;i++,type++) {
- if (type->level_names!=NULL) {
- free(type->level_names);
- type->level_names= NULL;
- }
+ free(type->level_names);
+ type->level_names = NULL;
}
}
}
diff --git a/xorg-server/xkb/XKBGAlloc.c b/xorg-server/xkb/XKBGAlloc.c
index a6d10c4b0..d5e49349e 100644
--- a/xorg-server/xkb/XKBGAlloc.c
+++ b/xorg-server/xkb/XKBGAlloc.c
@@ -50,10 +50,8 @@ _XkbFreeGeomLeafElems( Bool freeAll,
{
if ((freeAll)||(*elems==NULL)) {
*num_inout= *sz_inout= 0;
- if (*elems!=NULL) {
- free(*elems);
- *elems= NULL;
- }
+ free(*elems);
+ *elems = NULL;
return;
}
@@ -373,22 +371,16 @@ XkbDoodadPtr doodad= (XkbDoodadPtr)doodad_in;
switch (doodad->any.type) {
case XkbTextDoodad:
{
- if (doodad->text.text!=NULL) {
- free(doodad->text.text);
- doodad->text.text= NULL;
- }
- if (doodad->text.font!=NULL) {
- free(doodad->text.font);
- doodad->text.font= NULL;
- }
+ free(doodad->text.text);
+ doodad->text.text = NULL;
+ free(doodad->text.font);
+ doodad->text.font = NULL;
}
break;
case XkbLogoDoodad:
{
- if (doodad->logo.logo_name!=NULL) {
- free(doodad->logo.logo_name);
- doodad->logo.logo_name= NULL;
- }
+ free(doodad->logo.logo_name);
+ doodad->logo.logo_name = NULL;
}
break;
}
@@ -434,10 +426,8 @@ XkbFreeGeometry(XkbGeometryPtr geom,unsigned which,Bool freeMap)
if ((which&XkbGeomKeyAliasesMask)&&(geom->key_aliases!=NULL))
XkbFreeGeomKeyAliases(geom,0,geom->num_key_aliases,TRUE);
if (freeMap) {
- if (geom->label_font!=NULL) {
- free(geom->label_font);
- geom->label_font= NULL;
- }
+ free(geom->label_font);
+ geom->label_font = NULL;
free(geom);
}
return;
diff --git a/xorg-server/xkb/XKBMAlloc.c b/xorg-server/xkb/XKBMAlloc.c
index 28995de81..ad13b940c 100644
--- a/xorg-server/xkb/XKBMAlloc.c
+++ b/xorg-server/xkb/XKBMAlloc.c
@@ -292,11 +292,9 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys;
}
type= &xkb->map->types[type_ndx];
if (map_count==0) {
- if (type->map!=NULL)
- free(type->map);
+ free(type->map);
type->map= NULL;
- if (type->preserve!=NULL)
- free(type->preserve);
+ free(type->preserve);
type->preserve= NULL;
type->map_count= 0;
}
@@ -321,9 +319,9 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys;
return BadAlloc;
}
}
- else if (type->preserve!=NULL) {
+ else {
free(type->preserve);
- type->preserve= NULL;
+ type->preserve = NULL;
}
type->map_count= map_count;
}
@@ -807,19 +805,13 @@ XkbClientMapPtr map;
register int i;
XkbKeyTypePtr type;
for (i=0,type=map->types;i<map->num_types;i++,type++) {
- if (type->map!=NULL) {
- free(type->map);
- type->map= NULL;
- }
- if (type->preserve!=NULL) {
- free(type->preserve);
- type->preserve= NULL;
- }
+ free(type->map);
+ type->map = NULL;
+ free(type->preserve);
+ type->preserve = NULL;
type->map_count= 0;
- if (type->level_names!=NULL) {
- free(type->level_names);
- type->level_names= NULL;
- }
+ free(type->level_names);
+ type->level_names = NULL;
}
}
free(map->types);
@@ -828,10 +820,8 @@ XkbClientMapPtr map;
}
}
if (what&XkbKeySymsMask) {
- if (map->key_sym_map!=NULL) {
- free(map->key_sym_map);
- map->key_sym_map= NULL;
- }
+ free(map->key_sym_map);
+ map->key_sym_map = NULL;
if (map->syms!=NULL) {
free(map->syms);
map->size_syms= map->num_syms= 0;
@@ -864,10 +854,8 @@ XkbServerMapPtr map;
map->explicit= NULL;
}
if (what&XkbKeyActionsMask) {
- if (map->key_acts!=NULL) {
- free(map->key_acts);
- map->key_acts= NULL;
- }
+ free(map->key_acts);
+ map->key_acts = NULL;
if (map->acts!=NULL) {
free(map->acts);
map->num_acts= map->size_acts= 0;
diff --git a/xorg-server/xkb/ddxLoad.c b/xorg-server/xkb/ddxLoad.c
index 127180a34..3a1cf0f8f 100644
--- a/xorg-server/xkb/ddxLoad.c
+++ b/xorg-server/xkb/ddxLoad.c
@@ -267,8 +267,7 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
strncpy(nameRtrn,keymap,nameRtrnLen);
nameRtrn[nameRtrnLen-1]= '\0';
}
- if (buf != NULL)
- free(buf);
+ free(buf);
#ifdef WIN32
/* remove the temporary file */
unlink(tmpname);
@@ -291,8 +290,7 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
}
if (nameRtrn)
nameRtrn[0]= '\0';
- if (buf != NULL)
- free(buf);
+ free(buf);
return FALSE;
}
diff --git a/xorg-server/xkb/xkbActions.c b/xorg-server/xkb/xkbActions.c
index 7a5f2b241..83e5eaf41 100644
--- a/xorg-server/xkb/xkbActions.c
+++ b/xorg-server/xkb/xkbActions.c
@@ -42,6 +42,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <ctype.h>
#include "mi.h"
#include "mipointer.h"
+#include "inpututils.h"
#define EXTENSION_EVENT_BASE 64
DevPrivateKeyRec xkbDevicePrivateKeyRec;
@@ -1354,7 +1355,7 @@ xkbStateNotify sn;
* First one on drinking island wins!
*/
static void
-InjectPointerKeyEvents(DeviceIntPtr dev, int type, int button, int flags, int num_valuators, int *valuators)
+InjectPointerKeyEvents(DeviceIntPtr dev, int type, int button, int flags, ValuatorMask *mask)
{
ScreenPtr pScreen;
EventListPtr events;
@@ -1376,8 +1377,7 @@ InjectPointerKeyEvents(DeviceIntPtr dev, int type, int button, int flags, int nu
OsBlockSignals();
pScreen = miPointerGetScreen(ptr);
saveWait = miPointerSetWaitForUpdate(pScreen, FALSE);
- nevents = GetPointerEvents(events, ptr, type, button, flags, 0,
- num_valuators, valuators);
+ nevents = GetPointerEvents(events, ptr, type, button, flags, mask);
if (IsMaster(dev) && (lastSlave && lastSlave != ptr))
UpdateFromMaster(&events[nevents], lastSlave, DEVCHANGE_POINTER_EVENT, &nevents);
miPointerSetWaitForUpdate(pScreen, saveWait);
@@ -1393,6 +1393,7 @@ InjectPointerKeyEvents(DeviceIntPtr dev, int type, int button, int flags, int nu
static void
XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y)
{
+ ValuatorMask mask;
int gpe_flags = 0;
int Point[]={x, y};
@@ -1405,7 +1406,9 @@ XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y)
else
gpe_flags = POINTER_RELATIVE;
- InjectPointerKeyEvents(dev, MotionNotify, 0, gpe_flags, 2, Point);
+ valuator_mask_set_range(&mask, 0, 2, Point);
+
+ InjectPointerKeyEvents(dev, MotionNotify, 0, gpe_flags, &mask);
}
void
@@ -1435,5 +1438,5 @@ XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
return;
InjectPointerKeyEvents(dev, press ? ButtonPress : ButtonRelease,
- button, 0, 0, NULL);
+ button, 0, NULL);
}