From b1764ddf133cfdf979db62ee2491124a4798b55b Mon Sep 17 00:00:00 2001 From: Ben Byer Date: Mon, 5 Nov 2007 05:44:54 -0800 Subject: pulling more patches over from xorg-xserver-1.2-apple branch --- hw/darwin/darwin.h | 1 + hw/darwin/quartz/XDarwinStartup.man | 1 - hw/darwin/quartz/applewm.c | 2 +- hw/darwin/quartz/fullscreen/quartzCursor.h | 3 +- hw/darwin/quartz/keysym2ucs.c | 3 +- hw/darwin/quartz/quartz.c | 23 +++++++---- hw/darwin/quartz/quartz.h | 3 +- hw/darwin/quartz/quartzCocoa.m | 8 +++- hw/darwin/quartz/quartzCursor.h | 3 +- hw/darwin/quartz/quartzKeyboard.c | 62 +++++++++++++++--------------- hw/darwin/quartz/xpr/dri.c | 2 +- hw/darwin/quartz/xpr/xprScreen.c | 8 ++++ miext/rootless/rootless.h | 4 ++ miext/rootless/rootlessWindow.c | 26 +++++++++++++ 14 files changed, 98 insertions(+), 51 deletions(-) diff --git a/hw/darwin/darwin.h b/hw/darwin/darwin.h index de104006c..70ce57e01 100644 --- a/hw/darwin/darwin.h +++ b/hw/darwin/darwin.h @@ -141,6 +141,7 @@ enum { kXDarwinQuit, // kill the X server and release the display 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 /* * AppleWM events */ diff --git a/hw/darwin/quartz/XDarwinStartup.man b/hw/darwin/quartz/XDarwinStartup.man index 9bf7dfabd..1ad3bbced 100644 --- a/hw/darwin/quartz/XDarwinStartup.man +++ b/hw/darwin/quartz/XDarwinStartup.man @@ -1,4 +1,3 @@ -.\" $XFree86: xc/programs/Xserver/hw/darwin/bundle/XDarwinStartup.man,v 1.1 2002/02/05 19:16:14 torrey Exp $ .TH XDarwinStartup 1 .SH NAME XDarwinStartup - Startup program for the XDarwin X window server diff --git a/hw/darwin/quartz/applewm.c b/hw/darwin/quartz/applewm.c index d3c26ed28..308c51074 100644 --- a/hw/darwin/quartz/applewm.c +++ b/hw/darwin/quartz/applewm.c @@ -1,6 +1,6 @@ /************************************************************************** -Copyright (c) 2002 Apple Computer, Inc. All Rights Reserved. +Copyright (c) 2002-2007 Apple Inc. All Rights Reserved. Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a diff --git a/hw/darwin/quartz/fullscreen/quartzCursor.h b/hw/darwin/quartz/fullscreen/quartzCursor.h index 57fac68a5..56a02098d 100644 --- a/hw/darwin/quartz/fullscreen/quartzCursor.h +++ b/hw/darwin/quartz/fullscreen/quartzCursor.h @@ -2,8 +2,7 @@ * quartzCursor.h * * External interface for Quartz hardware cursor - */ -/* + * * Copyright (c) 2001 Torrey T. Lyons and Greg Parker. * All Rights Reserved. * diff --git a/hw/darwin/quartz/keysym2ucs.c b/hw/darwin/quartz/keysym2ucs.c index 3be59df33..8626ebc4e 100644 --- a/hw/darwin/quartz/keysym2ucs.c +++ b/hw/darwin/quartz/keysym2ucs.c @@ -1,4 +1,5 @@ -/* +/* + * * This module converts keysym values into the corresponding ISO 10646 * (UCS, Unicode) values. * diff --git a/hw/darwin/quartz/quartz.c b/hw/darwin/quartz/quartz.c index 374f365f2..25061a8b3 100644 --- a/hw/darwin/quartz/quartz.c +++ b/hw/darwin/quartz/quartz.c @@ -1,9 +1,7 @@ -/************************************************************** +/* * * Quartz-specific support for the Darwin X Server * - **************************************************************/ -/* * Copyright (c) 2001-2004 Greg Parker and Torrey T. Lyons. * All Rights Reserved. * @@ -64,7 +62,7 @@ int quartzServerVisible = TRUE; int quartzServerQuitting = FALSE; int quartzScreenIndex = 0; int aquaMenuBarHeight = 0; -int noPseudoramiXExtension = TRUE; +int noPseudoramiXExtension = FALSE; QuartzModeProcsPtr quartzProcs = NULL; const char *quartzOpenGLBundle = NULL; @@ -397,11 +395,22 @@ void DarwinModeProcessEvent( QuartzUpdateScreens(); break; - case kXDarwinWindowState: - case kXDarwinWindowMoved: - // FIXME: Not implemented yet + case kXDarwinBringAllToFront: + 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); diff --git a/hw/darwin/quartz/quartz.h b/hw/darwin/quartz/quartz.h index f1b36b6b1..fa7499df1 100644 --- a/hw/darwin/quartz/quartz.h +++ b/hw/darwin/quartz/quartz.h @@ -3,8 +3,7 @@ * * External interface of the Quartz display modes seen by the generic, mode * independent parts of the Darwin X server. - */ -/* + * * Copyright (c) 2001-2003 Greg Parker and Torrey T. Lyons. * All Rights Reserved. * diff --git a/hw/darwin/quartz/quartzCocoa.m b/hw/darwin/quartz/quartzCocoa.m index 33c50a1c6..3987cd2c2 100644 --- a/hw/darwin/quartz/quartzCocoa.m +++ b/hw/darwin/quartz/quartzCocoa.m @@ -42,14 +42,16 @@ #include +#ifndef INXQUARTZ #import "Preferences.h" +#endif #include "pseudoramiX.h" extern void FatalError(const char *, ...); extern char *display; extern int noPanoramiXExtension; - +#ifndef INXQUARTZ /* * QuartzReadPreferences * Read the user preferences from the Cocoa front end. @@ -95,7 +97,7 @@ void QuartzReadPreferences(void) darwinDesiredDepth = [Preferences depth] - 1; } - +#endif /* * QuartzWriteCocoaPasteboard @@ -160,6 +162,7 @@ char *QuartzReadCocoaPasteboard(void) int QuartzFSUseQDCursor( int depth) // screen depth { +#ifndef INXQUARTZ switch ([Preferences useQDCursor]) { case qdCursor_Always: return TRUE; @@ -171,6 +174,7 @@ int QuartzFSUseQDCursor( else return FALSE; } +#endif return TRUE; } diff --git a/hw/darwin/quartz/quartzCursor.h b/hw/darwin/quartz/quartzCursor.h index 57fac68a5..56a02098d 100644 --- a/hw/darwin/quartz/quartzCursor.h +++ b/hw/darwin/quartz/quartzCursor.h @@ -2,8 +2,7 @@ * quartzCursor.h * * External interface for Quartz hardware cursor - */ -/* + * * Copyright (c) 2001 Torrey T. Lyons and Greg Parker. * All Rights Reserved. * diff --git a/hw/darwin/quartz/quartzKeyboard.c b/hw/darwin/quartz/quartzKeyboard.c index f81ef0abc..b580a8e84 100644 --- a/hw/darwin/quartz/quartzKeyboard.c +++ b/hw/darwin/quartz/quartzKeyboard.c @@ -217,42 +217,41 @@ DarwinModeReadSystemKeymap (darwinKeyboardInfo *info) const void *chr_data = NULL; int num_keycodes = NUM_KEYCODES; UInt32 keyboard_type = 0; - int is_uchr, i, j; + int is_uchr = 1, i, j; OSStatus err; KeySym *k; TISInputSourceRef currentKeyLayoutRef = TISCopyCurrentKeyboardLayoutInputSource(); - if (currentKeyLayoutRef) - { - CFDataRef currentKeyLayoutDataRef = (CFDataRef )TISGetInputSourceProperty(currentKeyLayoutRef, kTISPropertyUnicodeKeyLayoutData); - if (currentKeyLayoutDataRef) - chr_data = CFDataGetBytePtr(currentKeyLayoutDataRef); - } - - if (chr_data != NULL) - { - KLGetCurrentKeyboardLayout (&key_layout); - KLGetKeyboardLayoutProperty (key_layout, kKLuchrData, &chr_data); - - if (chr_data != NULL) + if (currentKeyLayoutRef) { - is_uchr = 1; - keyboard_type = LMGetKbdType (); + CFDataRef currentKeyLayoutDataRef = (CFDataRef )TISGetInputSourceProperty(currentKeyLayoutRef, kTISPropertyUnicodeKeyLayoutData); + if (currentKeyLayoutDataRef) + chr_data = CFDataGetBytePtr(currentKeyLayoutDataRef); + } + + if(chr_data == NULL) { + KLGetCurrentKeyboardLayout (&key_layout); + KLGetKeyboardLayoutProperty (key_layout, kKLuchrData, &chr_data); + + if (chr_data != NULL) + { + is_uchr = 1; + keyboard_type = LMGetKbdType (); + } + else + { + KLGetKeyboardLayoutProperty (key_layout, kKLKCHRData, &chr_data); + + if (chr_data == NULL) + { + ErrorF ( "Couldn't get uchr or kchr resource\n"); + return FALSE; + } + + is_uchr = 0; + num_keycodes = 128; + } } - else - { - KLGetKeyboardLayoutProperty (key_layout, kKLKCHRData, &chr_data); - - if (chr_data == NULL) - { - ErrorF ( "Couldn't get uchr or kchr resource\n"); - return FALSE; - } - - is_uchr = 0; - num_keycodes = 128; - } - } /* Scan the keycode range for the Unicode character that each key produces in the four shift states. Then convert that to @@ -376,8 +375,7 @@ DarwinModeReadSystemKeymap (darwinKeyboardInfo *info) } } } - - if(currentKeyLayoutRef) CFRelease(currentKeyLayoutRef); + if(currentKeyLayoutRef) CFRelease(currentKeyLayoutRef); return TRUE; } diff --git a/hw/darwin/quartz/xpr/dri.c b/hw/darwin/quartz/xpr/dri.c index acc1f45f7..fd0bff1a9 100644 --- a/hw/darwin/quartz/xpr/dri.c +++ b/hw/darwin/quartz/xpr/dri.c @@ -236,7 +236,7 @@ DRIFinishScreenInit(ScreenPtr pScreen) pDRIPriv->wrap.ClipNotify = pScreen->ClipNotify; pScreen->ClipNotify = DRIClipNotify; - ErrorF("[DRI] screen %d installation complete\n", pScreen->myNum); + // ErrorF("[DRI] screen %d installation complete\n", pScreen->myNum); return TRUE; } diff --git a/hw/darwin/quartz/xpr/xprScreen.c b/hw/darwin/quartz/xpr/xprScreen.c index 3f91980bd..709e6e8cc 100644 --- a/hw/darwin/quartz/xpr/xprScreen.c +++ b/hw/darwin/quartz/xpr/xprScreen.c @@ -45,6 +45,10 @@ # include "damage.h" #endif +/* 10.4's deferred update makes X slower.. have to live with the tearing + for now.. */ +#define XP_NO_DEFERRED_UPDATES 8 + // Name of GLX bundle for native OpenGL static const char *xprOpenGLBundle = "glxCGL.bundle"; @@ -59,10 +63,12 @@ eventHandler(unsigned int type, const void *arg, switch (type) { case XP_EVENT_DISPLAY_CHANGED: + // ErrorF("XP_EVENT_DISPLAY_MOVED\n"); QuartzMessageServerThread(kXDarwinDisplayChanged, 0); break; case XP_EVENT_WINDOW_STATE_CHANGED: + // ErrorF("XP_EVENT_WINDOW_STATE_CHANGED\n"); if (arg_size >= sizeof(xp_window_state_event)) { const xp_window_state_event *ws_arg = arg; @@ -73,6 +79,7 @@ eventHandler(unsigned int type, const void *arg, break; case XP_EVENT_WINDOW_MOVED: + // ErrorF("XP_EVENT_WINDOW_MOVED\n"); if (arg_size == sizeof(xp_window_id)) { xp_window_id id = * (xp_window_id *) arg; @@ -89,6 +96,7 @@ eventHandler(unsigned int type, const void *arg, case XP_EVENT_SURFACE_DESTROYED: case XP_EVENT_SURFACE_CHANGED: + // ErrorF("XP_EVENT_SURFACE_MOVED\n"); if (arg_size == sizeof(xp_surface_id)) { int kind; diff --git a/miext/rootless/rootless.h b/miext/rootless/rootless.h index f83defeb6..d9fdb6adb 100644 --- a/miext/rootless/rootless.h +++ b/miext/rootless/rootless.h @@ -432,4 +432,8 @@ void RootlessUpdateScreenPixmap(ScreenPtr pScreen); */ void RootlessRepositionWindows(ScreenPtr pScreen); +/* + * Bring all windows to the front of the Aqua stack + */ +void RootlessOrderAllWindows (void); #endif /* _ROOTLESS_H */ diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c index f7126590b..4a3c0f6ae 100644 --- a/miext/rootless/rootlessWindow.c +++ b/miext/rootless/rootlessWindow.c @@ -1376,3 +1376,29 @@ RootlessChangeBorderWidth(WindowPtr pWin, unsigned int width) RL_DEBUG_MSG("change border width end\n"); } + +/* + * RootlessOrderAllWindows + * Brings all X11 windows to the top of the window stack + * (i.e in front of Aqua windows) -- called when X11.app is given focus + */ +void +RootlessOrderAllWindows (void) +{ + int i; + WindowPtr pWin; + + RL_DEBUG_MSG("RootlessOrderAllWindows() "); + for (i = 0; i < screenInfo.numScreens; i++) { + if (screenInfo.screens[i] == NULL) continue; + pWin = WindowTable[i]; + if (pWin == NULL) continue; + + for (pWin = pWin->firstChild; pWin != NULL; pWin = pWin->nextSib) { + if (!pWin->realized) continue; + if (RootlessEnsureFrame(pWin) == NULL) continue; + RootlessReorderWindow (pWin); + } + } + RL_DEBUG_MSG("RootlessOrderAllWindows() done"); +} -- cgit v1.2.3