Fixed Spaces issue, correctly -- dragging an X window from one
Space to another in Expose mode now works.
This commit is contained in:
parent
be688397ef
commit
774920637a
@ -127,7 +127,6 @@ enum {
|
||||
= LASTEvent+1, // (from X.h list of event names)
|
||||
kXDarwinUpdateButtons, // update state of mouse buttons 2 and up
|
||||
kXDarwinScrollWheel, // scroll wheel event
|
||||
|
||||
/*
|
||||
* Quartz-specific events -- not used in IOKit mode
|
||||
*/
|
||||
@ -138,6 +137,8 @@ enum {
|
||||
kXDarwinReadPasteboard, // copy Mac OS X pasteboard into X cut buffer
|
||||
kXDarwinWritePasteboard, // copy X cut buffer onto Mac OS X pasteboard
|
||||
kXDarwinBringAllToFront, // bring all X windows to front
|
||||
kXDarwinToggleFullscreen, // Enable/Disable fullscreen mode
|
||||
kXDarwinSetRootless, // Set rootless mode
|
||||
/*
|
||||
* AppleWM events
|
||||
*/
|
||||
|
@ -342,8 +342,22 @@ void DarwinModeProcessEvent(
|
||||
xEvent *xe)
|
||||
{
|
||||
switch (xe->u.u.type) {
|
||||
case kXDarwinControllerNotify:
|
||||
AppleWMSendEvent(AppleWMControllerNotify,
|
||||
AppleWMControllerNotifyMask,
|
||||
xe->u.clientMessage.u.l.longs0,
|
||||
xe->u.clientMessage.u.l.longs1);
|
||||
break;
|
||||
|
||||
case kXDarwinPasteboardNotify:
|
||||
AppleWMSendEvent(AppleWMPasteboardNotify,
|
||||
AppleWMPasteboardNotifyMask,
|
||||
xe->u.clientMessage.u.l.longs0,
|
||||
xe->u.clientMessage.u.l.longs1);
|
||||
break;
|
||||
|
||||
case kXDarwinActivate:
|
||||
ErrorF("kXDarwinActivate\n");
|
||||
QuartzShow(xe->u.keyButtonPointer.rootX,
|
||||
xe->u.keyButtonPointer.rootY);
|
||||
AppleWMSendEvent(AppleWMActivationNotify,
|
||||
@ -352,12 +366,48 @@ void DarwinModeProcessEvent(
|
||||
break;
|
||||
|
||||
case kXDarwinDeactivate:
|
||||
ErrorF("kXDarwinDeactivate\n");
|
||||
AppleWMSendEvent(AppleWMActivationNotify,
|
||||
AppleWMActivationNotifyMask,
|
||||
AppleWMIsInactive, 0);
|
||||
QuartzHide();
|
||||
break;
|
||||
|
||||
case kXDarwinDisplayChanged:
|
||||
ErrorF("kXDarwinDisplayChanged\n");
|
||||
QuartzUpdateScreens();
|
||||
break;
|
||||
|
||||
case kXDarwinWindowState:
|
||||
ErrorF("kXDarwinWindowState\n");
|
||||
RootlessNativeWindowStateChanged(xe->u.clientMessage.u.l.longs0,
|
||||
xe->u.clientMessage.u.l.longs1);
|
||||
break;
|
||||
|
||||
case kXDarwinWindowMoved:
|
||||
ErrorF("kXDarwinWindowMoved\n");
|
||||
RootlessNativeWindowMoved (xe->u.clientMessage.u.l.longs0);
|
||||
break;
|
||||
|
||||
case kXDarwinToggleFullscreen:
|
||||
#ifdef DARWIN_DDX_MISSING
|
||||
if (quartzEnableRootless) QuartzSetFullscreen(!quartzHasRoot);
|
||||
else if (quartzHasRoot) QuartzHide();
|
||||
else QuartzShow();
|
||||
#else
|
||||
ErrorF("kXDarwinToggleFullscreen not implemented\n");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case kXDarwinSetRootless:
|
||||
#ifdef DARWIN_DDX_MISSING
|
||||
QuartzSetRootless(xe->u.clientMessage.u.l.longs0);
|
||||
if (!quartzEnableRootless && !quartzHasRoot) QuartzHide();
|
||||
#else
|
||||
ErrorF("kXDarwinSetRootless not implemented\n");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case kXDarwinSetRootClip:
|
||||
QuartzSetRootClip((BOOL)xe->u.clientMessage.u.l.longs0);
|
||||
break;
|
||||
@ -374,46 +424,13 @@ void DarwinModeProcessEvent(
|
||||
QuartzWritePasteboard();
|
||||
break;
|
||||
|
||||
/*
|
||||
* AppleWM events
|
||||
*/
|
||||
case kXDarwinControllerNotify:
|
||||
AppleWMSendEvent(AppleWMControllerNotify,
|
||||
AppleWMControllerNotifyMask,
|
||||
xe->u.clientMessage.u.l.longs0,
|
||||
xe->u.clientMessage.u.l.longs1);
|
||||
break;
|
||||
|
||||
case kXDarwinPasteboardNotify:
|
||||
AppleWMSendEvent(AppleWMPasteboardNotify,
|
||||
AppleWMPasteboardNotifyMask,
|
||||
xe->u.clientMessage.u.l.longs0,
|
||||
xe->u.clientMessage.u.l.longs1);
|
||||
break;
|
||||
|
||||
case kXDarwinDisplayChanged:
|
||||
QuartzUpdateScreens();
|
||||
break;
|
||||
|
||||
case kXDarwinBringAllToFront:
|
||||
ErrorF("kXDarwinBringAllToFront\n");
|
||||
RootlessOrderAllWindows();
|
||||
break;
|
||||
|
||||
case kXDarwinWindowState:
|
||||
ErrorF("kXDarwinWindowState\n");
|
||||
break;
|
||||
case kXDarwinWindowMoved: {
|
||||
WindowPtr pWin = (WindowPtr)xe->u.clientMessage.u.l.longs0;
|
||||
short x = xe->u.clientMessage.u.l.longs1,
|
||||
y = xe->u.clientMessage.u.l.longs2;
|
||||
ErrorF("kXDarwinWindowMoved(%p, %hd, %hd)\n", pWin, x, y);
|
||||
RootlessMoveWindow(pWin, x, y, pWin->nextSib, VTMove);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ErrorF("Unknown application defined event type %d.\n",
|
||||
xe->u.u.type);
|
||||
ErrorF("Unknown application defined event type %d.\n", xe->u.u.type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,6 +122,7 @@ typedef struct _QuartzModeProcs {
|
||||
} QuartzModeProcsRec, *QuartzModeProcsPtr;
|
||||
|
||||
extern QuartzModeProcsPtr quartzProcs;
|
||||
extern int quartzHasRoot, quartzEnableRootless;
|
||||
|
||||
Bool QuartzLoadDisplayBundle(const char *dpyBundleName);
|
||||
|
||||
|
@ -74,6 +74,8 @@ typedef struct _RootlessWindowRec {
|
||||
|
||||
unsigned int is_drawing :1; // Currently drawing?
|
||||
unsigned int is_reorder_pending :1;
|
||||
unsigned int is_offscreen :1;
|
||||
unsigned int is_obscured :1;
|
||||
} RootlessWindowRec, *RootlessWindowPtr;
|
||||
|
||||
|
||||
|
@ -36,13 +36,23 @@
|
||||
#include <stddef.h> /* For NULL */
|
||||
#include <limits.h> /* For CHAR_BIT */
|
||||
#include <assert.h>
|
||||
#ifdef __APPLE__
|
||||
//#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include "mi.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "windowstr.h"
|
||||
#include <Xplugin.h>
|
||||
//#include <X11/extensions/applewm.h>
|
||||
extern int darwinMainScreenX, darwinMainScreenY;
|
||||
#endif
|
||||
#include "fb.h"
|
||||
|
||||
#define AppleWMNumWindowLevels 5
|
||||
|
||||
#include "rootlessCommon.h"
|
||||
#include "rootlessWindow.h"
|
||||
|
||||
#include "fb.h"
|
||||
|
||||
|
||||
#ifdef ROOTLESS_GLOBAL_COORDS
|
||||
#define SCREEN_TO_GLOBAL_X \
|
||||
(dixScreenOrigins[pScreen->myNum].x + rootlessGlobalOffsetX)
|
||||
@ -53,6 +63,127 @@
|
||||
#define SCREEN_TO_GLOBAL_Y 0
|
||||
#endif
|
||||
|
||||
#define DEFINE_ATOM_HELPER(func,atom_name) \
|
||||
static Atom func (void) { \
|
||||
static unsigned int generation; \
|
||||
static Atom atom; \
|
||||
if (generation != serverGeneration) { \
|
||||
generation = serverGeneration; \
|
||||
atom = MakeAtom (atom_name, strlen (atom_name), TRUE); \
|
||||
} \
|
||||
return atom; \
|
||||
}
|
||||
|
||||
DEFINE_ATOM_HELPER (xa_native_screen_origin, "_NATIVE_SCREEN_ORIGIN")
|
||||
DEFINE_ATOM_HELPER (xa_native_window_id, "_NATIVE_WINDOW_ID")
|
||||
DEFINE_ATOM_HELPER (xa_apple_no_order_in, "_APPLE_NO_ORDER_IN")
|
||||
|
||||
static Bool no_configure_window;
|
||||
static Bool windows_hidden;
|
||||
// TODO - abstract xp functions
|
||||
|
||||
static const int normal_window_levels[AppleWMNumWindowLevels+1] = {
|
||||
0, 3, 4, 5, LONG_MIN + 30, LONG_MIN + 29,
|
||||
};
|
||||
static const int rooted_window_levels[AppleWMNumWindowLevels+1] = {
|
||||
202, 203, 204, 205, 201, 200
|
||||
};
|
||||
|
||||
static inline int
|
||||
configure_window (xp_window_id id, unsigned int mask,
|
||||
const xp_window_changes *values)
|
||||
{
|
||||
if (!no_configure_window)
|
||||
return xp_configure_window (id, mask, values);
|
||||
else
|
||||
return XP_Success;
|
||||
}
|
||||
|
||||
/*static inline unsigned long
|
||||
current_time_in_seconds (void)
|
||||
{
|
||||
unsigned long t = 0;
|
||||
|
||||
t += currentTime.milliseconds / 1000;
|
||||
t += currentTime.months * 4294967;
|
||||
|
||||
return t;
|
||||
} */
|
||||
|
||||
static inline Bool
|
||||
rootlessHasRoot (ScreenPtr pScreen)
|
||||
{
|
||||
return WINREC (WindowTable[pScreen->myNum]) != NULL;
|
||||
}
|
||||
|
||||
void
|
||||
RootlessNativeWindowStateChanged (xp_window_id id, unsigned int state)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
RootlessWindowRec *winRec;
|
||||
|
||||
pWin = xprGetXWindow (id);
|
||||
if (pWin == NULL) return;
|
||||
|
||||
winRec = WINREC (pWin);
|
||||
if (winRec == NULL) return;
|
||||
|
||||
winRec->is_offscreen = ((state & XP_WINDOW_STATE_OFFSCREEN) != 0);
|
||||
winRec->is_obscured = ((state & XP_WINDOW_STATE_OBSCURED) != 0);
|
||||
// pWin->rootlessUnhittable = winRec->is_offscreen;
|
||||
}
|
||||
|
||||
void
|
||||
RootlessNativeWindowMoved (WindowPtr pWin)
|
||||
{
|
||||
xp_box bounds;
|
||||
int sx, sy;
|
||||
XID vlist[2];
|
||||
Mask mask;
|
||||
ClientPtr client;
|
||||
RootlessWindowRec *winRec = WINREC(pWin);
|
||||
|
||||
if (xp_get_window_bounds (winRec->wid, &bounds) != Success) return;
|
||||
|
||||
sx = dixScreenOrigins[pWin->drawable.pScreen->myNum].x + darwinMainScreenX;
|
||||
sy = dixScreenOrigins[pWin->drawable.pScreen->myNum].y + darwinMainScreenY;
|
||||
|
||||
/* Fake up a ConfigureWindow packet to resize the window to the current bounds. */
|
||||
|
||||
vlist[0] = (INT16) bounds.x1 - sx;
|
||||
vlist[1] = (INT16) bounds.y1 - sy;
|
||||
mask = CWX | CWY;
|
||||
|
||||
/* pretend we're the owner of the window! */
|
||||
client = LookupClient (pWin->drawable.id, NullClient);
|
||||
|
||||
/* Don't want to do anything to the physical window (avoids
|
||||
notification-response feedback loops) */
|
||||
|
||||
no_configure_window = TRUE;
|
||||
ConfigureWindow (pWin, mask, vlist, client);
|
||||
no_configure_window = FALSE;
|
||||
}
|
||||
|
||||
/* Updates the _NATIVE_SCREEN_ORIGIN property on the given root window. */
|
||||
static void
|
||||
set_screen_origin (WindowPtr pWin)
|
||||
{
|
||||
long data[2];
|
||||
|
||||
if (!IsRoot (pWin))
|
||||
return;
|
||||
|
||||
/* FIXME: move this to an extension? */
|
||||
|
||||
data[0] = (dixScreenOrigins[pWin->drawable.pScreen->myNum].x
|
||||
+ darwinMainScreenX);
|
||||
data[1] = (dixScreenOrigins[pWin->drawable.pScreen->myNum].y
|
||||
+ darwinMainScreenY);
|
||||
|
||||
ChangeWindowProperty (pWin, xa_native_screen_origin (), XA_INTEGER,
|
||||
32, PropModeReplace, 2, data, TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* RootlessCreateWindow
|
||||
@ -567,7 +698,6 @@ RootlessRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib)
|
||||
RL_DEBUG_MSG("restackwindow end\n");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Specialized window copy procedures
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user