xserver: Branch 'xorg-server-1.5-apple' - 2 commits
Jeremy Huddleston
jeremyhu at kemper.freedesktop.org
Sun Apr 5 16:32:23 PDT 2009
hw/xquartz/X11Application.m | 51 +++++++++++++++++++++++++-------------------
hw/xquartz/xpr/xprFrame.c | 41 ++++++++++++++++++++++-------------
2 files changed, 56 insertions(+), 36 deletions(-)
New commits:
commit 322b6d61741eb9f46a21f8258de318ff41df6ccb
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Sun Apr 5 03:20:40 2009 -0700
XQuartz: Use updated Xplugin API to send overide-redirect windows to the current space when they're ordered in
This fixes the annoying "using a menu moves me to another space" bug
(cherry picked from commit 9e6dab89e08a26d764ba1aeaeb804c3d25c667da)
diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index 9a143ad..a7fc3a9 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -120,7 +120,7 @@ xprSetNativeProperty(RootlessWindowPtr pFrame)
/*
* Create and display a new frame.
*/
-Bool
+static Bool
xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
int newX, int newY, RegionPtr pShape)
{
@@ -187,7 +187,7 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
/*
* Destroy a frame.
*/
-void
+static void
xprDestroyFrame(RootlessFrameID wid)
{
TA_SERVER();
@@ -203,7 +203,7 @@ xprDestroyFrame(RootlessFrameID wid)
/*
* Move a frame on screen.
*/
-void
+static void
xprMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY)
{
TA_SERVER();
@@ -220,7 +220,7 @@ xprMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY)
/*
* Resize and move a frame.
*/
-void
+static void
xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
int newX, int newY, unsigned int newW, unsigned int newH,
unsigned int gravity)
@@ -245,7 +245,7 @@ xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
/*
* Change frame stacking.
*/
-void
+static void
xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid)
{
xp_window_changes wc;
@@ -257,12 +257,22 @@ xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid)
if (nextWid == NULL)
{
+#if defined(XPLUGIN_VERSION) && XPLUGIN_VERSION >= 3
+ WindowPtr pWin = xprGetXWindow((xp_window_id)wid);
+ wc.stack_mode = (pWin && pWin->overrideRedirect) ? XP_MAPPED_ABOVE_CURRENT_SPACE : XP_MAPPED_ABOVE;
+#else
wc.stack_mode = XP_MAPPED_ABOVE;
+#endif
wc.sibling = 0;
}
else
{
+#if defined(XPLUGIN_VERSION) && XPLUGIN_VERSION >= 3
+ WindowPtr pWin = xprGetXWindow((xp_window_id)wid);
+ wc.stack_mode = (pWin && pWin->overrideRedirect) ? XP_MAPPED_BELOW_CURRENT_SPACE : XP_MAPPED_BELOW;
+#else
wc.stack_mode = XP_MAPPED_BELOW;
+#endif
wc.sibling = x_cvt_vptr_to_uint(nextWid);
}
@@ -273,7 +283,7 @@ xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid)
/*
* Change the frame's shape.
*/
-void
+static void
xprReshapeFrame(RootlessFrameID wid, RegionPtr pShape)
{
xp_window_changes wc;
@@ -300,7 +310,7 @@ xprReshapeFrame(RootlessFrameID wid, RegionPtr pShape)
/*
* Unmap a frame.
*/
-void
+static void
xprUnmapFrame(RootlessFrameID wid)
{
xp_window_changes wc;
@@ -318,7 +328,7 @@ xprUnmapFrame(RootlessFrameID wid)
* Start drawing to a frame.
* Prepare for direct access to its backing buffer.
*/
-void
+static void
xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
{
void *data[2];
@@ -339,7 +349,7 @@ xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
/*
* Stop drawing to a frame.
*/
-void
+static void
xprStopDrawing(RootlessFrameID wid, Bool flush)
{
TA_SERVER();
@@ -351,7 +361,7 @@ xprStopDrawing(RootlessFrameID wid, Bool flush)
/*
* Flush drawing updates to the screen.
*/
-void
+static void
xprUpdateRegion(RootlessFrameID wid, RegionPtr pDamage)
{
TA_SERVER();
@@ -363,7 +373,7 @@ xprUpdateRegion(RootlessFrameID wid, RegionPtr pDamage)
/*
* Mark damaged rectangles as requiring redisplay to screen.
*/
-void
+static void
xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec *rects,
int shift_x, int shift_y)
{
@@ -377,7 +387,7 @@ xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec *rects,
* Called after the window associated with a frame has been switched
* to a new top-level parent.
*/
-void
+static void
xprSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin)
{
DeleteProperty(serverClient, oldWin, xa_native_window_id());
@@ -391,7 +401,7 @@ xprSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin)
/*
* Called to check if the frame should be reordered when it is restacked.
*/
-Bool xprDoReorderWindow(RootlessWindowPtr pFrame)
+static Bool xprDoReorderWindow(RootlessWindowPtr pFrame)
{
WindowPtr pWin = pFrame->win;
@@ -405,7 +415,7 @@ Bool xprDoReorderWindow(RootlessWindowPtr pFrame)
* Copy area in frame to another part of frame.
* Used to accelerate scrolling.
*/
-void
+static void
xprCopyWindow(RootlessFrameID wid, int dstNrects, const BoxRec *dstRects,
int dx, int dy)
{
@@ -473,6 +483,7 @@ xprGetXWindow(xp_window_id wid)
return winRec != NULL ? winRec->win : NULL;
}
+#ifdef UNUSED_CODE
/*
* Given the id of a physical window, try to find the top-level (or root)
* X window that it represents.
@@ -503,7 +514,7 @@ xprGetXWindowFromAppKit(int windowNumber)
return winRec != NULL ? winRec->win : NULL;
}
-
+#endif
/*
* The windowNumber is an AppKit window number. Returns TRUE if xpr is
commit e2b09eaed78979771434f385757e26feaebf7968
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Sun Apr 5 00:06:57 2009 -0700
XQuartz: Send a MotionNotify event for the mouse cursor when activating X11.app
Otherwise if X11.app was activated with a mouse click, the location of the even is the last location of the cursor before X11 was deactivated
(cherry picked from commit c7457d7b31ddd2ddfd04dd6294bed4532664e1ab)
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index bd4b275..937517c 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -80,6 +80,11 @@ static KeyboardLayoutRef last_key_layout;
extern int darwinFakeButtons;
+/* Store the mouse location while in the background, and update X11's pointer
+ * location when we become the foreground application
+ */
+static NSPoint bgMouseLocation;
+
X11Application *X11App;
CFStringRef app_prefs_domain_cfstr = NULL;
@@ -188,6 +193,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
size_t i;
DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active)
if (state) {
+ DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, bgMouseLocation.x, bgMouseLocation.y, 0.0, 0.0, 0.0);
DarwinSendDDXEvent(kXquartzActivate, 0);
if (!_x_active) {
@@ -954,10 +960,10 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
- (void) sendX11NSEvent:(NSEvent *)e {
NSRect screen;
- NSPoint location;
+ NSPoint location, tilt;
NSWindow *window;
int ev_button, ev_type;
- float pointer_x, pointer_y, pressure, tilt_x, tilt_y;
+ float pressure;
DeviceIntPtr pDev;
int modifierFlags;
@@ -984,10 +990,8 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
/* Setup our valuators. These will range from 0 to 1 */
pressure = 0;
- tilt_x = 0;
- tilt_y = 0;
- pointer_x = location.x;
- pointer_y = location.y;
+ tilt.x = 0.0;
+ tilt.y = 0.0;
modifierFlags = [e modifierFlags];
@@ -1055,14 +1059,13 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
pDev = darwinTabletCurrent;
*/
- DarwinSendProximityEvents([e isEnteringProximity]?ProximityIn:ProximityOut,
- pointer_x, pointer_y);
+ DarwinSendProximityEvents([e isEnteringProximity] ? ProximityIn : ProximityOut,
+ location.x, location.y);
}
if ([e type] == NSTabletPoint || [e subtype] == NSTabletPointEventSubtype) {
pressure = [e pressure];
- tilt_x = [e tilt].x;
- tilt_y = [e tilt].y;
+ tilt = [e tilt];
pDev = darwinTabletCurrent;
}
@@ -1076,23 +1079,29 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
//#if defined(XPLUGIN_VERSION) && XPLUGIN_VERSION > 0
/* Older libXplugin (Tiger/"Stock" Leopard) aren't thread safe, so we can't call xp_find_window from the Appkit thread */
xp_window_id wid;
+ xp_error e;
/* Sigh. Need to check that we're really over one of
* our windows. (We need to receive pointer events while
* not in the foreground, but we don't want to receive them
* when another window is over us or we might show a tooltip)
*/
-
+
wid = 0;
-
- if (xp_find_window(pointer_x, pointer_y, 0, &wid) == XP_Success &&
- wid == 0)
+ e = xp_find_window(location.x, location.y, 0, &wid);
+
+ if (e == XP_Success && wid == 0) {
+ bgMouseLocation = location;
+ return;
+ }
+#else
+ bgMouseLocation = location;
+ return;
#endif
- return;
}
- DarwinSendPointerEvents(pDev, ev_type, ev_button, pointer_x, pointer_y,
- pressure, tilt_x, tilt_y);
+ DarwinSendPointerEvents(pDev, ev_type, ev_button, location.x, location.y,
+ pressure, tilt.x, tilt.y);
break;
@@ -1111,13 +1120,13 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
break;
}
- DarwinSendProximityEvents([e isEnteringProximity]?ProximityIn:ProximityOut,
- pointer_x, pointer_y);
+ DarwinSendProximityEvents([e isEnteringProximity] ? ProximityIn : ProximityOut,
+ location.x, location.y);
break;
case NSScrollWheel:
- DarwinSendScrollEvents([e deltaX], [e deltaY], pointer_x, pointer_y,
- pressure, tilt_x, tilt_y);
+ DarwinSendScrollEvents([e deltaX], [e deltaY], location.x, location.y,
+ pressure, tilt.x, tilt.y);
break;
case NSKeyDown: case NSKeyUp:
More information about the xorg-commit
mailing list