[Xquartz-changes] xserver: Branch 'master' - 28 commits
Jeremy Huddleston
jeremyhu at freedesktop.org
Tue Jul 13 08:28:24 PDT 2010
Rebased ref, commits from common ancestor:
commit b2b9c458a46e9a41c3c76ffe83a2b580a41d0e90
Author: Jan Hauffa <hauffa at in.tum.de>
Date: Wed Jun 16 09:25:41 2010 -0700
XQuartz: Remove some dead code.
Signed-off-by: Jan Hauffa <hauffa at in.tum.de>
Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index 2828c57..bdaa262 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -67,12 +67,8 @@
#define FAKE_RANDR 1
// Shared global variables for Quartz modes
-int quartzEventWriteFD = -1;
int quartzUseSysBeep = 0;
-int quartzUseAGL = 1;
-int quartzEnableKeyEquivalents = 1;
int quartzServerVisible = FALSE;
-int quartzServerQuitting = FALSE;
DevPrivateKeyRec quartzScreenKeyRec;
int aquaMenuBarHeight = 0;
QuartzModeProcsPtr quartzProcs = NULL;
diff --git a/hw/xquartz/quartzCocoa.m b/hw/xquartz/quartzCocoa.m
index 4501472..54c900d 100644
--- a/hw/xquartz/quartzCocoa.m
+++ b/hw/xquartz/quartzCocoa.m
@@ -44,17 +44,6 @@
#include "darwin.h"
/*
- * QuartzFSUseQDCursor
- * Return whether the screen should use a QuickDraw cursor.
- */
-int QuartzFSUseQDCursor(
- int depth) // screen depth
-{
- return TRUE;
-}
-
-
-/*
* QuartzBlockHandler
* Clean out any autoreleased objects.
*/
diff --git a/hw/xquartz/quartzCommon.h b/hw/xquartz/quartzCommon.h
index c038ed0..eb761ed 100644
--- a/hw/xquartz/quartzCommon.h
+++ b/hw/xquartz/quartzCommon.h
@@ -51,20 +51,13 @@ typedef struct {
#define QUARTZ_PRIV(pScreen) \
((QuartzScreenPtr)dixLookupPrivate(&pScreen->devPrivates, quartzScreenKey))
-// Data stored at startup for Cocoa front end
-extern int quartzEventWriteFD;
-
// User preferences used by Quartz modes
extern int quartzUseSysBeep;
-extern int focusOnNewWindow;
-extern int quartzUseAGL;
-extern int quartzEnableKeyEquivalents;
extern int quartzFullscreenDisableHotkeys;
extern int quartzOptionSendsAlt;
// Other shared data
extern int quartzServerVisible;
-extern int quartzServerQuitting;
extern DevPrivateKeyRec quartzScreenKeyRec;
#define quartzScreenKey (&quartzScreenKeyRec)
extern int aquaMenuBarHeight;
@@ -72,14 +65,6 @@ extern int aquaMenuBarHeight;
// Name of GLX bundle for native OpenGL
extern const char *quartzOpenGLBundle;
-void QuartzReadPreferences(void);
-void QuartzMessageMainThread(unsigned msg, void *data, unsigned length);
-void QuartzMessageServerThread(int type, int argc, ...);
-void QuartzSetWindowMenu(int nitems, const char **items,
- const char *shortcuts);
-void QuartzFSCapture(void);
-void QuartzFSRelease(void);
-int QuartzFSUseQDCursor(int depth);
void QuartzBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask);
void QuartzWakeupHandler(pointer blockData, int result, pointer pReadmask);
commit 648d189548530fa23d97d1e8737f89d297f1c443
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Tue Jul 13 08:25:27 2010 -0700
XQuartz: Avoid a crash when mistakenly free()ing in QuartzSetCursor on some configs
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/xpr/xprCursor.c b/hw/xquartz/xpr/xprCursor.c
index 67fcbe7..a106e72 100644
--- a/hw/xquartz/xpr/xprCursor.c
+++ b/hw/xquartz/xpr/xprCursor.c
@@ -67,6 +67,7 @@ static Bool
load_cursor(CursorPtr src, int screen)
{
uint32_t *data;
+ Bool free_data = FALSE;
uint32_t rowbytes;
int width, height;
int hot_x, hot_y;
@@ -95,6 +96,7 @@ load_cursor(CursorPtr src, int screen)
unsigned i;
rowbytes = src->bits->width * sizeof (CARD32);
data = malloc(rowbytes * src->bits->height);
+ free_data = TRUE;
if(!data) {
FatalError("Failed to allocate memory in %s\n", __func__);
}
@@ -121,6 +123,7 @@ load_cursor(CursorPtr src, int screen)
/* round up to 8 pixel boundary so we can convert whole bytes */
rowbytes = ((src->bits->width * 4) + 31) & ~31;
data = malloc(rowbytes * src->bits->height);
+ free_data = TRUE;
if(!data) {
FatalError("Failed to allocate memory in %s\n", __func__);
}
@@ -173,7 +176,8 @@ load_cursor(CursorPtr src, int screen)
}
err = xp_set_cursor(width, height, hot_x, hot_y, data, rowbytes);
- free(data);
+ if(free_data)
+ free(data);
return err == Success;
}
commit 3209b094a3b1466b579e8020e12a4f3fa78a5f3f
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date: Fri Jul 9 10:36:56 2010 -0700
DRI2: re-allocate DRI2 drawable if pixmap serial changes
If a pixmap header is modified or the drawable serial changes, some
aspects of the drawable are likely to have changed so we should
re-allocate the corresponding DRI2 drawable in that case. This is one
way of catching when the root window pixmap changes through xrandr.
Fixes bug https://bugs.freedesktop.org/show_bug.cgi?id=28365.
Reviewed-by: Keith Packard <keithp at keithp.com>
Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>
Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index f9ba8e7..34f735f 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -82,6 +82,7 @@ typedef struct _DRI2Drawable {
CARD64 last_swap_msc; /* msc at completion of most recent swap */
CARD64 last_swap_ust; /* ust at completion of most recent swap */
int swap_limit; /* for N-buffering */
+ unsigned long serialNumber;
} DRI2DrawableRec, *DRI2DrawablePtr;
typedef struct _DRI2Screen {
@@ -130,6 +131,19 @@ DRI2GetDrawable(DrawablePtr pDraw)
}
}
+static unsigned long
+DRI2DrawableSerial(DrawablePtr pDraw)
+{
+ ScreenPtr pScreen = pDraw->pScreen;
+ PixmapPtr pPix;
+
+ if (pDraw->type != DRAWABLE_WINDOW)
+ return pDraw->serialNumber;
+
+ pPix = pScreen->GetWindowPixmap((WindowPtr)pDraw);
+ return pPix->drawable.serialNumber;
+}
+
static DRI2DrawablePtr
DRI2AllocateDrawable(DrawablePtr pDraw)
{
@@ -163,6 +177,7 @@ DRI2AllocateDrawable(DrawablePtr pDraw)
pPriv->last_swap_msc = 0;
pPriv->last_swap_ust = 0;
list_init(&pPriv->reference_list);
+ pPriv->serialNumber = DRI2DrawableSerial(pDraw);
if (pDraw->type == DRAWABLE_WINDOW) {
pWin = (WindowPtr) pDraw;
@@ -326,6 +341,7 @@ allocate_or_reuse_buffer(DrawablePtr pDraw, DRI2ScreenPtr ds,
|| !dimensions_match
|| (pPriv->buffers[old_buf]->format != format)) {
*buffer = (*ds->CreateBuffer)(pDraw, attachment, format);
+ pPriv->serialNumber = DRI2DrawableSerial(pDraw);
return TRUE;
} else {
@@ -384,7 +400,8 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
}
dimensions_match = (pDraw->width == pPriv->width)
- && (pDraw->height == pPriv->height);
+ && (pDraw->height == pPriv->height)
+ && (pPriv->serialNumber == DRI2DrawableSerial(pDraw));
buffers = malloc((count + 1) * sizeof(buffers[0]));
commit 02b11509b25686ff7bd567ecb78a435701edc4c2
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date: Fri Jul 9 10:36:12 2010 -0700
miModifyPixmapHeader: always update serialNumber
We should update the serial number even if we just change a single field.
Reviewed-by: Keith Packard <keithp at keithp.com>
Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>
Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/mi/miscrinit.c b/mi/miscrinit.c
index ea2a0c1..661ecb2 100644
--- a/mi/miscrinit.c
+++ b/mi/miscrinit.c
@@ -76,7 +76,6 @@ miModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
pPixmap->drawable.depth = depth;
pPixmap->drawable.bitsPerPixel = bitsPerPixel;
pPixmap->drawable.id = 0;
- pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pPixmap->drawable.x = 0;
pPixmap->drawable.y = 0;
pPixmap->drawable.width = width;
@@ -116,6 +115,7 @@ miModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
if (pPixData)
pPixmap->devPrivate.ptr = pPixData;
}
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
return TRUE;
}
commit 2307ab5bc9365ebbe04568edb7c7620a23689b70
Merge: c65280c... fd4f505...
Author: Keith Packard <keithp at keithp.com>
Date: Tue Jul 6 23:54:54 2010 -0400
Merge remote branch 'whot/for-keith'
commit fd4f5059f08165a726071dc9f1ca877038292f6f
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Jul 6 09:19:09 2010 +1000
dix: purge leftover manual key down bit setting.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
Reviewed-by: Daniel Stone <daniel at fooishbar.org>
diff --git a/dix/events.c b/dix/events.c
index e1c3d0a..07f7b1f 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3937,13 +3937,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
void
FixKeyState (DeviceEvent *event, DeviceIntPtr keybd)
{
- int key, bit;
- BYTE *kptr;
- KeyClassPtr keyc = keybd->key;
-
- key = event->detail.key;
- kptr = &keyc->down[key >> 3];
- bit = 1 << (key & 7);
+ int key = event->detail.key;
if (event->type == ET_KeyPress) {
DebugF("FixKeyState: Key %d %s\n",key,
@@ -3951,9 +3945,9 @@ FixKeyState (DeviceEvent *event, DeviceIntPtr keybd)
}
if (event->type == ET_KeyPress)
- *kptr |= bit;
+ set_key_down(keybd, key, KEY_PROCESSED);
else if (event->type == ET_KeyRelease)
- *kptr &= ~bit;
+ set_key_up(keybd, key, KEY_PROCESSED);
else
FatalError("Impossible keyboard event");
}
diff --git a/hw/dmx/input/atKeynames.h b/hw/dmx/input/atKeynames.h
index e632ca2..6aea1ed 100644
--- a/hw/dmx/input/atKeynames.h
+++ b/hw/dmx/input/atKeynames.h
@@ -66,8 +66,6 @@
#define KanaMask Mod4Mask
#define ScrollLockMask Mod5Mask
-#define KeyPressed(k) (keyc->postdown[k >> 3] & (1 << (k & 7)))
-
/*
* NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three)
* sets of scancodes. Set3 can only be generated by a MF keyboard.
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index bd7deed..8096a24 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -776,13 +776,7 @@ ephyrUpdateModifierState(unsigned int state)
for (key = 0; key < MAP_LENGTH; key++)
if (keyc->xkbInfo->desc->map->modmap[key] & mask) {
- int bit;
- BYTE *kptr;
-
- kptr = &keyc->down[key >> 3];
- bit = 1 << (key & 7);
-
- if (*kptr & bit)
+ if (key_is_down(pDev, key, KEY_PROCESSED))
KdEnqueueKeyboardEvent (ephyrKbd, key, TRUE);
if (--count == 0)
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 2ff77c6..2e82848 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -372,8 +372,6 @@ xf86PrintBacktrace(void)
xorg_backtrace();
}
-#define KeyPressed(k) (keyc->postdown[k >> 3] & (1 << (k & 7)))
-
static void
xf86ReleaseKeys(DeviceIntPtr pDev)
{
@@ -399,7 +397,7 @@ xf86ReleaseKeys(DeviceIntPtr pDev)
for (i = keyc->xkbInfo->desc->min_key_code;
i < keyc->xkbInfo->desc->max_key_code;
i++) {
- if (KeyPressed(i)) {
+ if (key_is_down(pDev, i, KEY_POSTED)) {
sigstate = xf86BlockSIGIO ();
nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i);
for (j = 0; j < nevents; j++)
diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c
index 570866b..ec629dc 100644
--- a/hw/xnest/Keyboard.c
+++ b/hw/xnest/Keyboard.c
@@ -231,13 +231,7 @@ xnestUpdateModifierState(unsigned int state)
for (key = 0; key < MAP_LENGTH; key++)
if (keyc->xkbInfo->desc->map->modmap[key] & mask) {
- int bit;
- BYTE *kptr;
-
- kptr = &keyc->down[key >> 3];
- bit = 1 << (key & 7);
-
- if (*kptr & bit)
+ if (key_is_down(pDev, key, KEY_PROCESSED))
xnestQueueKeyEvent(KeyRelease, key);
if (--count == 0)
diff --git a/hw/xwin/winkeynames.h b/hw/xwin/winkeynames.h
index 7c16337..3d59383 100644
--- a/hw/xwin/winkeynames.h
+++ b/hw/xwin/winkeynames.h
@@ -38,7 +38,6 @@
#define KanaMask Mod4Mask
#define ScrollLockMask Mod5Mask
-#define KeyPressed(k) (keyc->down[k >> 3] & (1 << (k & 7)))
#define ModifierDown(k) ((keyc->state & (k)) == (k))
/*
commit a1afe172559aff010e886cfc2a7a922d4a06c697
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Jul 6 09:16:42 2010 +1000
dix: add aux. functions for button_is_down, set_button_down, set_button_up.
Same as the matching key functions. Buttons, like keys, can have two states
for down/up - one posted, one processed. Posted is set during event
generation (usually in the signal handler). Processed is set during event
processing when the event queue is emptied and events are being delivered to
the client.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
Reviewed-by: Daniel Stone <daniel at fooishbar.org>
diff --git a/Xi/exevents.c b/Xi/exevents.c
index df13190..e990aeb 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -747,7 +747,6 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
KeyClassPtr k = NULL;
ButtonClassPtr b = NULL;
ValuatorClassPtr v = NULL;
- BYTE *kptr = NULL;
/* This event is always the first we get, before the actual events with
* the data. However, the way how the DDX is set up, "device" will
@@ -835,10 +834,10 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
if (!b)
return DONT_PROCESS;
- kptr = &b->down[key >> 3];
- if ((*kptr & bit) != 0)
+ if (button_is_down(device, key, BUTTON_PROCESSED))
return DONT_PROCESS;
- *kptr |= bit;
+
+ set_button_down(device, key, BUTTON_PROCESSED);
if (device->valuator)
device->valuator->motionHintWindow = NullWindow;
if (!b->map[key])
@@ -858,8 +857,7 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
if (!b)
return DONT_PROCESS;
- kptr = &b->down[key>>3];
- if (!(*kptr & bit))
+ if (!button_is_down(device, key, BUTTON_PROCESSED))
return DONT_PROCESS;
if (IsMaster(device)) {
DeviceIntPtr sd;
@@ -874,11 +872,11 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
continue;
if (!sd->button)
continue;
- if ((sd->button->down[key>>3] & bit) != 0)
+ if (button_is_down(sd, key, BUTTON_PROCESSED))
return DONT_PROCESS;
}
}
- *kptr &= ~bit;
+ set_button_up(device, key, BUTTON_PROCESSED);
if (device->valuator)
device->valuator->motionHintWindow = NullWindow;
if (!b->map[key])
diff --git a/dix/getevents.c b/dix/getevents.c
index 1d505e5..a9b6e82 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -91,6 +91,37 @@ GetMotionHistorySize(void)
}
void
+set_button_down(DeviceIntPtr pDev, int button, int type)
+{
+ if (type == BUTTON_PROCESSED)
+ SetBit(pDev->button->down, button);
+ else
+ SetBit(pDev->button->postdown, button);
+}
+
+void
+set_button_up(DeviceIntPtr pDev, int button, int type)
+{
+ if (type == BUTTON_PROCESSED)
+ ClearBit(pDev->button->down, button);
+ else
+ ClearBit(pDev->button->postdown, button);
+}
+
+Bool
+button_is_down(DeviceIntPtr pDev, int button, int type)
+{
+ int ret = 0;
+
+ if (type & BUTTON_PROCESSED)
+ ret |= !!BitIsOn(pDev->button->down, button);
+ if (type & BUTTON_POSTED)
+ ret |= !!BitIsOn(pDev->button->postdown, button);
+
+ return ret;
+}
+
+void
set_key_down(DeviceIntPtr pDev, int key_code, int type)
{
if (type == KEY_PROCESSED)
@@ -1123,11 +1154,11 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
else {
if (type == ButtonPress) {
event->type = ET_ButtonPress;
- pDev->button->postdown[buttons >> 3] |= (1 << (buttons & 7));
+ set_button_down(pDev, buttons, BUTTON_POSTED);
}
else if (type == ButtonRelease) {
event->type = ET_ButtonRelease;
- pDev->button->postdown[buttons >> 3] &= ~(1 << (buttons & 7));
+ set_button_up(pDev, buttons, BUTTON_POSTED);
}
event->detail.button = buttons;
}
diff --git a/include/input.h b/include/input.h
index 0a08ea4..55b1537 100644
--- a/include/input.h
+++ b/include/input.h
@@ -228,14 +228,19 @@ typedef struct _InputAttributes {
#define ATTR_TOUCHPAD (1<<4)
#define ATTR_TOUCHSCREEN (1<<5)
-/* Key has been run through all input processing and events sent to clients. */
+/* Key/Button has been run through all input processing and events sent to clients. */
#define KEY_PROCESSED 1
-/* Key has not been fully processed, no events have been sent. */
+#define BUTTON_PROCESSED 1
+/* Key/Button has not been fully processed, no events have been sent. */
#define KEY_POSTED 2
+#define BUTTON_POSTED 2
extern void set_key_down(DeviceIntPtr pDev, int key_code, int type);
extern void set_key_up(DeviceIntPtr pDev, int key_code, int type);
extern int key_is_down(DeviceIntPtr pDev, int key_code, int type);
+extern void set_button_down(DeviceIntPtr pDev, int button, int type);
+extern void set_button_up(DeviceIntPtr pDev, int button, int type);
+extern int button_is_down(DeviceIntPtr pDev, int button, int type);
extern void InitCoreDevices(void);
extern void InitXTestDevices(void);
commit 32473d6bf38c95b2d6d5ddbf583a1e801c6605e4
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Jul 6 08:56:12 2010 +1000
dix: use BitIsOn/SetBit/ClearBit macros for set_key_down helpers.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
Reviewed-by: Daniel Stone <daniel at fooishbar.org>
diff --git a/dix/getevents.c b/dix/getevents.c
index 2eacdfe..1d505e5 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -94,18 +94,18 @@ void
set_key_down(DeviceIntPtr pDev, int key_code, int type)
{
if (type == KEY_PROCESSED)
- pDev->key->down[key_code >> 3] |= (1 << (key_code & 7));
+ SetBit(pDev->key->down, key_code);
else
- pDev->key->postdown[key_code >> 3] |= (1 << (key_code & 7));
+ SetBit(pDev->key->postdown, key_code);
}
void
set_key_up(DeviceIntPtr pDev, int key_code, int type)
{
if (type == KEY_PROCESSED)
- pDev->key->down[key_code >> 3] &= ~(1 << (key_code & 7));
+ ClearBit(pDev->key->down, key_code);
else
- pDev->key->postdown[key_code >> 3] &= ~(1 << (key_code & 7));
+ ClearBit(pDev->key->postdown, key_code);
}
Bool
@@ -114,9 +114,9 @@ key_is_down(DeviceIntPtr pDev, int key_code, int type)
int ret = 0;
if (type & KEY_PROCESSED)
- ret |= !!(pDev->key->down[key_code >> 3] & (1 << (key_code & 7)));
+ ret |= !!BitIsOn(pDev->key->down, key_code);
if (type & KEY_POSTED)
- ret |= !!(pDev->key->postdown[key_code >> 3] & (1 << (key_code & 7)));
+ ret |= !!BitIsOn(pDev->key->postdown, key_code);
return ret;
}
commit c18442908080c9833dfd6bb2ff367945d1892421
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Mon Jul 5 16:47:57 2010 +1000
Xi: use set_key_up/down instead of manual bit handling.
We have the wrappers, use them.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/Xi/exevents.c b/Xi/exevents.c
index de24b4c..df13190 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -814,23 +814,22 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
if (!k)
return DONT_PROCESS;
- kptr = &k->down[key >> 3];
- /* don't allow ddx to generate multiple downs, but repeats are okay */
- if ((*kptr & bit) && !event->key_repeat)
+ /* don't allow ddx to generate multiple downs, but repeats are okay */
+ if (key_is_down(device, key, KEY_PROCESSED) && !event->key_repeat)
return DONT_PROCESS;
+
if (device->valuator)
device->valuator->motionHintWindow = NullWindow;
- *kptr |= bit;
+ set_key_down(device, key, KEY_PROCESSED);
} else if (event->type == ET_KeyRelease) {
if (!k)
return DONT_PROCESS;
- kptr = &k->down[key >> 3];
- if (!(*kptr & bit)) /* guard against duplicates */
+ if (!key_is_down(device, key, KEY_PROCESSED)) /* guard against duplicates */
return DONT_PROCESS;
if (device->valuator)
device->valuator->motionHintWindow = NullWindow;
- *kptr &= ~bit;
+ set_key_up(device, key, KEY_PROCESSED);
} else if (event->type == ET_ButtonPress) {
Mask mask;
if (!b)
commit 10442ce02b5be7f82b373bee1939e2b523e291d9
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Mon Jul 5 16:54:48 2010 +1000
dix: treat flags as flags, not as value in key_is_down.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
Reviewed-by: Daniel Stone <daniel at fooishbar.org>
diff --git a/dix/getevents.c b/dix/getevents.c
index f9d65e9..2eacdfe 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -115,7 +115,7 @@ key_is_down(DeviceIntPtr pDev, int key_code, int type)
if (type & KEY_PROCESSED)
ret |= !!(pDev->key->down[key_code >> 3] & (1 << (key_code & 7)));
- else if (type & KEY_POSTED)
+ if (type & KEY_POSTED)
ret |= !!(pDev->key->postdown[key_code >> 3] & (1 << (key_code & 7)));
return ret;
commit b46ffd25d3f211e91c67bc618ecbd58257939388
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Fri Jul 2 15:25:14 2010 +1000
mi: rename miPointerMoved to miPointerMoveNoEvent.
Having miPointerMove and miPointerMoved is confusing, especially since both
do the same thing bar the event delivery. Also, miPointerMove calls
miPointerMoved which indicates some confusion in the temporal alignment of
cause and effect.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
Acked-by: Tiago Vignatti <tiago.vignatti at nokia.com>
Reviewed-by: Keith Packard <keithp at keithp.com>
diff --git a/mi/mipointer.c b/mi/mipointer.c
index 7efcebb..d8aaf8c 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -73,7 +73,7 @@ static void miPointerMove(DeviceIntPtr pDev, ScreenPtr pScreen,
static Bool miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen);
static void miPointerDeviceCleanup(DeviceIntPtr pDev,
ScreenPtr pScreen);
-static void miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y);
+static void miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y);
static EventList* events; /* for WarpPointer MotionNotifies */
@@ -308,7 +308,7 @@ miPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
if (GenerateEvent)
miPointerMove (pDev, pScreen, x, y);
else
- miPointerMoved(pDev, pScreen, x, y);
+ miPointerMoveNoEvent(pDev, pScreen, x, y);
/* Don't call USFS if we use Xinerama, otherwise the root window is
* updated to the second screen, and we never receive any events.
@@ -456,7 +456,7 @@ miPointerSetWaitForUpdate(ScreenPtr pScreen, Bool wait)
/* Move the pointer on the current screen, and update the sprite. */
static void
-miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen,
+miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen,
int x, int y)
{
miPointerPtr pPointer;
@@ -532,7 +532,7 @@ miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y)
pPointer->pScreen == pScreen)
return;
- miPointerMoved(pDev, pScreen, *x, *y);
+ miPointerMoveNoEvent(pDev, pScreen, *x, *y);
}
void
@@ -554,7 +554,7 @@ miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
int i, nevents;
int valuators[2];
- miPointerMoved(pDev, pScreen, x, y);
+ miPointerMoveNoEvent(pDev, pScreen, x, y);
/* generate motion notify */
valuators[0] = x;
commit dbd621705a5211540b353af81c4af83c297b74dc
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Fri Jul 2 14:22:03 2010 +1000
mi: De-duplicate some code in mipointer.c
miPointerMoved already has the same code.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
Reviewed-by: Keith Packard <keithp at keithp.com>
diff --git a/mi/mipointer.c b/mi/mipointer.c
index 9936a01..7efcebb 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -73,6 +73,7 @@ static void miPointerMove(DeviceIntPtr pDev, ScreenPtr pScreen,
static Bool miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen);
static void miPointerDeviceCleanup(DeviceIntPtr pDev,
ScreenPtr pScreen);
+static void miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y);
static EventList* events; /* for WarpPointer MotionNotifies */
@@ -305,24 +306,9 @@ miPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
}
if (GenerateEvent)
- {
miPointerMove (pDev, pScreen, x, y);
- }
else
- {
- /* everything from miPointerMove except the event and history */
-
- if (!pScreenPriv->waitForUpdate && pScreen == pPointer->pSpriteScreen)
- {
- pPointer->devx = x;
- pPointer->devy = y;
- if(pPointer->pCursor && !pPointer->pCursor->bits->emptyMask)
- (*pScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y);
- }
- pPointer->x = x;
- pPointer->y = y;
- pPointer->pScreen = pScreen;
- }
+ miPointerMoved(pDev, pScreen, x, y);
/* Don't call USFS if we use Xinerama, otherwise the root window is
* updated to the second screen, and we never receive any events.
commit c65280ce8df4836bd7424a90482e8aa00ab6f447
Author: Robert Hooker <sarvatt at ubuntu.com>
Date: Sat Jun 12 20:23:09 2010 -0400
Increase advertised RENDER protocol minor version to 11
Support for the blend mode operators was added in
0ce42adbf4cff9e7f049d9fc79d588ece5936177
and the requirement was bumped but when things were split off into
include/protocol-versions.h it defined it to 10. render uses
the lower of the client and server advertised versions so it's not
using the new blend mode operators.
Signed-off-by: Robert Hooker <sarvatt at ubuntu.com>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/include/protocol-versions.h b/include/protocol-versions.h
index 97ef5da..c674465 100644
--- a/include/protocol-versions.h
+++ b/include/protocol-versions.h
@@ -73,7 +73,7 @@
/* Render */
#define SERVER_RENDER_MAJOR_VERSION 0
-#define SERVER_RENDER_MINOR_VERSION 10
+#define SERVER_RENDER_MINOR_VERSION 11
/* RandR Xinerama */
#define SERVER_RRXINERAMA_MAJOR_VERSION 1
commit 9f0b193acdc29e491b6245390cf9f53b5222e6d3
Author: Keith Packard <keithp at keithp.com>
Date: Thu Jul 1 09:13:43 2010 -0400
miDbe window priv priv is pre-allocated, don't use dixSetPrivate (bug 28639)
miDbeInit pre-allocates space in each DBE window private private for a
MiDbeWindowPrivPrivRec. miDbeAllocBackBufferName used the
pre-allocated space correctly (simply fetching it instead of
allocating a new piece of memory). However, it then called
dixSetPrivate anyways, which isn't necessary, and (in the new
dixPrivate world) causes an assert failure.
Signed-off-by: Keith Packard <keithp at keithp.com>
Tested-by: Magnus Kessler <Magnus.Kessler at gmx.net>
Reviewed-by: Magnus Kessler <Magnus.Kessler at gmx.net>
diff --git a/dbe/midbe.c b/dbe/midbe.c
index 954f46e..b43ac1b 100644
--- a/dbe/midbe.c
+++ b/dbe/midbe.c
@@ -202,12 +202,6 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
return (rc == Success) ? BadAlloc : rc;
}
-
- /* Attach the priv priv to the priv. */
- dixSetPrivate(&pDbeWindowPriv->devPrivates, miDbeWindowPrivPrivKey,
- pDbeWindowPrivPriv);
-
-
/* Clear the back buffer. */
pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen);
if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC))
commit a94cb400d15b8c78dc04148cbd8db8e5ec8364b5
Author: Keith Packard <keithp at keithp.com>
Date: Thu Jul 1 09:11:36 2010 -0400
Delete unused miDbe screen private private datatype
MiDbeScreenPrivPrivRec is not used in the server. Remove it, along
with the MI_DBE_SCREEN_PRIV_PRIV macro that tried to use it.
Signed-off-by: Keith Packard <keithp at keithp.com>
Reviewed-by: Magnus.Kessler <Magnus.Kessler at gmx.net>
diff --git a/dbe/midbestr.h b/dbe/midbestr.h
index ae9f206..a47d8d9 100644
--- a/dbe/midbestr.h
+++ b/dbe/midbestr.h
@@ -48,11 +48,6 @@
#define MI_DBE_WINDOW_PRIV_PRIV_FROM_WINDOW(pWin)\
MI_DBE_WINDOW_PRIV_PRIV(DBE_WINDOW_PRIV(pWin))
-#define MI_DBE_SCREEN_PRIV_PRIV(pDbeScreenPriv) \
- (!(pDbeScreenPriv) ? NULL : (MiDbeScreenPrivPrivPtr) \
- dixLookupPrivate(&(pDbeScreenPriv)->devPrivates, miDbeScreenPrivPrivKey))
-
-
/* TYPEDEFS */
typedef struct _MiDbeWindowPrivPrivRec
@@ -80,16 +75,5 @@ typedef struct _MiDbeWindowPrivPrivRec
} MiDbeWindowPrivPrivRec, *MiDbeWindowPrivPrivPtr;
-typedef struct _MiDbeScreenPrivPrivRec
-{
- /* Place machine-specific fields in here.
- * Since this is mi code, we do not really have machine-specific fields.
- */
-
- /* Pointer back to our screen private with which we are associated. */
- DbeScreenPrivPtr pDbeScreenPriv;
-
-} MiDbeScreenPrivPrivRec, *MiDbeScreenPrivPrivPtr;
-
#endif /* MIDBE_STRUCT_H */
commit f0fcffe55f280add5e4db2f5e9198a48c6f1b015
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Thu Jun 3 19:00:54 2010 -0700
Update the sprite immediately when moving it with MouseKeys
Fix for OpenSolaris bug 6949755: Mouse Keys are ununusable
and possibly https://bugs.freedesktop.org/show_bug.cgi?id=24856
Ensures waitForUpdate is False before calling SetCursorPosition.
Normally waitForUpdate is False when SilkenMouse is active, True
when it's not. When it's True, the mouse cursor position on
screen is not updated immediately.
This is more critical on Solaris, since we disabled SigIO, thus in turn
disable SilkenMouse, due to the SSE2 vs. signal handler issues described in
Sun bugs 6849925, 6859428, and 6879897.
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 96d3847..eea3d4a 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -41,6 +41,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "xkb.h"
#include <ctype.h>
#include "mi.h"
+#include "mipointer.h"
#define EXTENSION_EVENT_BASE 64
DevPrivateKeyRec xkbDevicePrivateKeyRec;
@@ -1337,6 +1338,8 @@ XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y)
EventListPtr events;
int nevents, i;
DeviceIntPtr ptr;
+ ScreenPtr pScreen;
+ Bool saveWait;
int gpe_flags = 0;
if (IsMaster(dev))
@@ -1353,9 +1356,12 @@ XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y)
events = InitEventList(GetMaximumEventsNum());
OsBlockSignals();
+ pScreen = miPointerGetScreen(ptr);
+ saveWait = miPointerSetWaitForUpdate(pScreen, FALSE);
nevents = GetPointerEvents(events, ptr,
MotionNotify, 0,
gpe_flags, 0, 2, (int[]){x, y});
+ miPointerSetWaitForUpdate(pScreen, saveWait);
OsReleaseSignals();
for (i = 0; i < nevents; i++)
commit 3d9079b898c432a87f9b95c1f39a85f660bf0858
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Thu Jun 3 19:00:53 2010 -0700
Add API to update setting of waitForUpdate screen private in miPointer
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c
index e16b510..ec781aa 100644
--- a/hw/xfree86/ramdac/xf86Cursor.c
+++ b/hw/xfree86/ramdac/xf86Cursor.c
@@ -245,8 +245,6 @@ xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags)
ScreenPtr pScreen = screenInfo.screens[index];
xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
&pScreen->devPrivates, xf86CursorScreenKey);
- miPointerScreenPtr PointPriv = (miPointerScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, miPointerScreenKey);
if (ScreenPriv->isUp) {
xf86SetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y);
@@ -261,7 +259,7 @@ xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags)
* ensure the cursor is repainted by miPointerWarpCursor().
*/
ScreenPriv->CursorToRestore = ScreenPriv->CurrentCursor;
- PointPriv->waitForUpdate = FALSE; /* Force cursor repaint */
+ miPointerSetWaitForUpdate(pScreen, FALSE); /* Force cursor repaint */
return ret;
}
@@ -302,9 +300,6 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
&pScreen->devPrivates, xf86CursorScreenKey);
xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
- miPointerScreenPtr PointPriv = (miPointerScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, miPointerScreenKey);
-
if (pCurs == NullCursor) { /* means we're supposed to remove the cursor */
if (ScreenPriv->SWCursor ||
@@ -355,11 +350,12 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
xf86SetCursor(pScreen, pCurs, x, y);
ScreenPriv->SWCursor = FALSE;
ScreenPriv->isUp = TRUE;
- PointPriv->waitForUpdate = !infoPtr->pScrn->silkenMouse;
+
+ miPointerSetWaitForUpdate(pScreen, !infoPtr->pScrn->silkenMouse);
return;
}
- PointPriv->waitForUpdate = TRUE;
+ miPointerSetWaitForUpdate(pScreen, TRUE);
if (ScreenPriv->isUp) {
/* Remove the HW cursor, or make it transparent */
diff --git a/mi/mipointer.c b/mi/mipointer.c
index 33bb40b..9936a01 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -452,6 +452,22 @@ miPointerGetScreen(DeviceIntPtr pDev)
return (pPointer) ? pPointer->pScreen : NULL;
}
+/* Controls whether the cursor image should be updated immediately when
+ moved (FALSE) or if something else will be responsible for updating
+ it later (TRUE). Returns current setting.
+ Caller is responsible for calling OsBlockSignal first.
+*/
+Bool
+miPointerSetWaitForUpdate(ScreenPtr pScreen, Bool wait)
+{
+ SetupScreen(pScreen);
+ Bool prevWait = pScreenPriv->waitForUpdate;
+
+ pScreenPriv->waitForUpdate = wait;
+ return prevWait;
+}
+
+
/* Move the pointer on the current screen, and update the sprite. */
static void
miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen,
diff --git a/mi/mipointer.h b/mi/mipointer.h
index de58c07..3c86110 100644
--- a/mi/mipointer.h
+++ b/mi/mipointer.h
@@ -139,6 +139,11 @@ extern _X_EXPORT void miPointerSetPosition(
extern _X_EXPORT void miPointerUpdateSprite(
DeviceIntPtr pDev);
+/* Sets whether the sprite should be updated immediately on pointer moves */
+extern _X_EXPORT Bool miPointerSetWaitForUpdate(
+ ScreenPtr pScreen,
+ Bool wait);
+
extern _X_EXPORT DevPrivateKeyRec miPointerPrivKeyRec;
#define miPointerPrivKey (&miPointerPrivKeyRec)
commit 69b2b5c85ec079ef49f84722daa5f148cedc2e1b
Merge: b90faa7... 1432785...
Author: Keith Packard <keithp at keithp.com>
Date: Thu Jul 1 23:46:53 2010 -0400
Merge remote branch 'whot/for-keith'
commit b90faa71567c4461b28515756ba5c1e6286dda16
Author: Keith Packard <keithp at keithp.com>
Date: Thu Jul 1 23:46:27 2010 -0400
Revert "xkb: merge lockedPtrButtons state from all attached SDs."
Preparing to merge Peter's branch.
This reverts commit 6052710670953b43b4fff5d101b727163fcb1187.
diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index 956b224..5847e63 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -924,9 +924,6 @@ extern int XkbGetEffectiveGroup(
XkbStatePtr /* xkbstate */,
CARD8 /* keycode */);
-extern void XkbMergeLockedPtrBtns(
- DeviceIntPtr /* master */);
-
#include "xkbfile.h"
#include "xkbrules.h"
diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index 451c797..b5486b7 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -707,24 +707,8 @@ DeviceEvent *event = &ev->device_event;
changed |= XkbPointerButtonMask;
}
else if (event->type == ET_ButtonRelease) {
- if (xkbi) {
+ if (xkbi)
xkbi->lockedPtrButtons&= ~(1 << (event->detail.key & 0x7));
-
- /* Merge this MD's lockedPtrButtons with the one of all
- * attached slave devices.
- * The DIX uses a merged button state for MDs, not
- * releasing buttons until the last SD has released
- * thenm. If we unconditionally clear the
- * lockedPtrButtons bit on the MD, a PointerKeys button
- * release on the SD keyboard won't generate the required fake button
- * event on the XTEST pointer, thus never processing the
- * button event in the DIX and the XTEST pointer's
- * buttons stay down - result is a stuck button.
- */
- if (IsMaster(dev))
- XkbMergeLockedPtrBtns(dev);
- }
-
changed |= XkbPointerButtonMask;
}
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index b4b8395..c5030d0 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -633,16 +633,6 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi,
break;
}
xkbi->lockedPtrButtons&= ~(1<<button);
-
- if (IsMaster(xkbi->device))
- {
- XkbMergeLockedPtrBtns(xkbi->device);
- /* One SD still has lock set, don't post event */
- if ((xkbi->lockedPtrButtons & (1 << button)) != 0)
- break;
- }
-
- /* fallthrough */
case XkbSA_PtrBtn:
XkbFakeDeviceButton(xkbi->device, 0, button);
break;
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 14dc784..3344e50 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -2094,29 +2094,3 @@ XkbGetEffectiveGroup(XkbSrvInfoPtr xkbi, XkbStatePtr xkbState, CARD8 keycode)
return effectiveGroup;
}
-
-/* Merge the lockedPtrButtons from all attached SDs for the given master
- * device into the MD's state.
- */
-void
-XkbMergeLockedPtrBtns(DeviceIntPtr master)
-{
- DeviceIntPtr d = inputInfo.devices;
- XkbSrvInfoPtr xkbi = NULL;
-
- if (!IsMaster(master))
- return;
-
- if (!master->key)
- return;
-
- xkbi = master->key->xkbInfo;
- xkbi->lockedPtrButtons = 0;
-
- for (; d; d = d->next) {
- if (IsMaster(d) || GetMaster(d, MASTER_KEYBOARD) != master || !d->key)
- continue;
-
- xkbi->lockedPtrButtons |= d->key->xkbInfo->lockedPtrButtons;
- }
-}
commit 9fb0785449b287ba1998e08613b3c2102ec24842
Author: Keith Packard <keithp at keithp.com>
Date: Thu Jul 1 23:45:50 2010 -0400
Revert "Revert "dix: use the event mask of the grab for TryClientEvents.""
Preparing to merge Peter's branch.
This reverts commit 018c878e9495b21146c8f38617fdd1bf6d8cc73b.
diff --git a/dix/events.c b/dix/events.c
index e1c3d0a..ae9847c 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3420,6 +3420,7 @@ CheckPassiveGrabsOnWindow(
{
DeviceIntPtr gdev;
XkbSrvInfoPtr xkbi = NULL;
+ Mask mask = 0;
gdev= grab->modifierDevice;
if (grab->grabtype == GRABTYPE_CORE)
@@ -3534,6 +3535,9 @@ CheckPassiveGrabsOnWindow(
}
xE = &core;
count = 1;
+ mask = grab->eventMask;
+ if (grab->ownerEvents)
+ mask |= pWin->eventMask;
} else if (match & XI2_MATCH)
{
rc = EventToXI2((InternalEvent*)event, &xE);
@@ -3545,6 +3549,34 @@ CheckPassiveGrabsOnWindow(
continue;
}
count = 1;
+
+ /* FIXME: EventToXI2 returns NULL for enter events, so
+ * dereferencing the event is bad. Internal event types are
+ * aligned with core events, so the else clause is valid.
+ * long-term we should use internal events for enter/focus
+ * as well */
+ if (xE)
+ mask = grab->xi2mask[device->id][((xGenericEvent*)xE)->evtype/8];
+ else if (event->type == XI_Enter || event->type == XI_FocusIn)
+ mask = grab->xi2mask[device->id][event->type/8];
+
+ if (grab->ownerEvents && wOtherInputMasks(grab->window))
+ {
+ InputClientsPtr icp =
+ wOtherInputMasks(grab->window)->inputClients;
+
+ while(icp)
+ {
+ if (rClient(icp) == rClient(grab))
+ {
+ int evtype = (xE) ? ((xGenericEvent*)xE)->evtype : event->type;
+ mask |= icp->xi2mask[device->id][evtype/8];
+ break;
+ }
+
+ icp = icp->next;
+ }
+ }
} else
{
rc = EventToXI((InternalEvent*)event, &xE, &count);
@@ -3555,6 +3587,23 @@ CheckPassiveGrabsOnWindow(
"(%d, %d).\n", device->name, event->type, rc);
continue;
}
+ mask = grab->eventMask;
+ if (grab->ownerEvents && wOtherInputMasks(grab->window))
+ {
+ InputClientsPtr icp =
+ wOtherInputMasks(grab->window)->inputClients;
+
+ while(icp)
+ {
+ if (rClient(icp) == rClient(grab))
+ {
+ mask |= icp->mask[device->id];
+ break;
+ }
+
+ icp = icp->next;
+ }
+ }
}
(*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE);
@@ -3563,8 +3612,7 @@ CheckPassiveGrabsOnWindow(
{
FixUpEventFromWindow(device, xE, grab->window, None, TRUE);
- TryClientEvents(rClient(grab), device, xE, count,
- GetEventFilter(device, xE),
+ TryClientEvents(rClient(grab), device, xE, count, mask,
GetEventFilter(device, xE), grab);
}
commit 48cac27870992f6bde2c48429ff03c0a7606d5c1
Author: James Jones <jajones at nvidia.com>
Date: Fri Jun 18 17:28:15 2010 -0700
Cast void* to pointer* to appease some compilers.
When this privates.h is included in C++ builds, the compiler
complains about implicitly casting void* to void**. This small
patch fixes that up.
Signed-off-by: James Jones <jajones at nvidia.com>
Reviewed-by: Keith Packard <keithp at keithp.com>
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/include/privates.h b/include/privates.h
index 4fed7d0..5ba9358 100644
--- a/include/privates.h
+++ b/include/privates.h
@@ -177,7 +177,7 @@ static inline pointer *
dixLookupPrivateAddr(PrivatePtr *privates, const DevPrivateKey key)
{
assert (key->size == 0);
- return dixGetPrivateAddr(privates, key);
+ return (pointer *)dixGetPrivateAddr(privates, key);
}
/*
commit 14327858391ebe929b806efb53ad79e789361883
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Thu Jul 1 12:44:57 2010 +1000
xkb: release XTEST pointer buttons on physical releases. (#28808)
If a button release event is posted for the MD pointer, post a release event
through the matching XTEST device. This way, a client who posts a button
press through the XTEST extension cannot inadvertedly lock the button.
This behaviour is required for historical reasons, until server 1.7 the core
pointer would release a button press on physical events, regardless of the
XTEST state. Clients seem to rely on this behaviour, causing seemingly stuck
grabs.
The merged behaviour is kept for multiple keyboard PointerKey events, if two
physical keyboards hold the button down as a result of PointerKey actions,
the button is not released until the last keyboard releases the button.
X.Org Bug 28808 <http://bugs.freedesktop.org/show_bug.cgi?id=28808>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index 956b224..9f1507e 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -927,6 +927,12 @@ extern int XkbGetEffectiveGroup(
extern void XkbMergeLockedPtrBtns(
DeviceIntPtr /* master */);
+extern void XkbFakeDeviceButton(
+ DeviceIntPtr /* dev */,
+ int /* press */,
+ int /* button */);
+
+
#include "xkbfile.h"
#include "xkbrules.h"
diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index 81f9596..10c38ca 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -710,19 +710,16 @@ DeviceEvent *event = &ev->device_event;
if (xkbi) {
xkbi->lockedPtrButtons&= ~(1 << (event->detail.key & 0x7));
- /* Merge this MD's lockedPtrButtons with the one of all
- * attached slave devices.
- * The DIX uses a merged button state for MDs, not
- * releasing buttons until the last SD has released
- * thenm. If we unconditionally clear the
- * lockedPtrButtons bit on the MD, a PointerKeys button
- * release on the SD keyboard won't generate the required fake button
- * event on the XTEST pointer, thus never processing the
- * button event in the DIX and the XTEST pointer's
- * buttons stay down - result is a stuck button.
- */
- if (IsMaster(dev))
- XkbMergeLockedPtrBtns(dev);
+ if (IsMaster(dev))
+ {
+ DeviceIntPtr source;
+ int rc;
+ rc = dixLookupDevice(&source, event->sourceid, serverClient, DixWriteAccess);
+ if (rc != Success)
+ ErrorF("[xkb] bad sourceid '%d' on button release event.\n", event->sourceid);
+ else if (!IsXTestDevice(source, GetMaster(dev, MASTER_POINTER)))
+ XkbFakeDeviceButton(dev, FALSE, event->detail.key);
+ }
}
changed |= XkbPointerButtonMask;
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 49d7b3d..96d3847 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -45,7 +45,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
DevPrivateKeyRec xkbDevicePrivateKeyRec;
-static void XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button);
+void XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button);
static void XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y);
void
@@ -1364,7 +1364,7 @@ XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y)
FreeEventList(events, GetMaximumEventsNum());
}
-static void
+void
XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
{
EventListPtr events;
commit 339f62b1bfadb0ee77d67e351f4e30f5d5e9625f
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Jun 29 15:24:51 2010 +1000
xkb: emulate PointerKeys events only on the master device.
This patch replicates the behaviour for button events. Only generate a
PointerKeys motion event on the master device, not on the slave device.
Fixes the current issue of PointerKey motion events generating key events as
well.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index b4b8395..49d7b3d 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -500,9 +500,6 @@ _XkbFilterPointerMove( XkbSrvInfoPtr xkbi,
int x,y;
Bool accel;
- if (xkbi->device == inputInfo.keyboard)
- return 0;
-
if (filter->keycode==0) { /* initial press */
filter->keycode = keycode;
filter->active = 1;
@@ -1342,10 +1339,12 @@ XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y)
DeviceIntPtr ptr;
int gpe_flags = 0;
- if (!dev->u.master)
+ if (IsMaster(dev))
+ ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER));
+ else if (!dev->u.master)
ptr = dev;
else
- ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER));
+ return;
if (flags & XkbSA_MoveAbsoluteX || flags & XkbSA_MoveAbsoluteY)
gpe_flags = POINTER_ABSOLUTE;
commit 69ac909878ef80bb74c4a9ca4150eda66debd754
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Jun 29 12:12:53 2010 +1000
xkb: merge lockedPtrButtons state from all attached SDs.
Problem:
lockedPtrButtons keeps the state of the buttons locked by a PointerKeys button
press. Unconditionally clearing the bits may cause stuck buttons in this
sequence of events:
1. type Shift + NumLock to enable PointerKeys
2. type 0/Ins on keypad to emulate Button 1 press
â button1 press event to client
3. press and release button 1 on physical mouse
â button1 release event to client
Button 1 on the MD is now stuck and cannot be released.
Cause:
XKB PointerKeys button events are posted through the XTEST pointer device.
Once a press is generated, the XTEST device's button is down. The DIX merges
the button state of all attached SDs, hence the MD will have a button down
while the XTEST device has a button down.
PointerKey button events are only generated on the master device to avoid
duplicate events (see XkbFakeDeviceButton()). If the MD has the
lockedPtrButtons bit cleared by a release event on a physical device, no
such event is generated when a keyboard device triggers the PointerKey
ButtonRelease trigger. Since the event - if generated - is posted through
the XTEST pointer device, lack of a generated ButtonRelease event on the
XTEST pointer device means the button is never released, resulting in the
stuck button observed above.
Solution:
This patch merges the MD's lockedPtrButtons with the one of all attached
slave devices on release events. Thus, as long as one attached keyboard has
a lockedPtrButtons bit set, this bit is kept in the MD. Once a PointerKey
button is released on all keyboards, the matching release event is emulated
from the MD through the XTEST pointer device, thus also releasing the button
in the DIX.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index 5847e63..956b224 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -924,6 +924,9 @@ extern int XkbGetEffectiveGroup(
XkbStatePtr /* xkbstate */,
CARD8 /* keycode */);
+extern void XkbMergeLockedPtrBtns(
+ DeviceIntPtr /* master */);
+
#include "xkbfile.h"
#include "xkbrules.h"
diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index 6d17c75..81f9596 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -707,8 +707,24 @@ DeviceEvent *event = &ev->device_event;
changed |= XkbPointerButtonMask;
}
else if (event->type == ET_ButtonRelease) {
- if (xkbi)
+ if (xkbi) {
xkbi->lockedPtrButtons&= ~(1 << (event->detail.key & 0x7));
+
+ /* Merge this MD's lockedPtrButtons with the one of all
+ * attached slave devices.
+ * The DIX uses a merged button state for MDs, not
+ * releasing buttons until the last SD has released
+ * thenm. If we unconditionally clear the
+ * lockedPtrButtons bit on the MD, a PointerKeys button
+ * release on the SD keyboard won't generate the required fake button
+ * event on the XTEST pointer, thus never processing the
+ * button event in the DIX and the XTEST pointer's
+ * buttons stay down - result is a stuck button.
+ */
+ if (IsMaster(dev))
+ XkbMergeLockedPtrBtns(dev);
+ }
+
changed |= XkbPointerButtonMask;
}
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index d1149a1..b4b8395 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -634,6 +634,14 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi,
}
xkbi->lockedPtrButtons&= ~(1<<button);
+ if (IsMaster(xkbi->device))
+ {
+ XkbMergeLockedPtrBtns(xkbi->device);
+ /* One SD still has lock set, don't post event */
+ if ((xkbi->lockedPtrButtons & (1 << button)) != 0)
+ break;
+ }
+
/* fallthrough */
case XkbSA_PtrBtn:
XkbFakeDeviceButton(xkbi->device, 0, button);
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 3344e50..14dc784 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -2094,3 +2094,29 @@ XkbGetEffectiveGroup(XkbSrvInfoPtr xkbi, XkbStatePtr xkbState, CARD8 keycode)
return effectiveGroup;
}
+
+/* Merge the lockedPtrButtons from all attached SDs for the given master
+ * device into the MD's state.
+ */
+void
+XkbMergeLockedPtrBtns(DeviceIntPtr master)
+{
+ DeviceIntPtr d = inputInfo.devices;
+ XkbSrvInfoPtr xkbi = NULL;
+
+ if (!IsMaster(master))
+ return;
+
+ if (!master->key)
+ return;
+
+ xkbi = master->key->xkbInfo;
+ xkbi->lockedPtrButtons = 0;
+
+ for (; d; d = d->next) {
+ if (IsMaster(d) || GetMaster(d, MASTER_KEYBOARD) != master || !d->key)
+ continue;
+
+ xkbi->lockedPtrButtons |= d->key->xkbInfo->lockedPtrButtons;
+ }
+}
commit 09645864f5a52882eee51c801b3e610d683e7147
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Jun 29 13:49:27 2010 +1000
xkb: Mark switch case fallthrough with comment.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index c5030d0..d1149a1 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -633,6 +633,8 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi,
break;
}
xkbi->lockedPtrButtons&= ~(1<<button);
+
+ /* fallthrough */
case XkbSA_PtrBtn:
XkbFakeDeviceButton(xkbi->device, 0, button);
break;
commit c7330ecb5d28d7a92d24feb289f7f1812ce055a4
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Wed Jun 30 13:23:14 2010 +1000
dix: fix up erroneous error message.
(WW) Device 'device name' has 36 axes, only using first 36.
does seem a bit silly.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/dix/devices.c b/dix/devices.c
index 034d5e6..ac5806a 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1239,7 +1239,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
if (!dev)
return FALSE;
- if (numAxes >= MAX_VALUATORS)
+ if (numAxes > MAX_VALUATORS)
{
LogMessage(X_WARNING,
"Device '%s' has %d axes, only using first %d.\n",
commit dbf249ec6638f0a8dfa4c2286099845aafc8ac88
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Jun 29 10:43:51 2010 +1000
xkb: remove now obsolete comment.
Looks like nothing broke from removing the hardcoded CoreProcessPointerEvent
call. Whoop. Di. Doo.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index b5486b7..6d17c75 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -712,22 +712,6 @@ DeviceEvent *event = &ev->device_event;
changed |= XkbPointerButtonMask;
}
- /* Guesswork. mostly.
- * xkb actuall goes through some effort to transparently wrap the
- * processInputProcs (see XkbSetExtension). But we all love fun, so the
- * previous XKB implementation just hardcoded the CPPE call here instead
- * of unwrapping like anybody with any sense of decency would do.
- * I got no clue what the correct thing to do is, but my guess is that
- * it's not hardcoding. I may be wrong. whatever it is, don't come whining
- * to me. I just work here.
- *
- * Anyway. here's the old call, if you don't like the wrapping, revert it.
- *
- * CoreProcessPointerEvent(xE,mouse,count);
- *
- * see. it's still steaming. told you. (whot)
- */
-
UNWRAP_PROCESS_INPUT_PROC(mouse, xkbPrivPtr, backupproc);
mouse->public.processInputProc(ev, mouse);
COND_WRAP_PROCESS_INPUT_PROC(mouse, xkbPrivPtr,
commit 1884db430a5680e37e94726dff46686e2218d525
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Thu Jun 24 12:52:53 2010 +1000
Revert "dix: use the event mask of the grab for TryClientEvents."
Behaviour of earlier X servers was to deliver the ButtonPress event
unconditionally, regardless of the actual event mask being set. This is
documented in the protocol:
"This request establishes a passive grab. In the future, the pointer is
actively grabbed as described in GrabPointer, the last-pointer-grab time is
set to the time at which the button was pressed (as transmitted in the
ButtonPress event), and the ButtonPress event is reported if all of the
following conditions are true:
<list of conditions, event mask is not one of them>"
Thus, a GrabButton event will always deliver the button press event, a
GrabKey always the key press event, etc. Same goes for XI and XI2.
Reproducible with a simple client requesting a button grab in the form of:
XGrabButton(dpy, AnyButton, AnyModifier, win, True, ButtonReleaseMask,
GrabModeAsync, GrabModeAsync, None, None);
On servers before MPX/XI2, the client will receive a button press and
release event. On current servers, the client receives only the release.
Clients that expect the press event to be delivered unconditionally.
XTS Xlib13 XGrabButton 5/39 now passes.
This reverts commit 48585bd1e3e98db0f3df1ecc68022510216e00cc.
Effectively reverts commit 1c612acca8568fcdf9761d23f112adaf4d496f1b as well,
the code introduced with 1c612 is not needed anymore.
Conflicts:
dix/events.c
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
Acked-by: Daniel Stone <daniel at fooishbar.org>
Reviewed-by: Keith Packard <keithp at keithp.com>
diff --git a/dix/events.c b/dix/events.c
index ae9847c..e1c3d0a 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3420,7 +3420,6 @@ CheckPassiveGrabsOnWindow(
{
DeviceIntPtr gdev;
XkbSrvInfoPtr xkbi = NULL;
- Mask mask = 0;
gdev= grab->modifierDevice;
if (grab->grabtype == GRABTYPE_CORE)
@@ -3535,9 +3534,6 @@ CheckPassiveGrabsOnWindow(
}
xE = &core;
count = 1;
- mask = grab->eventMask;
- if (grab->ownerEvents)
- mask |= pWin->eventMask;
} else if (match & XI2_MATCH)
{
rc = EventToXI2((InternalEvent*)event, &xE);
@@ -3549,34 +3545,6 @@ CheckPassiveGrabsOnWindow(
continue;
}
count = 1;
-
- /* FIXME: EventToXI2 returns NULL for enter events, so
- * dereferencing the event is bad. Internal event types are
- * aligned with core events, so the else clause is valid.
- * long-term we should use internal events for enter/focus
- * as well */
- if (xE)
- mask = grab->xi2mask[device->id][((xGenericEvent*)xE)->evtype/8];
- else if (event->type == XI_Enter || event->type == XI_FocusIn)
- mask = grab->xi2mask[device->id][event->type/8];
-
- if (grab->ownerEvents && wOtherInputMasks(grab->window))
- {
- InputClientsPtr icp =
- wOtherInputMasks(grab->window)->inputClients;
-
- while(icp)
- {
- if (rClient(icp) == rClient(grab))
- {
- int evtype = (xE) ? ((xGenericEvent*)xE)->evtype : event->type;
- mask |= icp->xi2mask[device->id][evtype/8];
- break;
- }
-
- icp = icp->next;
- }
- }
} else
{
rc = EventToXI((InternalEvent*)event, &xE, &count);
@@ -3587,23 +3555,6 @@ CheckPassiveGrabsOnWindow(
"(%d, %d).\n", device->name, event->type, rc);
continue;
}
- mask = grab->eventMask;
- if (grab->ownerEvents && wOtherInputMasks(grab->window))
- {
- InputClientsPtr icp =
- wOtherInputMasks(grab->window)->inputClients;
-
- while(icp)
- {
- if (rClient(icp) == rClient(grab))
- {
- mask |= icp->mask[device->id];
- break;
- }
-
- icp = icp->next;
- }
- }
}
(*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE);
@@ -3612,7 +3563,8 @@ CheckPassiveGrabsOnWindow(
{
FixUpEventFromWindow(device, xE, grab->window, None, TRUE);
- TryClientEvents(rClient(grab), device, xE, count, mask,
+ TryClientEvents(rClient(grab), device, xE, count,
+ GetEventFilter(device, xE),
GetEventFilter(device, xE), grab);
}
More information about the Xquartz-changes
mailing list