[Xquartz-changes] xserver: Branch 'server-1.11-apple' - 53 commits
Jeremy Huddleston
jeremyhu at freedesktop.org
Wed Apr 27 18:53:41 PDT 2011
Rebased ref, commits from common ancestor:
commit 606f961b9cde173459c4aee87163f1ecebcf0683
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Fri Apr 30 13:08:25 2010 -0700
Workaround the GC clipping problem in miPaintWindow and add some debugging output.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/mi/miexpose.c b/mi/miexpose.c
index 94258b8..4f25c23 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -521,6 +521,7 @@ void RootlessSetPixmapOfAncestors(WindowPtr pWin);
void RootlessStartDrawing(WindowPtr pWin);
void RootlessDamageRegion(WindowPtr pWin, RegionPtr prgn);
Bool IsFramedWindow(WindowPtr pWin);
+#include "../fb/fb.h"
#endif
void
@@ -548,24 +549,37 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
Bool solid = TRUE;
DrawablePtr drawable = &pWin->drawable;
+#ifdef XQUARTZ_CLIP_DEBUG
+ ErrorF("START %d BS %d (pR = %ld)\n", what, pWin->backgroundState, ParentRelative);
+ ErrorF(" Rgn: %d %d %d %d\n", prgn->extents.x1, prgn->extents.y1,
+ prgn->extents.x2 - prgn->extents.x1,
+ prgn->extents.y2 - prgn->extents.y1);
+ ErrorF(" Win: %d %d (%d %d) %d %d\n", pWin->origin.x, pWin->origin.y,
+ pWin->winSize.extents.x1, pWin->winSize.extents.y1,
+ pWin->winSize.extents.x2 - pWin->winSize.extents.x1,
+ pWin->winSize.extents.y2 - pWin->winSize.extents.y1);
+ ErrorF(" Draw: %d %d %d %d\n", pWin->drawable.x, pWin->drawable.y,
+ pWin->drawable.width, pWin->drawable.height);
+#endif
+
#ifdef ROOTLESS
if(!drawable || drawable->type == UNDRAWABLE_WINDOW)
return;
-
- if(IsFramedWindow(pWin)) {
- RootlessStartDrawing(pWin);
- RootlessDamageRegion(pWin, prgn);
-
- if(pWin->backgroundState == ParentRelative) {
- if((what == PW_BACKGROUND) ||
- (what == PW_BORDER && !pWin->borderIsPixel))
- RootlessSetPixmapOfAncestors(pWin);
- }
- }
#endif
if (what == PW_BACKGROUND)
{
+#ifdef ROOTLESS
+ if(IsFramedWindow(pWin)) {
+ RootlessStartDrawing(pWin);
+ RootlessDamageRegion(pWin, prgn);
+
+ if(pWin->backgroundState == ParentRelative) {
+ RootlessSetPixmapOfAncestors(pWin);
+ }
+ }
+#endif
+
while (pWin->backgroundState == ParentRelative)
pWin = pWin->parent;
@@ -587,6 +601,18 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
{
PixmapPtr pixmap;
+#ifdef ROOTLESS
+ if(IsFramedWindow(pWin)) {
+ RootlessStartDrawing(pWin);
+ RootlessDamageRegion(pWin, prgn);
+
+ if(!pWin->borderIsPixel &&
+ pWin->backgroundState == ParentRelative) {
+ RootlessSetPixmapOfAncestors(pWin);
+ }
+ }
+#endif
+
tile_x_off = drawable->x;
tile_y_off = drawable->y;
@@ -595,6 +621,12 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
return;
pixmap = (*pScreen->GetWindowPixmap) ((WindowPtr) drawable);
drawable = &pixmap->drawable;
+
+#ifdef XQUARTZ_CLIP_DEBUG
+ ErrorF(" Draw: %d %d %d %d\n",
+ drawable->x, drawable->y, drawable->width, drawable->height);
+#endif
+
#ifdef COMPOSITE
draw_x_off = pixmap->screen_x;
draw_y_off = pixmap->screen_y;
@@ -657,6 +689,57 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
ChangeGC (NullClient, pGC, gcmask, gcval);
ValidateGC (drawable, pGC);
+#ifdef XQUARTZ_CLIP_DEBUG
+ ErrorF(" GC: %d %d %d %d\n",
+ pGC->pCompositeClip->extents.x1, pGC->pCompositeClip->extents.y1,
+ pGC->pCompositeClip->extents.x2 - pGC->pCompositeClip->extents.x1,
+ pGC->pCompositeClip->extents.y2 - pGC->pCompositeClip->extents.y1);
+#endif
+
+#ifdef XQUARTZ
+ /* Looks like our clipping isn't set right for some reason:
+ * http://xquartz.macosforge.org/trac/ticket/290
+ */
+ if(what == PW_BORDER) {
+
+#if 0
+ if(solid) {
+#if 1
+ fbFillRegionSolid(&pWin->drawable,
+ prgn,
+ 0,
+ fbReplicatePixel(fill.pixel,
+ pWin->drawable.bitsPerPixel));
+#else
+ fbFillRegionSolid(drawable,
+ prgn,
+ 0,
+ fbReplicatePixel(fill.pixel,
+ drawable->bitsPerPixel));
+#endif
+ return;
+ }
+#endif
+
+ pGC->pCompositeClip->extents.x1 += prgn->extents.x1;
+ pGC->pCompositeClip->extents.y1 += prgn->extents.y1;
+ pGC->pCompositeClip->extents.x2 += prgn->extents.x1;
+ pGC->pCompositeClip->extents.y2 += prgn->extents.y1;
+
+ if(pGC->pCompositeClip->extents.x2 > drawable->pScreen->width)
+ pGC->pCompositeClip->extents.x2 = drawable->pScreen->width;
+ if(pGC->pCompositeClip->extents.y2 > drawable->pScreen->height)
+ pGC->pCompositeClip->extents.y2 = drawable->pScreen->height;
+ }
+#endif
+
+#ifdef XQUARTZ_CLIP_DEBUG
+ ErrorF(" GC: %d %d %d %d\n",
+ pGC->pCompositeClip->extents.x1, pGC->pCompositeClip->extents.y1,
+ pGC->pCompositeClip->extents.x2 - pGC->pCompositeClip->extents.x1,
+ pGC->pCompositeClip->extents.y2 - pGC->pCompositeClip->extents.y1);
+#endif
+
numRects = RegionNumRects(prgn);
pbox = RegionRects(prgn);
for (i= numRects; --i >= 0; pbox++, prect++)
commit 50557a21e10d226ff4254034145c2d59f4b47914
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sat Oct 30 14:55:06 2010 -0700
configure.ac: Add -fno-strict-aliasing to CFLAGS
This should address https://bugs.freedesktop.org/show_bug.cgi?id=31238
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/configure.ac b/configure.ac
index 6eb780c..6e970a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -86,6 +86,12 @@ XORG_PROG_RAWCPP
# easier overrides at build time.
XSERVER_CFLAGS='$(CWARNFLAGS)'
+dnl Explicitly add -fno-strict-aliasing since this option should disappear
+dnl from util-macros CWARNFLAGS
+if test "x$GCC" = xyes ; then
+ XSERVER_CFLAGS="$XSERVER_CFLAGS -fno-strict-aliasing"
+fi
+
dnl Check for dtrace program (needed to build Xserver dtrace probes)
dnl Also checks for <sys/sdt.h>, since some Linux distros have an
dnl ISDN trace program named dtrace
commit f6d4e75ec55ac6812f9dead42ecdffb9614578c7
Merge: ec9ea40... 4318e6a...
Author: Keith Packard <keithp at keithp.com>
Date: Wed Apr 27 12:08:51 2011 -0700
Merge remote-tracking branch 'jturney/master'
commit ec9ea4017885cefe5519a4e890b0ff1a5518235a
Merge: c6cb70b... 6f29dbf...
Author: Keith Packard <keithp at keithp.com>
Date: Wed Apr 27 12:01:56 2011 -0700
Merge remote-tracking branch 'jeremyhu/master'
commit 4318e6a147e78b2663c5e0ea6ba0d351a1e87f98
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date: Sat Mar 5 17:34:42 2011 +0000
Cygwin/X: Handle failure during winScreenInit()
Handle failure during winScreenInit() a bit more cleanly, rather than crashing
This avoids a crash with 'XWin -fullscreen -screen 0 @2 -screen 1 @1'
Also document that fullscreen may only be applied to one screen.
Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
Tested-by: Colin Harrison <colin.harrison at virgin.net>
diff --git a/hw/xwin/man/XWin.man b/hw/xwin/man/XWin.man
index e7933c9..aad29cf 100644
--- a/hw/xwin/man/XWin.man
+++ b/hw/xwin/man/XWin.man
@@ -67,7 +67,7 @@ The default behaviour is to create a single screen 0 that is roughly the
size of useful area of the primary monitor (allowing for any window
decorations and the task-bar).
-Screen specific parameters, such as \fB\-fullscreen\fP, can be applied as a
+Screen specific parameters can be applied as a
default to all screens by placing those screen specific parameters
before any \fB\-screen\fP parameter. Screen specific parameters placed after
the first \fB\-screen\fP parameter will apply only to the immediately
@@ -108,6 +108,7 @@ in \fB-multiwindow\fP or \fB-rootless\fP mode.
.B "\-fullscreen"
The X server window takes the full screen, covering completely the
\fIWindows\fP desktop.
+Currently \fB\-fullscreen\fP may only be applied to one X screen.
.TP 8
.B \-nodecoration
Do not give the Cygwin/X window a \fIWindows\fP window border, title bar,
diff --git a/hw/xwin/winpfbdd.c b/hw/xwin/winpfbdd.c
index c0bca71..a399020 100644
--- a/hw/xwin/winpfbdd.c
+++ b/hw/xwin/winpfbdd.c
@@ -294,7 +294,8 @@ winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen)
/* Call the wrapped CloseScreen procedure */
WIN_UNWRAP(CloseScreen);
- fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
+ if (pScreen->CloseScreen)
+ fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
/* Delete the window property */
RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP);
diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c
index 691237e..983ff57 100644
--- a/hw/xwin/winscrinit.c
+++ b/hw/xwin/winscrinit.c
@@ -220,6 +220,10 @@ winScreenInit (int index,
if (!((*pScreenPriv->pwinFinishScreenInit) (index, pScreen, argc, argv)))
{
ErrorF ("winScreenInit - winFinishScreenInit () failed\n");
+
+ /* call the engine dependent screen close procedure to clean up from a failure */
+ pScreenPriv->pwinCloseScreen(index, pScreen);
+
return FALSE;
}
diff --git a/hw/xwin/winshaddd.c b/hw/xwin/winshaddd.c
index 00d7a37..6dad278 100644
--- a/hw/xwin/winshaddd.c
+++ b/hw/xwin/winshaddd.c
@@ -728,7 +728,8 @@ winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen)
/* Call the wrapped CloseScreen procedure */
WIN_UNWRAP(CloseScreen);
- fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
+ if (pScreen->CloseScreen)
+ fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
winFreeFBShadowDD(pScreen);
diff --git a/hw/xwin/winshadddnl.c b/hw/xwin/winshadddnl.c
index 0a0b4ae..63d48ad 100644
--- a/hw/xwin/winshadddnl.c
+++ b/hw/xwin/winshadddnl.c
@@ -802,7 +802,8 @@ winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen)
/* Call the wrapped CloseScreen procedure */
WIN_UNWRAP(CloseScreen);
- fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
+ if (pScreen->CloseScreen)
+ fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
winFreeFBShadowDDNL(pScreen);
diff --git a/hw/xwin/winshadgdi.c b/hw/xwin/winshadgdi.c
index 4990376..1e7cb00 100644
--- a/hw/xwin/winshadgdi.c
+++ b/hw/xwin/winshadgdi.c
@@ -636,7 +636,8 @@ winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen)
/* Call the wrapped CloseScreen procedure */
WIN_UNWRAP(CloseScreen);
- fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
+ if (pScreen->CloseScreen)
+ fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
/* Delete the window property */
RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP);
commit ce6136f8c553bbc6d3e3affa0faa2afbf8054f44
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date: Tue Mar 23 20:06:33 2010 +0000
Cygwin/X: Make winOverrrideStyle() thread-safe
Make winOverrrideStyle() thread-safe
winOverrideStyle() is called from the internal WM client thread.
Accessing server-internal data structures to get window name and
class is not safe, as there is no lock to ensure we do not collide
with these data structures being updated in the server thread.
Rewrite so the internal client thread uses X client calls to
obtain this data safely
Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
Tested-by: Colin Harrison <colin.harrison at virgin.net>
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index ef0c7cf..67a58a0 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -1576,7 +1576,6 @@ winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle)
Atom type, *pAtom = NULL;
int format;
unsigned long hint = 0, maxmin = 0, style, nitems = 0 , left = 0;
- WindowPtr pWin = GetProp (hWnd, WIN_WINDOW_PROP);
MwmHints *mwm_hint = NULL;
if (!hWnd) return;
@@ -1669,7 +1668,26 @@ winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle)
}
/* Override hint settings from above with settings from config file */
- style = winOverrideStyle((unsigned long)pWin);
+ {
+ XClassHint class_hint = {0,0};
+ char *window_name = 0;
+
+ if (XGetClassHint(pDisplay, iWindow, &class_hint))
+ {
+ XFetchName(pDisplay, iWindow, &window_name);
+
+ style = winOverrideStyle(class_hint.res_name, class_hint.res_class, window_name);
+
+ if (class_hint.res_name) XFree(class_hint.res_name);
+ if (class_hint.res_class) XFree(class_hint.res_class);
+ if (window_name) XFree(window_name);
+ }
+ else
+ {
+ style = STYLE_NONE;
+ }
+ }
+
if (style & STYLE_TOPMOST) *zstyle = HWND_TOPMOST;
else if (style & STYLE_MAXIMIZE) maxmin = (hint & ~HINT_MIN) | HINT_MAX;
else if (style & STYLE_MINIMIZE) maxmin = (hint & ~HINT_MAX) | HINT_MIN;
diff --git a/hw/xwin/winprefs.c b/hw/xwin/winprefs.c
index 4ccb4ff..d941c51 100644
--- a/hw/xwin/winprefs.c
+++ b/hw/xwin/winprefs.c
@@ -813,40 +813,20 @@ LoadPreferences (void)
* STYLES{} section in the prefs file, and return the style type
*/
unsigned long
-winOverrideStyle (unsigned long longpWin)
+winOverrideStyle (char *res_name, char *res_class, char *wmName)
{
- WindowPtr pWin = (WindowPtr) longpWin;
- char *res_name, *res_class;
int i;
- char *wmName;
-
- if (pWin==NULL)
- return STYLE_NONE;
-
- /* If we can't find the class, we can't override from default! */
- if (!winMultiWindowGetClassHint (pWin, &res_name, &res_class))
- return STYLE_NONE;
-
- winMultiWindowGetWMName (pWin, &wmName);
for (i=0; i<pref.styleItems; i++) {
- if (!strcmp(pref.style[i].match, res_name) ||
- !strcmp(pref.style[i].match, res_class) ||
+ if ((res_name && !strcmp(pref.style[i].match, res_name)) ||
+ (res_class && !strcmp(pref.style[i].match, res_class)) ||
(wmName && strstr(wmName, pref.style[i].match)))
{
- free (res_name);
- free (res_class);
- free(wmName);
-
if (pref.style[i].type)
return pref.style[i].type;
}
}
/* Didn't find the style, fail gracefully */
- free (res_name);
- free (res_class);
- free(wmName);
-
return STYLE_NONE;
}
diff --git a/hw/xwin/winprefs.h b/hw/xwin/winprefs.h
index 33b496d..ecd0a3f 100644
--- a/hw/xwin/winprefs.h
+++ b/hw/xwin/winprefs.h
@@ -180,7 +180,7 @@ HICON
winOverrideIcon (unsigned long longpWin);
unsigned long
-winOverrideStyle (unsigned long longpWin);
+winOverrideStyle (char *res_name, char *res_class, char *wmName);
HICON
winTaskbarIcon(void);
commit 0c603509eb7f9c83baf4e00b4558dce78f897ebf
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date: Fri Feb 11 13:15:40 2011 +0000
Cygwin/X: Cosmetic fixes to logging of result from X*TextPropertyToTextList()
Report XLocaleNotSupported result from X*TextPropertyToTextList()
Fix formatting for unknown results reported for X*TextPropertyToTextList()
Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
Tested-by: Colin Harrison <colin.harrison at virgin.net>
diff --git a/hw/xwin/winclipboardxevents.c b/hw/xwin/winclipboardxevents.c
index 8b502b1..b0006a0 100644
--- a/hw/xwin/winclipboardxevents.c
+++ b/hw/xwin/winclipboardxevents.c
@@ -636,11 +636,14 @@ winClipboardFlushXEvents (HWND hwnd,
case XNoMemory:
ErrorF ("XNoMemory\n");
break;
+ case XLocaleNotSupported:
+ ErrorF ("XLocaleNotSupported\n");
+ break;
case XConverterNotFound:
ErrorF ("XConverterNotFound\n");
break;
default:
- ErrorF ("%d", iReturn);
+ ErrorF ("%d\n", iReturn);
break;
}
pszReturnData = malloc (1);
commit 71550a8665d861384332d81239ca0c1586a17137
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date: Fri Jan 28 20:17:22 2011 +0000
Cygwin/X: Decorate function pointers retrieved via GetProcAddress with WINAPI
Decorate function pointers retrieved via GetProcAddress which are currently
missing it with WINAPI, to ensure stdcall convention is used when calling them.
This fixes a crash currently seen when compiled -O2 and the -screen option uses
a size and monitor number e.g. -screen 0 1280x1000 at 2
Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
Tested-by: Colin Harrison <colin.harrison at virgin.net>
diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index 7faed01..22ef8da 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -49,7 +49,7 @@ from The Open Group.
#endif
#ifdef RELOCATE_PROJECTROOT
#include <shlobj.h>
-typedef HRESULT (*SHGETFOLDERPATHPROC)(
+typedef WINAPI HRESULT (*SHGETFOLDERPATHPROC)(
HWND hwndOwner,
int nFolder,
HANDLE hToken,
diff --git a/hw/xwin/winmonitors.c b/hw/xwin/winmonitors.c
index 63af803..a9d46f9 100644
--- a/hw/xwin/winmonitors.c
+++ b/hw/xwin/winmonitors.c
@@ -53,7 +53,7 @@ wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _d
return TRUE;
}
-typedef wBOOL (*ENUMDISPLAYMONITORSPROC)(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
+typedef WINAPI wBOOL (*ENUMDISPLAYMONITORSPROC)(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
ENUMDISPLAYMONITORSPROC _EnumDisplayMonitors;
wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data);
commit 38a1f5c613a48ef9fd6ba043bc3028f487750d3a
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date: Tue Oct 12 17:12:02 2010 +0100
Cygwin/X: Don't make InputOnly windows visible
Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
Tested-by: Colin Harrison <colin.harrison at virgin.net>
diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c
index 61305e1..21b818b 100644
--- a/hw/xwin/winmultiwindowwindow.c
+++ b/hw/xwin/winmultiwindowwindow.c
@@ -506,12 +506,16 @@ winCreateWindowsWindow (WindowPtr pWin)
iWidth = pWin->drawable.width;
iHeight = pWin->drawable.height;
- /* ensure window actually ends up somewhere visible */
- if (iX > GetSystemMetrics (SM_CXVIRTUALSCREEN))
- iX = CW_USEDEFAULT;
+ /* If it's an InputOutput window, and so is going to end up being made visible,
+ make sure the window actually ends up somewhere where it will be visible */
+ if (pWin->drawable.class != InputOnly)
+ {
+ if ((iX < GetSystemMetrics (SM_XVIRTUALSCREEN)) || (iX > GetSystemMetrics (SM_CXVIRTUALSCREEN)))
+ iX = CW_USEDEFAULT;
- if (iY > GetSystemMetrics (SM_CYVIRTUALSCREEN))
- iY = CW_USEDEFAULT;
+ if ((iY < GetSystemMetrics (SM_YVIRTUALSCREEN)) || (iY > GetSystemMetrics (SM_CYVIRTUALSCREEN)))
+ iY = CW_USEDEFAULT;
+ }
if (winMultiWindowGetTransientFor (pWin, &pDaddy))
{
@@ -666,7 +670,8 @@ winUpdateWindowsWindow (WindowPtr pWin)
}
/* Display the window without activating it */
- ShowWindow (pWinPriv->hWnd, SW_SHOWNOACTIVATE);
+ if (pWin->drawable.class != InputOnly)
+ ShowWindow (pWinPriv->hWnd, SW_SHOWNOACTIVATE);
/* Send first paint message */
UpdateWindow (pWinPriv->hWnd);
commit bd288c3458bc1ba2cbb4c8416e5b2dfd849581e6
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date: Thu Jul 22 18:36:51 2010 +0100
Cygwin/X: Fix a GDI bitmap resource leak of window icons
Ensure any icon created specially for a window is destroyed when
the window is destroyed
Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
Tested-by: Colin Harrison <colin.harrison at virgin.net>
diff --git a/hw/xwin/winmultiwindowicons.c b/hw/xwin/winmultiwindowicons.c
index 1ca3f91..44956e3 100644
--- a/hw/xwin/winmultiwindowicons.c
+++ b/hw/xwin/winmultiwindowicons.c
@@ -624,6 +624,7 @@ void winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon)
*pIcon = hIcon;
else
winDestroyIcon(hIcon);
+
if (pSmallIcon)
*pSmallIcon = hSmallIcon;
else
@@ -632,7 +633,7 @@ void winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon)
void winDestroyIcon(HICON hIcon)
{
- /* Delete the icon if its not the default */
+ /* Delete the icon if its not one of the application defaults or an override */
if (hIcon &&
hIcon != g_hIconX &&
hIcon != g_hSmallIconX &&
diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c
index 7efc360..61305e1 100644
--- a/hw/xwin/winmultiwindowwindow.c
+++ b/hw/xwin/winmultiwindowwindow.c
@@ -592,7 +592,9 @@ winDestroyWindowsWindow (WindowPtr pWin)
MSG msg;
winWindowPriv(pWin);
BOOL oldstate = winInDestroyWindowsWindow;
-
+ HICON hIcon;
+ HICON hIconSm;
+
#if CYGMULTIWINDOW_DEBUG
ErrorF ("winDestroyWindowsWindow\n");
#endif
@@ -603,13 +605,22 @@ winDestroyWindowsWindow (WindowPtr pWin)
winInDestroyWindowsWindow = TRUE;
+ /* Store the info we need to destroy after this window is gone */
+ hIcon = (HICON)SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_BIG, 0);
+ hIconSm = (HICON)SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_SMALL, 0);
+
SetProp (pWinPriv->hWnd, WIN_WINDOW_PROP, NULL);
+
/* Destroy the Windows window */
DestroyWindow (pWinPriv->hWnd);
/* Null our handle to the Window so referencing it will cause an error */
pWinPriv->hWnd = NULL;
+ /* Destroy any icons we created for this window */
+ winDestroyIcon(hIcon);
+ winDestroyIcon(hIconSm);
+
/* Process all messages on our queue */
while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
{
diff --git a/hw/xwin/winwin32rootless.c b/hw/xwin/winwin32rootless.c
index 75142f1..8f9917a 100644
--- a/hw/xwin/winwin32rootless.c
+++ b/hw/xwin/winwin32rootless.c
@@ -366,8 +366,8 @@ void
winMWExtWMDestroyFrame (RootlessFrameID wid)
{
win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
- HICON hiconClass;
- HICON hiconSmClass;
+ HICON hIcon;
+ HICON hIconSm;
HMODULE hInstance;
int iReturn;
char pszClass[CLASS_NAME_LENGTH];
@@ -398,8 +398,8 @@ winMWExtWMDestroyFrame (RootlessFrameID wid)
/* Store the info we need to destroy after this window is gone */
hInstance = (HINSTANCE) GetClassLongPtr (pRLWinPriv->hWnd, GCLP_HMODULE);
- hiconClass = (HICON) GetClassLongPtr (pRLWinPriv->hWnd, GCLP_HICON);
- hiconSmClass = (HICON) GetClassLongPtr (pRLWinPriv->hWnd, GCLP_HICONSM);
+ hIcon = (HICON)SendMessage(pRLWinPriv->hWnd, WM_GETICON, ICON_BIG, 0);
+ hIconSm = (HICON)SendMessage(pRLWinPriv->hWnd, WM_GETICON, ICON_SMALL, 0);
iReturn = GetClassName (pRLWinPriv->hWnd, pszClass, CLASS_NAME_LENGTH);
pRLWinPriv->fClose = TRUE;
@@ -415,14 +415,14 @@ winMWExtWMDestroyFrame (RootlessFrameID wid)
winDebug ("winMWExtWMDestroyFrame - Unregistering %s: ", pszClass);
#endif
iReturn = UnregisterClass (pszClass, hInstance);
-
+ }
+
#if CYGMULTIWINDOW_DEBUG
- winDebug ("winMWExtWMDestroyFramew - %d Deleting Icon: ", iReturn);
+ winDebug ("winMWExtWMDestroyFramew - Deleting Icon\n");
#endif
-
- winDestroyIcon(hiconClass);
- winDestroyIcon(hiconSmClass);
- }
+
+ winDestroyIcon(hIcon);
+ winDestroyIcon(hIconSm);
#if CYGMULTIWINDOW_DEBUG
winDebug ("winMWExtWMDestroyFrame - done\n");
commit 19e764eee0c8b74d877fb2b1d6aedc933976660e
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date: Wed Jul 21 18:11:13 2010 +0100
Cygwin/X: Internal WM workaround for Java AWT bug
Java applications using AWT on JRE 1.6.0 break with non-reparenting WMs AWT
doesn't explicitly know about (See sun bug #6434227)
XDecoratedPeer.handleConfigureNotifyEvent() only processes non-synthetic
ConfigureNotify events to update window location if it's identified the
WM as a non-reparenting WM it knows about (compiz or lookingglass)
Rather than tell all sorts of lies to get XWM to recognize us as one of
those, simply send a synthetic ConfigureNotify for every non-synthetic one
Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
Tested-by: Colin Harrison <colin.harrison at virgin.net>
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index c9b1584..ef0c7cf 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -1114,6 +1114,30 @@ winMultiWindowXMsgProc (void *pArg)
}
}
}
+ else if (event.type == ConfigureNotify)
+ {
+ if (!event.xconfigure.send_event)
+ {
+ /*
+ Java applications using AWT on JRE 1.6.0 break with non-reparenting WMs AWT
+ doesn't explicitly know about (See sun bug #6434227)
+
+ XDecoratedPeer.handleConfigureNotifyEvent() only processes non-synthetic
+ ConfigureNotify events to update window location if it's identified the
+ WM as a non-reparenting WM it knows about (compiz or lookingglass)
+
+ Rather than tell all sorts of lies to get XWM to recognize us as one of
+ those, simply send a synthetic ConfigureNotify for every non-synthetic one
+ */
+ XEvent event_send = event;
+ event_send.xconfigure.send_event = TRUE;
+ event_send.xconfigure.event = event.xconfigure.window;
+ XSendEvent(event.xconfigure.display,
+ event.xconfigure.window,
+ True, StructureNotifyMask,
+ &event_send);
+ }
+ }
else if (event.type == PropertyNotify
&& event.xproperty.atom == atmWmName)
{
commit 6f29dbf5e36bef5ecb08f02d367988dee0f9f1cd
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Mon Apr 25 22:00:41 2011 -0700
XQuartz: Use ErrorF rather than fprintf to log errors
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/GL/capabilities.c b/hw/xquartz/GL/capabilities.c
index fc7dd57..dd3f855 100644
--- a/hw/xquartz/GL/capabilities.c
+++ b/hw/xquartz/GL/capabilities.c
@@ -507,7 +507,7 @@ bool getGlCapabilities(struct glCapabilities *cap) {
err = CGLQueryRendererInfo((GLuint)-1, &info, &numRenderers);
if(err) {
- fprintf(stderr, "CGLQueryRendererInfo error: %s\n", CGLErrorString(err));
+ ErrorF("CGLQueryRendererInfo error: %s\n", CGLErrorString(err));
return err;
}
@@ -518,8 +518,8 @@ bool getGlCapabilities(struct glCapabilities *cap) {
err = handleRendererDescriptions(info, r, &tmpconf);
if(err) {
- fprintf(stderr, "handleRendererDescriptions returned error: %s\n", CGLErrorString(err));
- fprintf(stderr, "trying to continue...\n");
+ ErrorF("handleRendererDescriptions returned error: %s\n", CGLErrorString(err));
+ ErrorF("trying to continue...\n");
continue;
}
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 2a45cc5..283132e 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -978,7 +978,7 @@ static inline pthread_t create_thread(void *(*func)(void *), void *arg) {
static void *xpbproxy_x_thread(void *args) {
xpbproxy_run();
- fprintf(stderr, "xpbproxy thread is terminating unexpectedly.\n");
+ ErrorF("xpbproxy thread is terminating unexpectedly.\n");
return NULL;
}
@@ -1021,15 +1021,15 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
last_key_layout = TISCopyCurrentKeyboardLayoutInputSource();
if(!last_key_layout)
- fprintf(stderr, "X11ApplicationMain: Unable to determine TISCopyCurrentKeyboardLayoutInputSource() at startup.\n");
+ ErrorF("X11ApplicationMain: Unable to determine TISCopyCurrentKeyboardLayoutInputSource() at startup.\n");
#else
KLGetCurrentKeyboardLayout(&last_key_layout);
if(!last_key_layout)
- fprintf(stderr, "X11ApplicationMain: Unable to determine KLGetCurrentKeyboardLayout() at startup.\n");
+ ErrorF("X11ApplicationMain: Unable to determine KLGetCurrentKeyboardLayout() at startup.\n");
#endif
if (!QuartsResyncKeymap(FALSE)) {
- fprintf(stderr, "X11ApplicationMain: Could not build a valid keymap.\n");
+ ErrorF("X11ApplicationMain: Could not build a valid keymap.\n");
}
/* Tell the server thread that it can proceed */
@@ -1370,7 +1370,7 @@ static const char *untrusted_str(NSEvent *e) {
#endif
/* Update keyInfo */
if (!QuartsResyncKeymap(TRUE)) {
- fprintf(stderr, "sendX11NSEvent: Could not build a valid keymap.\n");
+ ErrorF("sendX11NSEvent: Could not build a valid keymap.\n");
}
}
}
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 2e18a74..50234f2 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -136,9 +136,9 @@ const int NUMFORMATS = sizeof(formats)/sizeof(formats[0]);
void
DarwinPrintBanner(void)
{
- // this should change depending on which specific server we are building
ErrorF("Xquartz starting:\n");
- ErrorF("X.Org X Server %s\nBuild Date: %s\n", XSERVER_VERSION, BUILD_DATE );
+ ErrorF("X.Org X Server %s\n", XSERVER_VERSION);
+ ErrorF("Build Date: %s\n", BUILD_DATE );
}
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index bde259e..846025b 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -64,6 +64,9 @@
/* From darwinEvents.c ... but don't want to pull in all the server cruft */
void DarwinListenOnOpenFD(int fd);
+/* Ditto, from os/log.c */
+extern void ErrorF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
+
extern int noPanoramiXExtension;
#define DEFAULT_CLIENT X11BINDIR "/xterm"
@@ -134,13 +137,13 @@ static mach_port_t checkin_or_register(char *bname) {
/* We probably were not started by launchd or the old mach_init */
kr = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &mp);
if (kr != KERN_SUCCESS) {
- fprintf(stderr, "mach_port_allocate(): %s\n", mach_error_string(kr));
+ ErrorF("mach_port_allocate(): %s\n", mach_error_string(kr));
exit(EXIT_FAILURE);
}
kr = mach_port_insert_right(mach_task_self(), mp, mp, MACH_MSG_TYPE_MAKE_SEND);
if (kr != KERN_SUCCESS) {
- fprintf(stderr, "mach_port_insert_right(): %s\n", mach_error_string(kr));
+ ErrorF("mach_port_insert_right(): %s\n", mach_error_string(kr));
exit(EXIT_FAILURE);
}
@@ -154,7 +157,7 @@ static mach_port_t checkin_or_register(char *bname) {
#endif
if (kr != KERN_SUCCESS) {
- fprintf(stderr, "bootstrap_register(): %s\n", mach_error_string(kr));
+ ErrorF("bootstrap_register(): %s\n", mach_error_string(kr));
exit(EXIT_FAILURE);
}
@@ -197,7 +200,7 @@ static int accept_fd_handoff(int connected_fd) {
*((int*)CMSG_DATA(cmsg)) = -1;
if(recvmsg(connected_fd, &msg, 0) < 0) {
- fprintf(stderr, "X11.app: Error receiving $DISPLAY file descriptor. recvmsg() error: %s\n", strerror(errno));
+ ErrorF("X11.app: Error receiving $DISPLAY file descriptor. recvmsg() error: %s\n", strerror(errno));
return -1;
}
@@ -230,14 +233,14 @@ static void *socket_handoff_thread(void *arg) {
while(launchd_fd == -1) {
connected_fd = accept(handoff_data->fd, NULL, NULL);
if(connected_fd == -1) {
- fprintf(stderr, "X11.app: Failed to accept incoming connection on socket (fd=%d): %s\n", handoff_data->fd, strerror(errno));
+ ErrorF("X11.app: Failed to accept incoming connection on socket (fd=%d): %s\n", handoff_data->fd, strerror(errno));
sleep(2);
continue;
}
launchd_fd = accept_fd_handoff(connected_fd);
if(launchd_fd == -1)
- fprintf(stderr, "X11.app: Error receiving $DISPLAY file descriptor, no descriptor received? Waiting for another connection.\n");
+ ErrorF("X11.app: Error receiving $DISPLAY file descriptor, no descriptor received? Waiting for another connection.\n");
close(connected_fd);
}
@@ -246,7 +249,7 @@ static void *socket_handoff_thread(void *arg) {
unlink(handoff_data->filename);
free(handoff_data);
- fprintf(stderr, "X11.app Handing off fd to server thread via DarwinListenOnOpenFD(%d)\n", launchd_fd);
+ ErrorF("X11.app Handing off fd to server thread via DarwinListenOnOpenFD(%d)\n", launchd_fd);
DarwinListenOnOpenFD(launchd_fd);
#ifndef HAVE_LIBDISPATCH
@@ -274,24 +277,24 @@ static int create_socket(char *filename_out) {
ret_fd = socket(PF_UNIX, SOCK_STREAM, 0);
if(ret_fd == -1) {
- fprintf(stderr, "X11.app: Failed to create socket (try %d / %d): %s - %s\n", (int)try+1, (int)try_max, filename_out, strerror(errno));
+ ErrorF("X11.app: Failed to create socket (try %d / %d): %s - %s\n", (int)try+1, (int)try_max, filename_out, strerror(errno));
continue;
}
if(bind(ret_fd, servaddr, servaddr_len) != 0) {
- fprintf(stderr, "X11.app: Failed to bind socket: %d - %s\n", errno, strerror(errno));
+ ErrorF("X11.app: Failed to bind socket: %d - %s\n", errno, strerror(errno));
close(ret_fd);
return 0;
}
if(listen(ret_fd, 10) != 0) {
- fprintf(stderr, "X11.app: Failed to listen to socket: %s - %d - %s\n", filename_out, errno, strerror(errno));
+ ErrorF("X11.app: Failed to listen to socket: %s - %d - %s\n", filename_out, errno, strerror(errno));
close(ret_fd);
return 0;
}
#ifdef DEBUG
- fprintf(stderr, "X11.app: Listening on socket for fd handoff: (%d) %s\n", ret_fd, filename_out);
+ ErrorF("X11.app: Listening on socket for fd handoff: (%d) %s\n", ret_fd, filename_out);
#endif
return ret_fd;
@@ -309,7 +312,7 @@ kern_return_t do_request_fd_handoff_socket(mach_port_t port, string_t filename)
handoff_data = (socket_handoff_t *)calloc(1,sizeof(socket_handoff_t));
if(!handoff_data) {
- fprintf(stderr, "X11.app: Error allocating memory for handoff_data\n");
+ ErrorF("X11.app: Error allocating memory for handoff_data\n");
return KERN_FAILURE;
}
@@ -330,7 +333,7 @@ kern_return_t do_request_fd_handoff_socket(mach_port_t port, string_t filename)
#endif
#ifdef DEBUG
- fprintf(stderr, "X11.app: Thread created for handoff. Returning success to tell caller to connect and push the fd.\n");
+ ErrorF("X11.app: Thread created for handoff. Returning success to tell caller to connect and push the fd.\n");
#endif
return KERN_SUCCESS;
@@ -355,7 +358,7 @@ kern_return_t do_start_x11_server(mach_port_t port, string_array_t argv,
* unset DISPLAY or we can run into problems with pbproxy
*/
if(!launchd_socket_handed_off) {
- fprintf(stderr, "X11.app: No launchd socket handed off, unsetting DISPLAY\n");
+ ErrorF("X11.app: No launchd socket handed off, unsetting DISPLAY\n");
unsetenv("DISPLAY");
}
@@ -363,10 +366,10 @@ kern_return_t do_start_x11_server(mach_port_t port, string_array_t argv,
return KERN_FAILURE;
}
- fprintf(stderr, "X11.app: do_start_x11_server(): argc=%d\n", argvCnt);
+ ErrorF("X11.app: do_start_x11_server(): argc=%d\n", argvCnt);
for(i=0; i < argvCnt; i++) {
_argv[i] = argv[i];
- fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]);
+ ErrorF("\targv[%u] = %s\n", (unsigned)i, argv[i]);
}
_argv[argvCnt] = NULL;
@@ -404,7 +407,7 @@ static int startup_trigger(int argc, char **argv, char **envp) {
newenvp = (string_array_t)alloca(envpc * sizeof(string_t));
if(!newargv || !newenvp) {
- fprintf(stderr, "Memory allocation failure\n");
+ ErrorF("Memory allocation failure\n");
exit(EXIT_FAILURE);
}
@@ -418,16 +421,16 @@ static int startup_trigger(int argc, char **argv, char **envp) {
kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp);
if (kr != KERN_SUCCESS) {
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
- fprintf(stderr, "bootstrap_look_up(%s): %s\n", server_bootstrap_name, bootstrap_strerror(kr));
+ ErrorF("bootstrap_look_up(%s): %s\n", server_bootstrap_name, bootstrap_strerror(kr));
#else
- fprintf(stderr, "bootstrap_look_up(%s): %ul\n", server_bootstrap_name, (unsigned long)kr);
+ ErrorF("bootstrap_look_up(%s): %ul\n", server_bootstrap_name, (unsigned long)kr);
#endif
exit(EXIT_FAILURE);
}
kr = start_x11_server(mp, newargv, argc, newenvp, envpc);
if (kr != KERN_SUCCESS) {
- fprintf(stderr, "start_x11_server: %s\n", mach_error_string(kr));
+ ErrorF("start_x11_server: %s\n", mach_error_string(kr));
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
@@ -449,10 +452,10 @@ static int startup_trigger(int argc, char **argv, char **envp) {
/* Start the server */
if((s = getenv("DISPLAY"))) {
- fprintf(stderr, "X11.app: Could not connect to server (DISPLAY=\"%s\", unsetting). Starting X server.\n", s);
+ ErrorF("X11.app: Could not connect to server (DISPLAY=\"%s\", unsetting). Starting X server.\n", s);
unsetenv("DISPLAY");
} else {
- fprintf(stderr, "X11.app: Could not connect to server (DISPLAY is not set). Starting X server.\n");
+ ErrorF("X11.app: Could not connect to server (DISPLAY is not set). Starting X server.\n");
}
return execute(command_from_prefs("startx_script", DEFAULT_STARTX));
}
@@ -496,7 +499,7 @@ static void setup_env(void) {
server_bootstrap_name = strdup(pds);
if(!server_bootstrap_name) {
- fprintf(stderr, "X11.app: Memory allocation error.\n");
+ ErrorF("X11.app: Memory allocation error.\n");
exit(1);
}
setenv("X11_PREFS_DOMAIN", server_bootstrap_name, 1);
@@ -504,7 +507,7 @@ static void setup_env(void) {
len = strlen(server_bootstrap_name);
bundle_id_prefix = malloc(sizeof(char) * (len - 3));
if(!bundle_id_prefix) {
- fprintf(stderr, "X11.app: Memory allocation error.\n");
+ ErrorF("X11.app: Memory allocation error.\n");
exit(1);
}
strlcpy(bundle_id_prefix, server_bootstrap_name, len - 3);
@@ -520,11 +523,11 @@ static void setup_env(void) {
if(s && *s) {
if(strcmp(bundle_id_prefix, "org.x") == 0 && strcmp(s, ":0") == 0) {
- fprintf(stderr, "X11.app: Detected old style launchd DISPLAY, please update xinit.\n");
+ ErrorF("X11.app: Detected old style launchd DISPLAY, please update xinit.\n");
} else {
temp = (char *)malloc(sizeof(char) * len);
if(!temp) {
- fprintf(stderr, "X11.app: Memory allocation error creating space for socket name test.\n");
+ ErrorF("X11.app: Memory allocation error creating space for socket name test.\n");
exit(1);
}
strlcpy(temp, bundle_id_prefix, len);
@@ -532,14 +535,14 @@ static void setup_env(void) {
if(strcmp(temp, s) != 0) {
/* If we don't have a match, unset it. */
- fprintf(stderr, "X11.app: DISPLAY (\"%s\") does not match our id (\"%s\"), unsetting.\n", disp, bundle_id_prefix);
+ ErrorF("X11.app: DISPLAY (\"%s\") does not match our id (\"%s\"), unsetting.\n", disp, bundle_id_prefix);
unsetenv("DISPLAY");
}
free(temp);
}
} else {
/* The DISPLAY environment variable is not formatted like a launchd socket, so reset. */
- fprintf(stderr, "X11.app: DISPLAY does not look like a launchd set variable, unsetting.\n");
+ ErrorF("X11.app: DISPLAY does not look like a launchd set variable, unsetting.\n");
unsetenv("DISPLAY");
}
}
@@ -570,9 +573,9 @@ int main(int argc, char **argv, char **envp) {
/* Setup the initial crasherporter info */
strlcpy(__crashreporter_info_buff__, __crashreporter_info__base, sizeof(__crashreporter_info_buff__));
- fprintf(stderr, "X11.app: main(): argc=%d\n", argc);
+ ErrorF("X11.app: main(): argc=%d\n", argc);
for(i=0; i < argc; i++) {
- fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]);
+ ErrorF("\targv[%u] = %s\n", (unsigned)i, argv[i]);
if(!strcmp(argv[i], "--listenonly")) {
listenOnly = TRUE;
}
@@ -580,7 +583,7 @@ int main(int argc, char **argv, char **envp) {
mp = checkin_or_register(server_bootstrap_name);
if(mp == MACH_PORT_NULL) {
- fprintf(stderr, "NULL mach service: %s", server_bootstrap_name);
+ ErrorF("NULL mach service: %s", server_bootstrap_name);
return EXIT_FAILURE;
}
@@ -629,10 +632,10 @@ int main(int argc, char **argv, char **envp) {
}
/* Main event loop */
- fprintf(stderr, "Waiting for startup parameters via Mach IPC.\n");
+ ErrorF("Waiting for startup parameters via Mach IPC.\n");
kr = mach_msg_server(mach_startup_server, mxmsgsz, mp, 0);
if (kr != KERN_SUCCESS) {
- fprintf(stderr, "%s.X11(mp): %s\n", BUNDLE_ID_PREFIX, mach_error_string(kr));
+ ErrorF("%s.X11(mp): %s\n", BUNDLE_ID_PREFIX, mach_error_string(kr));
return EXIT_FAILURE;
}
@@ -648,9 +651,9 @@ static int execute(const char *command) {
newargv[2] = command;
newargv[3] = NULL;
- fprintf(stderr, "X11.app: Launching %s:\n", command);
+ ErrorF("X11.app: Launching %s:\n", command);
for(p=newargv; *p; p++) {
- fprintf(stderr, "\targv[%ld] = %s\n", (long int)(p - newargv), *p);
+ ErrorF("\targv[%ld] = %s\n", (long int)(p - newargv), *p);
}
execvp (newargv[0], (char * const *) newargv);
diff --git a/hw/xquartz/pbproxy/app-main.m b/hw/xquartz/pbproxy/app-main.m
index 245d1bc..9055bad 100644
--- a/hw/xquartz/pbproxy/app-main.m
+++ b/hw/xquartz/pbproxy/app-main.m
@@ -53,12 +53,22 @@ static void signal_handler (int sig) {
}
}
+void
+ErrorF(const char * f, ...)
+{
+ va_list args;
+
+ va_start(args, f);
+ vfprintf(stderr, f, args);
+ va_end(args);
+}
+
int main (int argc, const char *argv[]) {
const char *s;
int i;
#ifdef DEBUG
- printf("pid: %u\n", getpid());
+ ErrorF("pid: %u\n", getpid());
#endif
xpbproxy_is_standalone = YES;
@@ -70,13 +80,13 @@ int main (int argc, const char *argv[]) {
if(strcmp (argv[i], "--prefs-domain") == 0 && i+1 < argc) {
app_prefs_domain = argv[++i];
} else if (strcmp (argv[i], "--help") == 0) {
- printf("usage: xpbproxy OPTIONS\n"
+ ErrorF("usage: xpbproxy OPTIONS\n"
"Pasteboard proxying for X11.\n\n"
"--prefs-domain <domain> Change the domain used for reading preferences\n"
" (default: %s)\n", app_prefs_domain);
return 0;
} else {
- fprintf(stderr, "usage: xpbproxy OPTIONS...\n"
+ ErrorF("usage: xpbproxy OPTIONS...\n"
"Try 'xpbproxy --help' for more information.\n");
return 1;
}
diff --git a/hw/xquartz/pbproxy/main.m b/hw/xquartz/pbproxy/main.m
index bb06465..dbdb6d0 100644
--- a/hw/xquartz/pbproxy/main.m
+++ b/hw/xquartz/pbproxy/main.m
@@ -105,7 +105,7 @@ int xpbproxy_run (void) {
}
if (xpbproxy_dpy == NULL) {
- fprintf (stderr, "xpbproxy: can't open default display\n");
+ ErrorF("xpbproxy: can't open default display\n");
[pool release];
return EXIT_FAILURE;
}
@@ -115,7 +115,7 @@ int xpbproxy_run (void) {
if (!XAppleWMQueryExtension (xpbproxy_dpy, &xpbproxy_apple_wm_event_base,
&xpbproxy_apple_wm_error_base)) {
- fprintf (stderr, "xpbproxy: can't open AppleWM server extension\n");
+ ErrorF("xpbproxy: can't open AppleWM server extension\n");
[pool release];
return EXIT_FAILURE;
}
@@ -147,19 +147,3 @@ Time xpbproxy_current_timestamp (void) {
/* FIXME: may want to fetch a timestamp from the server.. */
return CurrentTime;
}
-
-void debug_printf (const char *fmt, ...) {
- static int spew = -1;
-
- if (spew == -1) {
- char *x = getenv ("DEBUG");
- spew = (x != NULL && atoi (x) != 0);
- }
-
- if (spew) {
- va_list args;
- va_start(args, fmt);
- vfprintf (stderr, fmt, args);
- va_end(args);
- }
-}
diff --git a/hw/xquartz/pbproxy/pbproxy.h b/hw/xquartz/pbproxy/pbproxy.h
index 013f981..fcbf4c4 100644
--- a/hw/xquartz/pbproxy/pbproxy.h
+++ b/hw/xquartz/pbproxy/pbproxy.h
@@ -77,14 +77,16 @@ extern BOOL xpbproxy_have_xfixes;
/* from x-input.m */
extern BOOL xpbproxy_input_register (void);
+/* os/log.c or app-main.m */
+extern void ErrorF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
+
#ifdef DEBUG
/* BEWARE: this can cause a string memory leak, according to the leaks program. */
-# define DB(msg, args...) debug_printf("%s:%s:%d " msg, __FILE__, __FUNCTION__, __LINE__, ##args)
+# define DebugF(msg, args...) ErrorF("%s:%s:%d " msg, __FILE__, __FUNCTION__, __LINE__, ##args)
#else
-# define DB(msg, args...) do {} while (0)
+# define DebugF(...) /* */
#endif
-#define TRACE() DB("TRACE\n")
-extern void debug_printf (const char *fmt, ...);
+#define TRACE() DebugF("TRACE\n")
#endif /* PBPROXY_H */
diff --git a/hw/xquartz/pbproxy/x-input.m b/hw/xquartz/pbproxy/x-input.m
index 405ba3c..ebb8998 100644
--- a/hw/xquartz/pbproxy/x-input.m
+++ b/hw/xquartz/pbproxy/x-input.m
@@ -87,7 +87,7 @@ static void xpbproxy_process_xevents(void) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
if(pool == nil) {
- fprintf(stderr, "unable to allocate/init auto release pool!\n");
+ ErrorF("unable to allocate/init auto release pool!\n");
return;
}
diff --git a/hw/xquartz/pbproxy/x-selection.m b/hw/xquartz/pbproxy/x-selection.m
index 99cc543..7964f51 100644
--- a/hw/xquartz/pbproxy/x-selection.m
+++ b/hw/xquartz/pbproxy/x-selection.m
@@ -81,19 +81,19 @@ static struct propdata null_propdata = {NULL, 0, 0};
#ifdef DEBUG
static void
-dump_prefs (FILE *fp) {
- fprintf(fp,
- "pbproxy preferences:\n"
- "\tactive %u\n"
- "\tprimary_on_grab %u\n"
- "\tclipboard_to_pasteboard %u\n"
- "\tpasteboard_to_primary %u\n"
- "\tpasteboard_to_clipboard %u\n",
- pbproxy_prefs.active,
- pbproxy_prefs.primary_on_grab,
- pbproxy_prefs.clipboard_to_pasteboard,
- pbproxy_prefs.pasteboard_to_primary,
- pbproxy_prefs.pasteboard_to_clipboard);
+dump_prefs() {
+ ErrorF(fp,
+ "pbproxy preferences:\n"
+ "\tactive %u\n"
+ "\tprimary_on_grab %u\n"
+ "\tclipboard_to_pasteboard %u\n"
+ "\tpasteboard_to_primary %u\n"
+ "\tpasteboard_to_clipboard %u\n",
+ pbproxy_prefs.active,
+ pbproxy_prefs.primary_on_grab,
+ pbproxy_prefs.clipboard_to_pasteboard,
+ pbproxy_prefs.pasteboard_to_primary,
+ pbproxy_prefs.pasteboard_to_clipboard);
}
#endif
@@ -152,7 +152,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
unsigned char *newbuf = NULL;
#ifdef TEST
- printf("bytesleft %lu\n", bytesleft);
+ ErrorF("bytesleft %lu\n", bytesleft);
#endif
if (Success != XGetWindowProperty (xpbproxy_dpy, win, property,
@@ -161,17 +161,17 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
type, &format, &numitems,
&bytesleft, &chunk))
{
- DB ("Error while getting window property.\n");
+ DebugF ("Error while getting window property.\n");
*pdata = null_propdata;
free (buf);
return True;
}
#ifdef TEST
- printf("format %d numitems %lu bytesleft %lu\n",
+ ErrorF("format %d numitems %lu bytesleft %lu\n",
format, numitems, bytesleft);
- printf("type %s\n", XGetAtomName (xpbproxy_dpy, *type));
+ ErrorF("type %s\n", XGetAtomName (xpbproxy_dpy, *type));
#endif
/* Format is the number of bits. */
@@ -183,7 +183,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
chunkbytesize = numitems * sizeof(long);
#ifdef TEST
- printf("chunkbytesize %zu\n", chunkbytesize);
+ ErrorF("chunkbytesize %zu\n", chunkbytesize);
#endif
newbuflen = buflen + chunkbytesize;
if (newbuflen > 0)
@@ -211,7 +211,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
}
#ifdef TEST
- printf("bytesleft %lu\n", bytesleft);
+ ErrorF("bytesleft %lu\n", bytesleft);
#endif
} while (bytesleft > 0);
@@ -236,7 +236,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
if (pdata->format != 32)
{
- fprintf(stderr, "Atom list is expected to be formatted as an array of 32bit values.\n");
+ ErrorF("Atom list is expected to be formatted as an array of 32bit values.\n");
return None;
}
@@ -265,7 +265,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
char *type = XGetAtomName(xpbproxy_dpy, a);
if (type)
{
- DB("Unhandled X11 mime type: %s", type);
+ DebugF("Unhandled X11 mime type: %s", type);
XFree(type);
}
}
@@ -378,7 +378,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
if (countNow != changeCount)
{
- DB ("changed pasteboard!\n");
+ DebugF ("changed pasteboard!\n");
changeCount = countNow;
if (pbproxy_prefs.pasteboard_to_primary)
@@ -462,9 +462,8 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
return TRUE;
if(owner != None) {
- fprintf (stderr, "A clipboard manager using window 0x%lx "
- "already owns the clipboard selection. "
- "pbproxy will not sync clipboard to pasteboard.\n", owner);
+ ErrorF("A clipboard manager using window 0x%lx already owns the clipboard selection. "
+ "pbproxy will not sync clipboard to pasteboard.\n", owner);
return FALSE;
}
@@ -491,7 +490,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
TRACE ();
- DB ("e->selection %s\n", XGetAtomName (xpbproxy_dpy, e->selection));
+ DebugF ("e->selection %s\n", XGetAtomName (xpbproxy_dpy, e->selection));
if(e->selection == atoms->clipboard) {
/*
@@ -508,7 +507,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
/* Another CLIPBOARD_MANAGER has set itself as owner. Disable syncing
* to avoid a race.
*/
- fprintf(stderr, "Another clipboard manager was started! "
+ ErrorF("Another clipboard manager was started! "
"xpbproxy is disabling syncing with clipboard.\n");
pbproxy_prefs.clipboard_to_pasteboard = NO;
}
@@ -533,7 +532,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
* The owner probably died or we are just starting up pbproxy.
* Set pbproxy's _selection_window as the owner, and continue.
*/
- DB ("No clipboard owner.\n");
+ DebugF ("No clipboard owner.\n");
[self copy_completed:atoms->clipboard];
return;
} else if (owner == _selection_window) {
@@ -541,7 +540,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
return;
}
- DB ("requesting targets\n");
+ DebugF ("requesting targets\n");
request_atom = atoms->targets;
XConvertSelection (xpbproxy_dpy, atoms->clipboard, atoms->targets,
@@ -581,7 +580,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
* We are supposed to use an empty event mask, and not propagate
* the event, according to the ICCCM.
*/
- DB ("reply->xselection.requestor 0x%lx\n", reply->xselection.requestor);
+ DebugF ("reply->xselection.requestor 0x%lx\n", reply->xselection.requestor);
XSendEvent (xpbproxy_dpy, reply->xselection.requestor, False, 0, reply);
XFlush (xpbproxy_dpy);
@@ -618,7 +617,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
if ([pbtypes containsObject:NSStringPboardType])
{
/* We have a string type that we can convert to UTF8, or Latin-1... */
- DB ("NSStringPboardType\n");
+ DebugF ("NSStringPboardType\n");
list[count] = atoms->utf8_string;
++count;
list[count] = atoms->string;
@@ -639,7 +638,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|| [pbtypes containsObject:NSTIFFPboardType])
{
/* We can convert a TIFF to a PNG or JPEG. */
- DB ("NSTIFFPboardType\n");
+ DebugF ("NSTIFFPboardType\n");
list[count] = atoms->image_png;
++count;
list[count] = atoms->image_jpeg;
@@ -684,7 +683,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
return;
}
- DB ("pbtypes retainCount after containsObject: %u\n", [pbtypes retainCount]);
+ DebugF ("pbtypes retainCount after containsObject: %u\n", [pbtypes retainCount]);
data = [pb stringForType:NSStringPboardType];
@@ -704,19 +703,19 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
length = strlen (bytes);
if (length < 50) {
- DB ("UTF-8: %s\n", bytes);
- DB ("UTF-8 length: %u\n", length);
+ DebugF ("UTF-8: %s\n", bytes);
+ DebugF ("UTF-8 length: %u\n", length);
}
}
else
{
- DB ("Latin-1\n");
+ DebugF ("Latin-1\n");
bytes = [data cStringUsingEncoding:NSISOLatin1StringEncoding];
/*WARNING: bytes is not NUL-terminated. */
length = [data lengthOfBytesUsingEncoding:NSISOLatin1StringEncoding];
}
- DB ("e->target %s\n", XGetAtomName (xpbproxy_dpy, e->target));
+ DebugF ("e->target %s\n", XGetAtomName (xpbproxy_dpy, e->target));
XChangeProperty (xpbproxy_dpy, e->requestor, e->property, e->target,
8, PropModeReplace, (unsigned char *) bytes, length);
@@ -758,7 +757,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
{
if (8 != textprop.format)
- DB ("textprop.format is unexpectedly not 8 - it's %d instead\n",
+ DebugF ("textprop.format is unexpectedly not 8 - it's %d instead\n",
textprop.format);
XChangeProperty (xpbproxy_dpy, e->requestor, e->property,
@@ -850,7 +849,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
if (nil == data)
{
[img autorelease];
- fprintf(stderr, "unable to convert PICT to TIFF!\n");
+ ErrorF("unable to convert PICT to TIFF!\n");
return YES;
}
@@ -926,7 +925,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
imagetype = NSJPEGFileType;
else
{
- fprintf(stderr, "internal failure in xpbproxy! imagetype being sent isn't PNG or JPEG.\n");
+ ErrorF("internal failure in xpbproxy! imagetype being sent isn't PNG or JPEG.\n");
}
pbtypes = [pb types];
@@ -997,7 +996,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
if (None != e->target)
- DB ("e->target %s\n", XGetAtomName (xpbproxy_dpy, e->target));
+ DebugF ("e->target %s\n", XGetAtomName (xpbproxy_dpy, e->target));
if (e->target == atoms->targets)
{
@@ -1049,15 +1048,15 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
[self release_pending];
if (None == e->property) {
- DB ("e->property is None.\n");
+ DebugF ("e->property is None.\n");
[self copy_completed:e->selection];
/* Nothing is selected. */
return;
}
#if 0
- printf ("e->selection %s\n", XGetAtomName (xpbproxy_dpy, e->selection));
- printf ("e->property %s\n", XGetAtomName (xpbproxy_dpy, e->property));
+ ErrorF("e->selection %s\n", XGetAtomName (xpbproxy_dpy, e->selection));
+ ErrorF("e->property %s\n", XGetAtomName (xpbproxy_dpy, e->property));
#endif
if ([self is_incr_type:e])
@@ -1066,7 +1065,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
* This is an INCR-style transfer, which means that we
* will get the data after a series of PropertyNotify events.
*/
- DB ("is INCR\n");
+ DebugF ("is INCR\n");
if (get_property (e->requestor, e->property, &pdata, /*Delete*/ True, &type))
{
@@ -1083,7 +1082,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
pending.requestor = e->requestor;
pending.selection = e->selection;
- DB ("set pending.requestor to 0x%lx\n", pending.requestor);
+ DebugF ("set pending.requestor to 0x%lx\n", pending.requestor);
}
else
{
@@ -1096,7 +1095,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
/* We have the complete selection data.*/
[self handle_selection:e->selection type:type propdata:&pdata];
- DB ("handled selection with the first notify_event\n");
+ DebugF ("handled selection with the first notify_event\n");
}
}
@@ -1116,7 +1115,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
if (name)
{
- DB ("e->atom %s\n", name);
+ DebugF ("e->atom %s\n", name);
XFree(name);
}
#endif
@@ -1124,7 +1123,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
if (None != pending.requestor && PropertyNewValue == e->state)
{
- DB ("pending.requestor 0x%lx\n", pending.requestor);
+ DebugF ("pending.requestor 0x%lx\n", pending.requestor);
if (get_property (e->window, e->atom, &pdata, /*Delete*/ True, &type))
{
@@ -1166,7 +1165,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
case XFixesSelectionWindowDestroyNotify:
case XFixesSelectionClientCloseNotify:
default:
- fprintf(stderr, "Unhandled XFixesSelectionNotifyEvent: subtype=%d\n", e->subtype);
+ ErrorF("Unhandled XFixesSelectionNotifyEvent: subtype=%d\n", e->subtype);
break;
}
}
@@ -1196,7 +1195,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
if (name)
{
- DB ("requesting %s\n", name);
+ DebugF ("requesting %s\n", name);
}
#endif
request_atom = preferred;
@@ -1220,11 +1219,11 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
if (nil == data)
{
- DB ("unable to create NSData object!\n");
+ DebugF ("unable to create NSData object!\n");
return;
}
- DB ("data retainCount before NSBitmapImageRep initWithData: %u\n",
+ DebugF ("data retainCount before NSBitmapImageRep initWithData: %u\n",
[data retainCount]);
bmimage = [[NSBitmapImageRep alloc] initWithData:data];
@@ -1232,11 +1231,11 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
if (nil == bmimage)
{
[data autorelease];
- DB ("unable to create NSBitmapImageRep!\n");
+ DebugF ("unable to create NSBitmapImageRep!\n");
return;
}
- DB ("data retainCount after NSBitmapImageRep initWithData: %u\n",
+ DebugF ("data retainCount after NSBitmapImageRep initWithData: %u\n",
[data retainCount]);
@try
@@ -1246,13 +1245,13 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
@catch (NSException *e)
{
- DB ("NSTIFFException!\n");
+ DebugF ("NSTIFFException!\n");
[data autorelease];
[bmimage autorelease];
return;
}
- DB ("bmimage retainCount after TIFFRepresentation %u\n", [bmimage retainCount]);
+ DebugF ("bmimage retainCount after TIFFRepresentation %u\n", [bmimage retainCount]);
pbtypes = [NSArray arrayWithObjects:NSTIFFPboardType, nil];
@@ -1266,12 +1265,12 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
[pb declareTypes:pbtypes owner:nil];
if (YES != [pb setData:tiff forType:NSTIFFPboardType])
{
- DB ("writing pasteboard data failed!\n");
+ DebugF ("writing pasteboard data failed!\n");
}
[data autorelease];
- DB ("bmimage retainCount before release %u\n", [bmimage retainCount]);
+ DebugF ("bmimage retainCount before release %u\n", [bmimage retainCount]);
[bmimage autorelease];
}
@@ -1299,10 +1298,10 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
[pb declareTypes:pbtypes owner:nil];
if (YES != [pb setString:string forType:NSStringPboardType]) {
- fprintf(stderr, "pasteboard setString:forType: failed!\n");
+ ErrorF("pasteboard setString:forType: failed!\n");
}
[string autorelease];
- DB ("done handling utf8 string\n");
+ DebugF ("done handling utf8 string\n");
}
/* This handles the STRING type, which should be in Latin-1. */
@@ -1328,7 +1327,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
[pb declareTypes:pbtypes owner:nil];
if (YES != [pb setString:string forType:NSStringPboardType]) {
- fprintf(stderr, "pasteboard setString:forType failed in handle_string!\n");
+ ErrorF("pasteboard setString:forType failed in handle_string!\n");
}
[string autorelease];
}
@@ -1394,7 +1393,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
name = XGetAtomName (xpbproxy_dpy, selection);
if (name)
{
- DB ("copy_completed: %s\n", name);
+ DebugF ("copy_completed: %s\n", name);
XFree (name);
}
#endif
@@ -1455,10 +1454,10 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
pbproxy_prefs.pasteboard_to_clipboard = prefs_get_bool(CFSTR("sync_pasteboard_to_clipboard"), pbproxy_prefs.pasteboard_to_clipboard);
/* This is used for debugging. */
- //dump_prefs(stdout);
+ //dump_prefs();
if(pbproxy_prefs.active && pbproxy_prefs.primary_on_grab && !xpbproxy_have_xfixes) {
- fprintf(stderr, "Disabling sync_primary_on_select functionality due to missing XFixes extension.\n");
+ ErrorF("Disabling sync_primary_on_select functionality due to missing XFixes extension.\n");
pbproxy_prefs.primary_on_grab = NO;
}
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index af12de4..c540114 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -367,9 +367,9 @@ static void DarwinKeyboardSetRepeat(DeviceIntPtr pDev, int initialKeyRepeatValue
if (pDev->kbdfeed)
memcpy(pDev->kbdfeed->ctrl.autoRepeats, ctrl->per_key_repeat, XkbPerKeyBitArraySize);
- //fprintf(stderr, "per_key_repeat =\n");
+ //ErrorF("per_key_repeat =\n");
//for(i=0; i < XkbPerKeyBitArraySize; i++)
- // fprintf(stderr, "%02x%s", ctrl->per_key_repeat[i], (i + 1) & 7 ? "" : "\n");
+ // ErrorF("%02x%s", ctrl->per_key_repeat[i], (i + 1) & 7 ? "" : "\n");
/* And now we notify the puppies about the changes */
XkbDDXChangeControls(pDev, &old, ctrl);
commit cb083b05c469352ef80e1005a29ac320f2e4e096
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Mon Apr 25 21:25:10 2011 -0700
XQuartz: stub: Dead code removal
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c
index 3653bca..c8a6283 100644
--- a/hw/xquartz/mach-startup/stub.c
+++ b/hw/xquartz/mach-startup/stub.c
@@ -56,15 +56,6 @@ static char *server_bootstrap_name = kX11AppBundleId;
#include "launchd_fd.h"
-#ifndef BUILD_DATE
-#define BUILD_DATE "?"
-#endif
-#ifndef XSERVER_VERSION
-#define XSERVER_VERSION "?"
-#endif
-
-#define DEBUG 1
-
static char x11_path[PATH_MAX + 1];
static pid_t x11app_pid = 0;
@@ -197,13 +188,6 @@ int main(int argc, char **argv, char **envp) {
string_t handoff_socket_filename;
sig_t handler;
- if(argc == 2 && !strcmp(argv[1], "-version")) {
- fprintf(stderr, "X.org Release 7.5\n");
- fprintf(stderr, "X.Org X Server %s\n", XSERVER_VERSION);
- fprintf(stderr, "Build Date: %s\n", BUILD_DATE);
- return EXIT_SUCCESS;
- }
-
if(getenv("X11_PREFS_DOMAIN"))
server_bootstrap_name = getenv("X11_PREFS_DOMAIN");
commit 72ed7551f494c61283a7ac3d7b570eac39cc9786
Author: Emanuele Giaquinta <emanuele.giaquinta at gmail.com>
Date: Mon Apr 25 10:38:17 2011 -0700
XQuartz: pbproxy: LP64: Fix itteration through XGetWindowProperty where sizeof(long) != 4
http://xquartz.macosforge.org/trac/ticket/476
Signed-off-by: Emanuele Giaquinta <emanuele.giaquinta at gmail.com>
Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/pbproxy/x-selection.m b/hw/xquartz/pbproxy/x-selection.m
index e3d5113..99cc543 100644
--- a/hw/xquartz/pbproxy/x-selection.m
+++ b/hw/xquartz/pbproxy/x-selection.m
@@ -175,7 +175,12 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
#endif
/* Format is the number of bits. */
- chunkbytesize = numitems * (format / 8);
+ if (format == 8)
+ chunkbytesize = numitems;
+ else if (format == 16)
+ chunkbytesize = numitems * sizeof(short);
+ else if (format == 32)
+ chunkbytesize = numitems * sizeof(long);
#ifdef TEST
printf("chunkbytesize %zu\n", chunkbytesize);
@@ -235,9 +240,9 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
return None;
}
- for (i = 0, step = pdata->format >> 3; i < pdata->length; i += step)
+ for (i = 0, step = sizeof(long); i < pdata->length; i += step)
{
- a = (Atom)*(uint32_t *)(pdata->data + i);
+ a = (Atom)*(long *)(pdata->data + i);
if (a == atoms->image_png)
{
commit 0a60192a85ba9f64b522da181c2fe8a5b93b79df
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sun Apr 24 22:01:48 2011 -0700
XQuartz: Enable logging to a file for better debugging
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 0d2f9e2..2e18a74 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -589,6 +589,13 @@ void OsVendorFatalError( void )
void OsVendorInit(void)
{
if (serverGeneration == 1) {
+ char *lf;
+ char *home = getenv("HOME");
+ assert(home);
+ assert(0 < asprintf(&lf, "%s/Library/Logs/X11.%s.log", home, bundle_id_prefix));
+ LogInit(lf, ".old");
+ free(lf);
+
DarwinPrintBanner();
#ifdef ENABLE_DEBUG_LOG
{
diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h
index 3ba5d82..507c6f7 100644
--- a/hw/xquartz/darwin.h
+++ b/hw/xquartz/darwin.h
@@ -73,6 +73,9 @@ extern int darwinDesiredDepth;
extern int darwinMainScreenX;
extern int darwinMainScreenY;
+// bundle-main.c
+extern char *bundle_id_prefix;
+
#define ENABLE_DEBUG_LOG 1
#ifdef ENABLE_DEBUG_LOG
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index 2989021..bde259e 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -88,7 +88,7 @@ asm (".desc ___crashreporter_info__, 0x10");
static const char *__crashreporter_info__base = "X.Org X Server " XSERVER_VERSION " Build Date: " BUILD_DATE;
-static char *bundle_id_prefix = NULL;
+char *bundle_id_prefix = NULL;
static char *server_bootstrap_name = NULL;
#define DEBUG 1
commit de4023f194c561b74f8fa904bea3dd5298230cd1
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sun Apr 24 21:35:04 2011 -0700
XQuartz: Rename launchd-id-prefix to bundle-id-prefix
It's used many other places than just for launchd.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/configure.ac b/configure.ac
index 73bfbaf..c834a9d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -562,11 +562,14 @@ AC_ARG_WITH(apple-application-name,AS_HELP_STRING([--with-apple-application-name
[ APPLE_APPLICATION_NAME="${withval}" ],
[ APPLE_APPLICATION_NAME="X11" ])
AC_SUBST([APPLE_APPLICATION_NAME])
-AC_ARG_WITH(launchd-id-prefix, AS_HELP_STRING([--with-launchd-id-prefix=PATH], [Prefix to use for launchd identifiers (default: org.x)]),
- [ LAUNCHD_ID_PREFIX="${withval}" ],
- [ LAUNCHD_ID_PREFIX="org.x" ])
-AC_SUBST([LAUNCHD_ID_PREFIX])
-AC_DEFINE_UNQUOTED(LAUNCHD_ID_PREFIX, "$LAUNCHD_ID_PREFIX", [Prefix to use for launchd identifiers])
+AC_ARG_WITH(launchd-id-prefix, AS_HELP_STRING([--with-launchd-id-prefix=PATH], [Deprecated: Use --with-bundle-id-prefix.]),
+ [ BUNDLE_ID_PREFIX="${withval}" ],
+ [ BUNDLE_ID_PREFIX="org.x" ])
+AC_ARG_WITH(bundle-id-prefix, AS_HELP_STRING([--with-bundle-id-prefix=PATH], [Prefix to use for bundle identifiers (default: org.x)]),
+ [ BUNDLE_ID_PREFIX="${withval}" ],
+ [ BUNDLE_ID_PREFIX="org.x" ])
+AC_SUBST([BUNDLE_ID_PREFIX])
+AC_DEFINE_UNQUOTED(BUNDLE_ID_PREFIX, "$BUNDLE_ID_PREFIX", [Prefix to use for bundle identifiers])
AC_ARG_ENABLE(sparkle,AS_HELP_STRING([--enable-sparkle], [Enable updating of X11.app using the Sparkle Framework (default: disabled)]),
[ XQUARTZ_SPARKLE="${enableval}" ],
[ XQUARTZ_SPARKLE="no" ])
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 6f89437..2a45cc5 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -1012,7 +1012,7 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
NSMaxY([[NSScreen mainScreen] visibleFrame]);
#ifdef HAVE_LIBDISPATCH
- eventTranslationQueue = dispatch_queue_create(LAUNCHD_ID_PREFIX".X11.NSEventsToX11EventsQueue", NULL);
+ eventTranslationQueue = dispatch_queue_create(BUNDLE_ID_PREFIX".X11.NSEventsToX11EventsQueue", NULL);
assert(eventTranslationQueue != NULL);
#endif
diff --git a/hw/xquartz/bundle/Info.plist.cpp b/hw/xquartz/bundle/Info.plist.cpp
index 99b184f..a4b8e19 100644
--- a/hw/xquartz/bundle/Info.plist.cpp
+++ b/hw/xquartz/bundle/Info.plist.cpp
@@ -7,11 +7,11 @@
<key>CFBundleExecutable</key>
<string>X11</string>
<key>CFBundleGetInfoString</key>
- <string>LAUNCHD_ID_PREFIX.X11</string>
+ <string>BUNDLE_ID_PREFIX.X11</string>
<key>CFBundleIconFile</key>
<string>X11.icns</string>
<key>CFBundleIdentifier</key>
- <string>LAUNCHD_ID_PREFIX.X11</string>
+ <string>BUNDLE_ID_PREFIX.X11</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
diff --git a/hw/xquartz/bundle/Makefile.am b/hw/xquartz/bundle/Makefile.am
index 8a206cf..6deecae 100644
--- a/hw/xquartz/bundle/Makefile.am
+++ b/hw/xquartz/bundle/Makefile.am
@@ -1,7 +1,7 @@
include cpprules.in
CPP_FILES_FLAGS = \
- -DLAUNCHD_ID_PREFIX="$(LAUNCHD_ID_PREFIX)" \
+ -DBUNDLE_ID_PREFIX="$(BUNDLE_ID_PREFIX)" \
-DAPPLE_APPLICATION_NAME="$(APPLE_APPLICATION_NAME)"
if XQUARTZ_SPARKLE
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index d70cfd4..2989021 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -88,7 +88,7 @@ asm (".desc ___crashreporter_info__, 0x10");
static const char *__crashreporter_info__base = "X.Org X Server " XSERVER_VERSION " Build Date: " BUILD_DATE;
-static char *launchd_id_prefix = NULL;
+static char *bundle_id_prefix = NULL;
static char *server_bootstrap_name = NULL;
#define DEBUG 1
@@ -491,7 +491,7 @@ static void setup_env(void) {
/* fallback to hardcoded value if we can't discover it */
if(!pds) {
- pds = LAUNCHD_ID_PREFIX".X11";
+ pds = BUNDLE_ID_PREFIX".X11";
}
server_bootstrap_name = strdup(pds);
@@ -502,12 +502,12 @@ static void setup_env(void) {
setenv("X11_PREFS_DOMAIN", server_bootstrap_name, 1);
len = strlen(server_bootstrap_name);
- launchd_id_prefix = malloc(sizeof(char) * (len - 3));
- if(!launchd_id_prefix) {
+ bundle_id_prefix = malloc(sizeof(char) * (len - 3));
+ if(!bundle_id_prefix) {
fprintf(stderr, "X11.app: Memory allocation error.\n");
exit(1);
}
- strlcpy(launchd_id_prefix, server_bootstrap_name, len - 3);
+ strlcpy(bundle_id_prefix, server_bootstrap_name, len - 3);
/* We need to unset DISPLAY if it is not our socket */
if(disp) {
@@ -519,7 +519,7 @@ static void setup_env(void) {
}
if(s && *s) {
- if(strcmp(launchd_id_prefix, "org.x") == 0 && strcmp(s, ":0") == 0) {
+ if(strcmp(bundle_id_prefix, "org.x") == 0 && strcmp(s, ":0") == 0) {
fprintf(stderr, "X11.app: Detected old style launchd DISPLAY, please update xinit.\n");
} else {
temp = (char *)malloc(sizeof(char) * len);
@@ -527,12 +527,12 @@ static void setup_env(void) {
fprintf(stderr, "X11.app: Memory allocation error creating space for socket name test.\n");
exit(1);
}
- strlcpy(temp, launchd_id_prefix, len);
+ strlcpy(temp, bundle_id_prefix, len);
strlcat(temp, ":0", len);
if(strcmp(temp, s) != 0) {
/* If we don't have a match, unset it. */
- fprintf(stderr, "X11.app: DISPLAY (\"%s\") does not match our id (\"%s\"), unsetting.\n", disp, launchd_id_prefix);
+ fprintf(stderr, "X11.app: DISPLAY (\"%s\") does not match our id (\"%s\"), unsetting.\n", disp, bundle_id_prefix);
unsetenv("DISPLAY");
}
free(temp);
@@ -632,7 +632,7 @@ int main(int argc, char **argv, char **envp) {
fprintf(stderr, "Waiting for startup parameters via Mach IPC.\n");
kr = mach_msg_server(mach_startup_server, mxmsgsz, mp, 0);
if (kr != KERN_SUCCESS) {
- fprintf(stderr, "%s.X11(mp): %s\n", LAUNCHD_ID_PREFIX, mach_error_string(kr));
+ fprintf(stderr, "%s.X11(mp): %s\n", BUNDLE_ID_PREFIX, mach_error_string(kr));
return EXIT_FAILURE;
}
diff --git a/hw/xquartz/mach-startup/launchd_fd.c b/hw/xquartz/mach-startup/launchd_fd.c
index 6dace8e..5c7e03c 100644
--- a/hw/xquartz/mach-startup/launchd_fd.c
+++ b/hw/xquartz/mach-startup/launchd_fd.c
@@ -69,11 +69,11 @@ int launchd_display_fd(void) {
return ERROR_FD;
}
- listening_fd_array = launch_data_dict_lookup(sockets_dict, LAUNCHD_ID_PREFIX":0");
+ listening_fd_array = launch_data_dict_lookup(sockets_dict, BUNDLE_ID_PREFIX":0");
if (NULL == listening_fd_array) {
listening_fd_array = launch_data_dict_lookup(sockets_dict, ":0");
if (NULL == listening_fd_array) {
- fprintf(stderr,"launchd check-in: No known sockets found to answer requests on! \"%s:0\" and \":0\" failed.\n", LAUNCHD_ID_PREFIX);
+ fprintf(stderr,"launchd check-in: No known sockets found to answer requests on! \"%s:0\" and \":0\" failed.\n", BUNDLE_ID_PREFIX);
return ERROR_FD;
}
}
diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c
index 1804560..3653bca 100644
--- a/hw/xquartz/mach-startup/stub.c
+++ b/hw/xquartz/mach-startup/stub.c
@@ -40,7 +40,7 @@
#include <sys/socket.h>
#include <sys/un.h>
-#define kX11AppBundleId LAUNCHD_ID_PREFIX".X11"
+#define kX11AppBundleId BUNDLE_ID_PREFIX".X11"
#define kX11AppBundlePath "/Contents/MacOS/X11"
static char *server_bootstrap_name = kX11AppBundleId;
diff --git a/hw/xquartz/pbproxy/Makefile.am b/hw/xquartz/pbproxy/Makefile.am
index 1886642..b8b95d2 100644
--- a/hw/xquartz/pbproxy/Makefile.am
+++ b/hw/xquartz/pbproxy/Makefile.am
@@ -1,5 +1,5 @@
AM_CPPFLAGS=-F/System/Library/Frameworks/ApplicationServices.framework/Frameworks \
- -DLAUNCHD_ID_PREFIX=\"$(LAUNCHD_ID_PREFIX)\"
+ -DBUNDLE_ID_PREFIX=\"$(BUNDLE_ID_PREFIX)\"
AM_CFLAGS=$(XPBPROXY_CFLAGS)
diff --git a/hw/xquartz/pbproxy/app-main.m b/hw/xquartz/pbproxy/app-main.m
index b00e90a..245d1bc 100644
--- a/hw/xquartz/pbproxy/app-main.m
+++ b/hw/xquartz/pbproxy/app-main.m
@@ -34,7 +34,7 @@
#include <unistd.h> /*for getpid*/
#include <Cocoa/Cocoa.h>
-static const char *app_prefs_domain = LAUNCHD_ID_PREFIX".xpbproxy";
+static const char *app_prefs_domain = BUNDLE_ID_PREFIX".xpbproxy";
CFStringRef app_prefs_domain_cfstr;
/* Stubs */
diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index 066cc0f..5f6b1cb 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -477,7 +477,7 @@ xprInit(ScreenPtr pScreen)
assert((window_hash = x_hash_table_new(NULL, NULL, NULL, NULL)));
#ifdef HAVE_LIBDISPATCH
- assert((window_hash_serial_q = dispatch_queue_create(LAUNCHD_ID_PREFIX".X11.xpr_window_hash", NULL)));
+ assert((window_hash_serial_q = dispatch_queue_create(BUNDLE_ID_PREFIX".X11.xpr_window_hash", NULL)));
#else
assert(0 == pthread_mutex_init(&window_hash_mutex, NULL));
#endif
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 74f4cc6..4710ef8 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -124,8 +124,8 @@
/* Support application updating through sparkle. */
#undef XQUARTZ_SPARKLE
-/* Prefix to use for launchd identifiers */
-#undef LAUNCHD_ID_PREFIX
+/* Prefix to use for bundle identifiers */
+#undef BUNDLE_ID_PREFIX
/* Build a standalone xpbproxy */
#undef STANDALONE_XPBPROXY
diff --git a/manpages.am b/manpages.am
index 69ee005..03089e3 100644
--- a/manpages.am
+++ b/manpages.am
@@ -24,7 +24,7 @@ MAN_SUBSTS += -e 's|__logdir__|$(logdir)|g' \
-e 's|__sysconfdir__|$(sysconfdir)|g' \
-e 's|__xconfigdir__|$(__XCONFIGDIR__)|g' \
-e 's|__xkbdir__|$(XKB_BASE_DIRECTORY)|g' \
- -e 's|__laucnd_id_prefix__|$(LAUNCHD_ID_PREFIX)|g' \
+ -e 's|__laucnd_id_prefix__|$(BUNDLE_ID_PREFIX)|g' \
-e 's|__modulepath__|$(DEFAULT_MODULE_PATH)|g' \
-e 's|__default_font_path__|$(COMPILEDDEFAULTFONTPATH)|g' \
-e '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g'
commit e466745109416a2fcdf5d7389c80b814a0363676
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sun Apr 24 20:35:06 2011 -0700
XQuartz: Dead code removal
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 00be74b..0d2f9e2 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -133,22 +133,6 @@ static PixmapFormatRec formats[] = {
};
const int NUMFORMATS = sizeof(formats)/sizeof(formats[0]);
-#ifndef OSNAME
-#define OSNAME " Darwin"
-#endif
-#ifndef OSVENDOR
-#define OSVENDOR ""
-#endif
-#ifndef PRE_RELEASE
-#define PRE_RELEASE XORG_VERSION_SNAP
-#endif
-#ifndef BUILD_DATE
-#define BUILD_DATE ""
-#endif
-#ifndef XORG_RELEASE
-#define XORG_RELEASE "?"
-#endif
-
void
DarwinPrintBanner(void)
{
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index e473bb7..74f4cc6 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -30,9 +30,6 @@
/* Support Damage extension */
#undef DAMAGE
-/* Build for darwin with Quartz support */
-#undef DARWIN_WITH_QUARTZ
-
/* Use OsVendorVErrorF */
#undef DDXOSVERRORF
commit f1d867c0a1577e2c46d5dd4e262444e0cf6f8e25
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sat Apr 23 23:22:27 2011 -0700
XQuartz: Silence clang static analyzer
Call to 'malloc' has an allocation size of 0 bytes.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c
index ccf5ab4..1804560 100644
--- a/hw/xquartz/mach-startup/stub.c
+++ b/hw/xquartz/mach-startup/stub.c
@@ -300,8 +300,8 @@ int main(int argc, char **argv, char **envp) {
/* We have fixed-size string lengths due to limitations in IPC,
* so we need to copy our argv and envp.
*/
- newargv = (string_array_t)malloc(argc * sizeof(string_t));
- newenvp = (string_array_t)malloc(envpc * sizeof(string_t));
+ newargv = (string_array_t)calloc((1 + argc), sizeof(string_t));
+ newenvp = (string_array_t)calloc((1 + envpc), sizeof(string_t));
if(!newargv || !newenvp) {
fprintf(stderr, "Xquartz: Memory allocation failure\n");
commit 913223e9ddf2cb927ecad99aeadfa730df8561ac
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sat Apr 23 23:15:49 2011 -0700
XQuartz: xpr: Dead code removal
Assigned value is always the same as the existing value.
Found by clang static analyzer
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/xpr/dri.c b/hw/xquartz/xpr/dri.c
index 3474d27..8fef3b7 100644
--- a/hw/xquartz/xpr/dri.c
+++ b/hw/xquartz/xpr/dri.c
@@ -562,7 +562,6 @@ DRIWindowExposures(WindowPtr pWin, RegionPtr prgn, RegionPtr bsreg)
(*pScreen->WindowExposures)(pWin, prgn, bsreg);
- pDRIPriv->wrap.WindowExposures = pScreen->WindowExposures;
pScreen->WindowExposures = DRIWindowExposures;
}
@@ -587,7 +586,6 @@ DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
(*pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc);
/* rewrap */
- pDRIPriv->wrap.CopyWindow = pScreen->CopyWindow;
pScreen->CopyWindow = DRICopyWindow;
}
@@ -605,7 +603,6 @@ DRIValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind)
returnValue = (*pScreen->ValidateTree)(pParent, pChild, kind);
/* rewrap */
- pDRIPriv->wrap.ValidateTree = pScreen->ValidateTree;
pScreen->ValidateTree = DRIValidateTree;
return returnValue;
@@ -632,7 +629,6 @@ DRIPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind)
(*pScreen->PostValidateTree)(pParent, pChild, kind);
/* rewrap */
- pDRIPriv->wrap.PostValidateTree = pScreen->PostValidateTree;
pScreen->PostValidateTree = DRIPostValidateTree;
}
}
@@ -653,7 +649,6 @@ DRIClipNotify(WindowPtr pWin, int dx, int dy)
(*pScreen->ClipNotify)(pWin, dx, dy);
- pDRIPriv->wrap.ClipNotify = pScreen->ClipNotify;
pScreen->ClipNotify = DRIClipNotify;
}
}
commit d0caa0e4cd255bea315757be2ff387cf57e8bdf7
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sat Apr 23 20:12:38 2011 -0700
XQuartz: Silence warnings about deprecated functionality where it is an intended fallback
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index 6a6c01c..d70cfd4 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -144,7 +144,15 @@ static mach_port_t checkin_or_register(char *bname) {
exit(EXIT_FAILURE);
}
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations" // bootstrap_register
+#endif
kr = bootstrap_register(bootstrap_port, bname, mp);
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
if (kr != KERN_SUCCESS) {
fprintf(stderr, "bootstrap_register(): %s\n", mach_error_string(kr));
exit(EXIT_FAILURE);
diff --git a/hw/xquartz/pbproxy/x-selection.m b/hw/xquartz/pbproxy/x-selection.m
index ef84f8b..e3d5113 100644
--- a/hw/xquartz/pbproxy/x-selection.m
+++ b/hw/xquartz/pbproxy/x-selection.m
@@ -625,6 +625,10 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
/* TODO add the NSPICTPboardType back again, once we have conversion
* functionality in send_image.
*/
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations" // NSPICTPboardType
+#endif
if ([pbtypes containsObject:NSPICTPboardType]
|| [pbtypes containsObject:NSTIFFPboardType])
@@ -637,6 +641,10 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
++count;
}
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
if (count)
{
/* We have a list of ATOMs to send. */
@@ -925,7 +933,14 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
if (NO == [self send_image_tiff_reply:e pasteboard:pb type:imagetype])
return;
}
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations" // NSPICTPboardType
+#endif
else if ([pbtypes containsObject:NSPICTPboardType])
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
{
if (NO == [self send_image_pict_reply:e pasteboard:pb type:imagetype])
return;
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 3ab5d52..af12de4 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -684,6 +684,11 @@ static Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
}
#endif
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations" // KLGetCurrentKeyboardLayout, KLGetKeyboardLayoutProperty
+#endif
+
#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050
if (chr_data == NULL) {
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
@@ -717,6 +722,10 @@ static Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
}
#endif
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
if(currentKeyLayoutRef)
CFRelease(currentKeyLayoutRef);
@@ -773,10 +782,16 @@ static Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
}
#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050
} else { // kchr
- UInt32 c, state = 0, state2 = 0;
+ UInt32 c, state = 0, state2 = 0;
UInt16 code;
code = i | mods[j];
+
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations" // KeyTranslate
+#endif
+
c = KeyTranslate (chr_data, code, &state);
/* Dead keys are only processed on key-down, so ask
@@ -787,6 +802,10 @@ static Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
if (state != 0)
c = KeyTranslate (chr_data, code | 128, &state2);
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
/* Characters seem to be in MacRoman encoding. */
if (c != 0 && c != 0x0010) {
commit 9244a3a24f63239ec12675f3df091583e06c8314
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sat Apr 23 12:55:39 2011 -0700
XQuartz: xpr: Use a serial queue rather than pthread mutexes for window_hash
Additionally removes some dead code and fixes double-locking in
xprIsX11Window. xprIsX11Window doesn't need to do any locking because
those resources are protected by the called functions themselves.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
Reviewed-by: Daniel A. Steffen <dsteffen at apple.com>
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 83b5601..6f89437 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -236,8 +236,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
if ([self isActive]) {
[self deactivate];
- if (!_x_active && quartzProcs->IsX11Window([e window],
- [e windowNumber]))
+ if (!_x_active && quartzProcs->IsX11Window([e windowNumber]))
[self activateX:YES];
}
}
diff --git a/hw/xquartz/quartz.h b/hw/xquartz/quartz.h
index 67a7919..0a9c47a 100644
--- a/hw/xquartz/quartz.h
+++ b/hw/xquartz/quartz.h
@@ -70,7 +70,7 @@ typedef void (*UpdateScreenProc)(ScreenPtr pScreen);
/*
* Rootless helper functions
*/
-typedef Bool (*IsX11WindowProc)(void *nsWindow, int windowNumber);
+typedef Bool (*IsX11WindowProc)(int windowNumber);
typedef void (*HideWindowsProc)(Bool hide);
/*
diff --git a/hw/xquartz/xpr/xpr.h b/hw/xquartz/xpr/xpr.h
index af1a90c..ebd89de 100644
--- a/hw/xquartz/xpr/xpr.h
+++ b/hw/xquartz/xpr/xpr.h
@@ -38,7 +38,7 @@ Bool QuartzModeBundleInit(void);
void AppleDRIExtensionInit(void);
void xprAppleWMInit(void);
Bool xprInit(ScreenPtr pScreen);
-Bool xprIsX11Window(void *nsWindow, int windowNumber);
+Bool xprIsX11Window(int windowNumber);
WindowPtr xprGetXWindow(xp_window_id wid);
void xprHideWindows(Bool hide);
diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index f0e9a89..066cc0f 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -43,7 +43,11 @@
#include "windowstr.h"
#include "quartz.h"
+#ifdef HAVE_LIBDISPATCH
+#include <dispatch/dispatch.h>
+#else
#include <pthread.h>
+#endif
#define DEFINE_ATOM_HELPER(func,atom_name) \
static Atom func (void) { \
@@ -61,10 +65,12 @@ DEFINE_ATOM_HELPER(xa_native_window_id, "_NATIVE_WINDOW_ID")
/* Maps xp_window_id -> RootlessWindowRec */
static x_hash_table *window_hash;
-/* Need to guard window_hash since xprGetXWindowFromAppKit and xprIsX11Window
- * can be called from any thread.
- */
+/* Need to guard window_hash since xprIsX11Window can be called from any thread. */
+#ifdef HAVE_LIBDISPATCH
+static dispatch_queue_t window_hash_serial_q;
+#else
static pthread_mutex_t window_hash_mutex;
+#endif
/* Prototypes for static functions */
static Bool xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
@@ -181,9 +187,15 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
return FALSE;
}
+#ifdef HAVE_LIBDISPATCH
+ dispatch_async(window_hash_serial_q, ^{
+ x_hash_table_insert(window_hash, pFrame->wid, pFrame);
+ });
+#else
pthread_mutex_lock(&window_hash_mutex);
x_hash_table_insert(window_hash, pFrame->wid, pFrame);
pthread_mutex_unlock(&window_hash_mutex);
+#endif
xprSetNativeProperty(pFrame);
@@ -199,9 +211,15 @@ xprDestroyFrame(RootlessFrameID wid)
{
xp_error err;
+#ifdef HAVE_LIBDISPATCH
+ dispatch_async(window_hash_serial_q, ^{
+ x_hash_table_remove(window_hash, wid);
+ });
+#else
pthread_mutex_lock(&window_hash_mutex);
x_hash_table_remove(window_hash, wid);
pthread_mutex_unlock(&window_hash_mutex);
+#endif
err = xp_destroy_window(x_cvt_vptr_to_uint(wid));
if (err != Success)
@@ -253,6 +271,9 @@ xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) {
xp_window_changes wc;
unsigned int mask = XP_STACKING;
+#ifdef HAVE_LIBDISPATCH
+ __block
+#endif
RootlessWindowRec *winRec;
/* Stack frame below nextWid it if it exists, or raise
@@ -266,8 +287,16 @@ static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) {
wc.sibling = x_cvt_vptr_to_uint(nextWid);
}
+#ifdef HAVE_LIBDISPATCH
+ dispatch_sync(window_hash_serial_q, ^{
+ winRec = x_hash_table_lookup(window_hash, wid, NULL);
+ });
+#else
+ pthread_mutex_lock(&window_hash_mutex);
winRec = x_hash_table_lookup(window_hash, wid, NULL);
-
+ pthread_mutex_unlock(&window_hash_mutex);
+#endif
+
if(winRec) {
if(XQuartzIsRootless)
wc.window_level = normal_window_levels[winRec->level];
@@ -447,8 +476,12 @@ xprInit(ScreenPtr pScreen)
rootless_CopyWindow_threshold = xp_scroll_area_threshold;
assert((window_hash = x_hash_table_new(NULL, NULL, NULL, NULL)));
+#ifdef HAVE_LIBDISPATCH
+ assert((window_hash_serial_q = dispatch_queue_create(LAUNCHD_ID_PREFIX".X11.xpr_window_hash", NULL)));
+#else
assert(0 == pthread_mutex_init(&window_hash_mutex, NULL));
-
+#endif
+
return TRUE;
}
@@ -460,60 +493,36 @@ xprInit(ScreenPtr pScreen)
WindowPtr
xprGetXWindow(xp_window_id wid)
{
+#ifdef HAVE_LIBDISPATCH
+ RootlessWindowRec *winRec __block;
+ dispatch_sync(window_hash_serial_q, ^{
+ winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr(wid), NULL);
+ });
+#else
RootlessWindowRec *winRec;
-
- winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr(wid), NULL);
-
- 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.
- */
-WindowPtr
-xprGetXWindowFromAppKit(int windowNumber)
-{
- RootlessWindowRec *winRec;
- Bool ret;
- xp_window_id wid;
-
pthread_mutex_lock(&window_hash_mutex);
-
- if (xp_lookup_native_window(windowNumber, &wid))
- ret = xprGetXWindow(wid) != NULL;
- else
- ret = FALSE;
-
- pthread_mutex_unlock(&window_hash_mutex);
-
- if (!ret) return NULL;
winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr(wid), NULL);
+ pthread_mutex_unlock(&window_hash_mutex);
+#endif
return winRec != NULL ? winRec->win : NULL;
}
-#endif
/*
* The windowNumber is an AppKit window number. Returns TRUE if xpr is
* displaying a window with that number.
*/
Bool
-xprIsX11Window(void *nsWindow, int windowNumber)
+xprIsX11Window(int windowNumber)
{
Bool ret;
xp_window_id wid;
- pthread_mutex_lock(&window_hash_mutex);
-
if (xp_lookup_native_window(windowNumber, &wid))
ret = xprGetXWindow(wid) != NULL;
else
ret = FALSE;
- pthread_mutex_unlock(&window_hash_mutex);
-
return ret;
}
commit bac34a54f7cb84f346b1b833df9917bd1ac70223
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sat Apr 23 12:11:39 2011 -0700
XQuartz: xpr: Initialize window_hash in xprInit
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index efb3737..f0e9a89 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -1,7 +1,7 @@
/*
* Xplugin rootless implementation frame functions
*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Apple Computer, 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
@@ -35,7 +35,6 @@
#include "rootlessCommon.h"
#include <Xplugin.h>
#include "x-hash.h"
-#include "x-list.h"
#include "applewmExt.h"
#include "propertyst.h"
@@ -61,6 +60,10 @@ DEFINE_ATOM_HELPER(xa_native_window_id, "_NATIVE_WINDOW_ID")
/* Maps xp_window_id -> RootlessWindowRec */
static x_hash_table *window_hash;
+
+/* Need to guard window_hash since xprGetXWindowFromAppKit and xprIsX11Window
+ * can be called from any thread.
+ */
static pthread_mutex_t window_hash_mutex;
/* Prototypes for static functions */
@@ -178,12 +181,6 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
return FALSE;
}
- if (window_hash == NULL)
- {
- window_hash = x_hash_table_new(NULL, NULL, NULL, NULL);
- pthread_mutex_init(&window_hash_mutex, NULL);
- }
-
pthread_mutex_lock(&window_hash_mutex);
x_hash_table_insert(window_hash, pFrame->wid, pFrame);
pthread_mutex_unlock(&window_hash_mutex);
@@ -256,6 +253,7 @@ xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) {
xp_window_changes wc;
unsigned int mask = XP_STACKING;
+ RootlessWindowRec *winRec;
/* Stack frame below nextWid it if it exists, or raise
frame above everything otherwise. */
@@ -268,18 +266,16 @@ static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) {
wc.sibling = x_cvt_vptr_to_uint(nextWid);
}
- if(window_hash) {
- RootlessWindowRec *winRec = x_hash_table_lookup(window_hash, wid, NULL);
-
- if(winRec) {
- if(XQuartzIsRootless)
- wc.window_level = normal_window_levels[winRec->level];
- else if(XQuartzShieldingWindowLevel)
- wc.window_level = XQuartzShieldingWindowLevel + 1;
- else
- wc.window_level = rooted_window_levels[winRec->level];
- mask |= XP_WINDOW_LEVEL;
- }
+ winRec = x_hash_table_lookup(window_hash, wid, NULL);
+
+ if(winRec) {
+ if(XQuartzIsRootless)
+ wc.window_level = normal_window_levels[winRec->level];
+ else if(XQuartzShieldingWindowLevel)
+ wc.window_level = XQuartzShieldingWindowLevel + 1;
+ else
+ wc.window_level = rooted_window_levels[winRec->level];
+ mask |= XP_WINDOW_LEVEL;
}
xprConfigureWindow(x_cvt_vptr_to_uint(wid), mask, &wc);
@@ -450,6 +446,9 @@ xprInit(ScreenPtr pScreen)
rootless_CopyBytes_threshold = xp_copy_bytes_threshold;
rootless_CopyWindow_threshold = xp_scroll_area_threshold;
+ assert((window_hash = x_hash_table_new(NULL, NULL, NULL, NULL)));
+ assert(0 == pthread_mutex_init(&window_hash_mutex, NULL));
+
return TRUE;
}
@@ -463,9 +462,6 @@ xprGetXWindow(xp_window_id wid)
{
RootlessWindowRec *winRec;
- if (window_hash == NULL)
- return NULL;
-
winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr(wid), NULL);
return winRec != NULL ? winRec->win : NULL;
@@ -483,11 +479,6 @@ xprGetXWindowFromAppKit(int windowNumber)
Bool ret;
xp_window_id wid;
- if (window_hash == NULL)
- return FALSE;
-
- /* need to lock, since this function can be called by any thread */
-
pthread_mutex_lock(&window_hash_mutex);
if (xp_lookup_native_window(windowNumber, &wid))
@@ -514,11 +505,6 @@ xprIsX11Window(void *nsWindow, int windowNumber)
Bool ret;
xp_window_id wid;
- if (window_hash == NULL)
- return FALSE;
-
- /* need to lock, since this function can be called by any thread */
-
pthread_mutex_lock(&window_hash_mutex);
if (xp_lookup_native_window(windowNumber, &wid))
commit 1596ea72d66a03d9accb534679172ca6f63f78e1
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sat Apr 23 11:55:49 2011 -0700
XQuartz: Use a lighter spinlock instead of a pthread_mutex_t in QuartzScreenSaver
Currently, we only end up here through a call to QuartzShowFullscreen, and
this is always on the same thread. Future changes (such as further
incorporating libdispatch) may allow this to change, but contention will
remain minimal since the call is infrequent and it is short held.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
Reviewed-by: Daniel A. Steffen <dsteffen at apple.com>
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index 4b72a89..0e71d36 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -62,7 +62,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <IOKit/pwr_mgt/IOPMLib.h>
-#include <pthread.h>
+#include <libkern/OSAtomic.h>
#include <signal.h>
#include <rootlessCommon.h>
@@ -279,10 +279,10 @@ static void pokeActivityCallback(CFRunLoopTimerRef timer, void *info) {
static void QuartzScreenSaver(int state) {
static CFRunLoopTimerRef pokeActivityTimer = NULL;
static CFRunLoopTimerContext pokeActivityContext = { 0, NULL, NULL, NULL, NULL };
- static pthread_mutex_t pokeActivityMutex = PTHREAD_MUTEX_INITIALIZER;
+ static OSSpinLock pokeActivitySpinLock = OS_SPINLOCK_INIT;
+
+ OSSpinLockLock(&pokeActivitySpinLock);
- pthread_mutex_lock(&pokeActivityMutex);
-
if(state) {
if(pokeActivityTimer == NULL)
goto QuartzScreenSaverEnd;
@@ -303,7 +303,7 @@ static void QuartzScreenSaver(int state) {
CFRunLoopAddTimer(CFRunLoopGetMain(), pokeActivityTimer, kCFRunLoopCommonModes);
}
QuartzScreenSaverEnd:
- pthread_mutex_unlock(&pokeActivityMutex);
+ OSSpinLockUnlock(&pokeActivitySpinLock);
}
void QuartzShowFullscreen(int state) {
commit 3e253c603bc18f06fa48b611797eb5a7c8a96fe4
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sat Apr 23 01:48:25 2011 -0700
XQuartz: Remove the threadSafety dead-ish code
It's been a few years now since we've needed this to debug thread
boundaries, so punt it out to clean up the namespace polution.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am
index 61b04e0..76f624d 100644
--- a/hw/xquartz/Makefile.am
+++ b/hw/xquartz/Makefile.am
@@ -33,8 +33,7 @@ libXquartz_la_SOURCES = \
quartzCocoa.m \
quartzKeyboard.c \
quartzStartup.c \
- quartzRandR.c \
- threadSafety.c
+ quartzRandR.c
EXTRA_DIST = \
X11Application.h \
@@ -50,5 +49,4 @@ EXTRA_DIST = \
quartzKeyboard.h \
quartzRandR.h \
sanitizedCarbon.h \
- sanitizedCocoa.h \
- threadSafety.h
+ sanitizedCocoa.h
diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h
index 3602257..3ba5d82 100644
--- a/hw/xquartz/darwin.h
+++ b/hw/xquartz/darwin.h
@@ -34,8 +34,6 @@
#include <X11/extensions/XKB.h>
#include <assert.h>
-#include "threadSafety.h"
-
#include "darwinfb.h"
// From darwin.c
@@ -80,7 +78,7 @@ extern int darwinMainScreenY;
#ifdef ENABLE_DEBUG_LOG
extern FILE *debug_log_fp;
#define DEBUG_LOG_NAME "x11-debug.txt"
-#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%s:%s:%s:%d " msg, threadSafetyID(pthread_self()), __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp);
+#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%s:%s:%d " msg, __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp);
#else
#define DEBUG_LOG(msg, args...)
#endif
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 5bcee04..f3e1225 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -197,8 +197,6 @@ static void DarwinUpdateModifiers(
static void DarwinEventHandler(int screenNum, InternalEvent *ie, DeviceIntPtr dev) {
XQuartzEvent *e = &(ie->xquartz_event);
- TA_SERVER();
-
switch(e->subtype) {
case kXquartzControllerNotify:
DEBUG_LOG("kXquartzControllerNotify\n");
@@ -381,8 +379,6 @@ void ProcessInputEvents(void) {
char nullbyte;
int x = sizeof(nullbyte);
- TA_SERVER();
-
mieqProcessInputEvents();
// Empty the signaling pipe
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 54f709a..3ab5d52 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -56,8 +56,6 @@
#include "X11Application.h"
-#include "threadSafety.h"
-
#ifdef NDEBUG
#undef NDEBUG
#include <assert.h>
diff --git a/hw/xquartz/quartzStartup.c b/hw/xquartz/quartzStartup.c
index 36c8182..00a9e48 100644
--- a/hw/xquartz/quartzStartup.c
+++ b/hw/xquartz/quartzStartup.c
@@ -84,10 +84,7 @@ void QuartzInitServer(int argc, char **argv, char **envp) {
args->argv = argv;
args->envp = envp;
- APPKIT_THREAD_ID = pthread_self();
- SERVER_THREAD_ID = create_thread(server_thread, args);
-
- if (!SERVER_THREAD_ID) {
+ if (!create_thread(server_thread, args)) {
FatalError("can't create secondary thread\n");
}
}
diff --git a/hw/xquartz/threadSafety.c b/hw/xquartz/threadSafety.c
deleted file mode 100644
index 85f85bd..0000000
--- a/hw/xquartz/threadSafety.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2008 Apple, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name(s) of the above copyright
- * holders shall not be used in advertising or otherwise to promote the sale,
- * use or other dealings in this Software without prior written authorization.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "threadSafety.h"
-#include "os.h"
-
-pthread_t APPKIT_THREAD_ID;
-pthread_t SERVER_THREAD_ID;
-
-#include <AvailabilityMacros.h>
-
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
-#include <execinfo.h>
-
-void spewCallStack(void) {
- void* callstack[128];
- int i, frames = backtrace(callstack, 128);
- char** strs = backtrace_symbols(callstack, frames);
-
- for (i = 0; i < frames; ++i) {
- ErrorF("%s\n", strs[i]);
- }
-
- free(strs);
-}
-#else
-void spewCallStack(void) {
- return;
-}
-#endif
-
-void _threadSafetyAssert(pthread_t tid, const char *file, const char *fun, int line) {
- if(pthread_equal(pthread_self(), tid))
- return;
-
- /* NOOOO! */
- ErrorF("Thread Assertion Failed: self=%s, expected=%s\n%s:%s:%d\n",
- threadSafetyID(pthread_self()), threadSafetyID(tid),
- file, fun, line);
- spewCallStack();
-}
-
-const char *threadSafetyID(pthread_t tid) {
- if(pthread_equal(tid, APPKIT_THREAD_ID)) {
- return "Appkit Thread";
- } else if(pthread_equal(tid, SERVER_THREAD_ID)) {
- return "Xserver Thread";
- } else {
- return "Unknown Thread";
- }
-}
diff --git a/hw/xquartz/threadSafety.h b/hw/xquartz/threadSafety.h
deleted file mode 100644
index 3ff9eaf..0000000
--- a/hw/xquartz/threadSafety.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2008 Apple, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name(s) of the above copyright
- * holders shall not be used in advertising or otherwise to promote the sale,
- * use or other dealings in this Software without prior written authorization.
- */
-
-#ifndef _XQ_THREAD_SAFETY_H_
-#define _XQ_THREAD_SAFETY_H_
-
-#define DEBUG_THREADS 1
-
-#include <pthread.h>
-
-extern pthread_t APPKIT_THREAD_ID;
-extern pthread_t SERVER_THREAD_ID;
-
-/* Dump the call stack */
-void spewCallStack(void);
-
-/* Print message to ErrorF if we're in the wrong thread */
-void _threadSafetyAssert(pthread_t tid, const char *file, const char *fun, int line);
-
-/* Get a string that identifies our thread nicely */
-const char *threadSafetyID(pthread_t tid);
-
-#define threadSafetyAssert(tid) _threadSafetyAssert(tid, __FILE__, __FUNCTION__, __LINE__)
-
-#ifdef DEBUG_THREADS
-#define TA_APPKIT() threadSafetyAssert(APPKIT_THREAD_ID)
-#define TA_SERVER() threadSafetyAssert(SERVER_THREAD_ID)
-#else
-#define TA_SERVER()
-#define TA_APPKIT()
-#endif
-
-#endif /* _XQ_THREAD_SAFETY_H_ */
diff --git a/hw/xquartz/xpr/xprEvent.c b/hw/xquartz/xpr/xprEvent.c
index 342b54c..cc86c47 100644
--- a/hw/xquartz/xpr/xprEvent.c
+++ b/hw/xquartz/xpr/xprEvent.c
@@ -57,8 +57,6 @@
#include "xprEvent.h"
Bool QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev) {
- TA_SERVER();
-
switch(e->subtype) {
case kXquartzWindowState:
DEBUG_LOG("kXquartzWindowState\n");
diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index 15598e9..efb3737 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -44,8 +44,6 @@
#include "windowstr.h"
#include "quartz.h"
-#include "threadSafety.h"
-
#include <pthread.h>
#define DEFINE_ATOM_HELPER(func,atom_name) \
@@ -93,8 +91,6 @@ static inline xp_error
xprConfigureWindow(xp_window_id id, unsigned int mask,
const xp_window_changes *values)
{
- TA_SERVER();
-
return xp_configure_window(id, mask, values);
}
@@ -106,8 +102,6 @@ xprSetNativeProperty(RootlessWindowPtr pFrame)
unsigned int native_id;
long data;
- TA_SERVER();
-
err = xp_get_native_window(x_cvt_vptr_to_uint(pFrame->wid), &native_id);
if (err == Success)
{
@@ -137,8 +131,6 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
unsigned int mask = 0;
xp_error err;
- TA_SERVER();
-
wc.x = newX;
wc.y = newY;
wc.width = pFrame->width;
@@ -209,8 +201,7 @@ static void
xprDestroyFrame(RootlessFrameID wid)
{
xp_error err;
- TA_SERVER();
-
+
pthread_mutex_lock(&window_hash_mutex);
x_hash_table_remove(window_hash, wid);
pthread_mutex_unlock(&window_hash_mutex);
@@ -229,8 +220,6 @@ xprMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY)
{
xp_window_changes wc;
- TA_SERVER();
-
wc.x = newX;
wc.y = newY;
// ErrorF("xprMoveFrame(%d, %p, %d, %d)\n", wid, pScreen, newX, newY);
@@ -248,8 +237,6 @@ xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
{
xp_window_changes wc;
- TA_SERVER();
-
wc.x = newX;
wc.y = newY;
wc.width = newW;
@@ -270,8 +257,6 @@ static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) {
xp_window_changes wc;
unsigned int mask = XP_STACKING;
- TA_SERVER();
-
/* Stack frame below nextWid it if it exists, or raise
frame above everything otherwise. */
@@ -309,8 +294,6 @@ xprReshapeFrame(RootlessFrameID wid, RegionPtr pShape)
{
xp_window_changes wc;
- TA_SERVER();
-
if (pShape != NULL)
{
wc.shape_nrects = RegionNumRects(pShape);
@@ -336,8 +319,6 @@ xprUnmapFrame(RootlessFrameID wid)
{
xp_window_changes wc;
- TA_SERVER();
-
wc.stack_mode = XP_UNMAPPED;
wc.sibling = 0;
@@ -356,8 +337,6 @@ xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
unsigned int rowbytes[2];
xp_error err;
- TA_SERVER();
-
err = xp_lock_window(x_cvt_vptr_to_uint(wid), NULL, NULL, data, rowbytes, NULL);
if (err != Success)
FatalError("Could not lock window %i for drawing.", (int)x_cvt_vptr_to_uint(wid));
@@ -374,8 +353,7 @@ static void
xprStopDrawing(RootlessFrameID wid, Bool flush)
{
xp_error err;
- TA_SERVER();
-
+
err = xp_unlock_window(x_cvt_vptr_to_uint(wid), flush);
if(err != Success)
FatalError("Could not unlock window %i after drawing.", (int)x_cvt_vptr_to_uint(wid));
@@ -388,8 +366,6 @@ xprStopDrawing(RootlessFrameID wid, Bool flush)
static void
xprUpdateRegion(RootlessFrameID wid, RegionPtr pDamage)
{
- TA_SERVER();
-
xp_flush_window(x_cvt_vptr_to_uint(wid));
}
@@ -401,8 +377,6 @@ static void
xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec *rects,
int shift_x, int shift_y)
{
- TA_SERVER();
-
xp_mark_window(x_cvt_vptr_to_uint(wid), nrects, rects, shift_x, shift_y);
}
@@ -416,8 +390,6 @@ xprSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin)
{
DeleteProperty(serverClient, oldWin, xa_native_window_id());
- TA_SERVER();
-
xprSetNativeProperty(pFrame);
}
@@ -429,8 +401,6 @@ static Bool xprDoReorderWindow(RootlessWindowPtr pFrame)
{
WindowPtr pWin = pFrame->win;
- TA_SERVER();
-
return AppleWMDoReorderWindow(pWin);
}
@@ -443,8 +413,6 @@ static void
xprCopyWindow(RootlessFrameID wid, int dstNrects, const BoxRec *dstRects,
int dx, int dy)
{
- TA_SERVER();
-
xp_copy_window(x_cvt_vptr_to_uint(wid), x_cvt_vptr_to_uint(wid),
dstNrects, dstRects, dx, dy);
}
@@ -479,8 +447,6 @@ xprInit(ScreenPtr pScreen)
{
RootlessInit(pScreen, &xprRootlessProcs);
- TA_SERVER();
-
rootless_CopyBytes_threshold = xp_copy_bytes_threshold;
rootless_CopyWindow_threshold = xp_scroll_area_threshold;
@@ -578,8 +544,6 @@ xprHideWindows(Bool hide)
int screen;
WindowPtr pRoot, pWin;
- TA_SERVER();
-
for (screen = 0; screen < screenInfo.numScreens; screen++) {
RootlessFrameID prevWid = NULL;
pRoot = screenInfo.screens[screen]->root;
commit a52c8078c9cc83c84a8c6eb58810f49bdb90bcc1
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sat Apr 23 01:39:16 2011 -0700
XQuartz: Use xorg_backtrace() instead of spewCallStack()
xorg_backtrace() has been in os for two years now, we might as well
start using it.
Ref: 94ed0ba1b5043ad9fc33b42756af447d5ab15bbd
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 40d8a4e..5bcee04 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -113,7 +113,7 @@ void darwinEvents_lock(void) {
if((err = pthread_mutex_lock(&mieq_lock))) {
ErrorF("%s:%s:%d: Failed to lock mieq_lock: %d\n",
__FILE__, __FUNCTION__, __LINE__, err);
- spewCallStack();
+ xorg_backtrace();
}
if(darwinEvents == NULL) {
pthread_cond_wait(&mieq_ready_cond, &mieq_lock);
@@ -126,7 +126,7 @@ void darwinEvents_unlock(void) {
if((err = pthread_mutex_unlock(&mieq_lock))) {
ErrorF("%s:%s:%d: Failed to unlock mieq_lock: %d\n",
__FILE__, __FUNCTION__, __LINE__, err);
- spewCallStack();
+ xorg_backtrace();
}
}
commit d79cc14a51f3e8d4d2f66aad055092672cab1526
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Fri Apr 22 12:05:32 2011 -0700
XQuartz: Fix compilation warnings with XPLUGIN_VERSION >= 4
xprAppleWM.c:143: warning: initialization from incompatible pointer type
xprAppleWM.c:144: warning: initialization from incompatible pointer type
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/applewmExt.h b/hw/xquartz/applewmExt.h
index 5ef8b54..f622f79 100644
--- a/hw/xquartz/applewmExt.h
+++ b/hw/xquartz/applewmExt.h
@@ -32,10 +32,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define _APPLEWMEXT_H_
#include "window.h"
+#include <Xplugin.h>
typedef int (*DisableUpdateProc)(void);
typedef int (*EnableUpdateProc)(void);
typedef int (*SetWindowLevelProc)(WindowPtr pWin, int level);
+#if XPLUGIN_VERSION < 4
typedef int (*FrameGetRectProc)(int type, int class, const BoxRec *outer,
const BoxRec *inner, BoxRec *ret);
typedef int (*FrameHitTestProc)(int class, int x, int y,
@@ -45,6 +47,17 @@ typedef int (*FrameDrawProc)(WindowPtr pWin, int class, unsigned int attr,
const BoxRec *outer, const BoxRec *inner,
unsigned int title_len,
const unsigned char *title_bytes);
+#else
+typedef int (*FrameGetRectProc)(xp_frame_rect type, xp_frame_class class, const BoxRec *outer,
+ const BoxRec *inner, BoxRec *ret);
+typedef int (*FrameHitTestProc)(xp_frame_class class, int x, int y,
+ const BoxRec *outer,
+ const BoxRec *inner, int *ret);
+typedef int (*FrameDrawProc)(WindowPtr pWin, xp_frame_class class, xp_frame_attr attr,
+ const BoxRec *outer, const BoxRec *inner,
+ unsigned int title_len,
+ const unsigned char *title_bytes);
+#endif
typedef int (*SendPSNProc)(uint32_t hi, uint32_t lo);
typedef int (*AttachTransientProc)(WindowPtr pWinChild, WindowPtr pWinParent);
diff --git a/hw/xquartz/xpr/xprAppleWM.c b/hw/xquartz/xpr/xprAppleWM.c
index 21e6f98..b6b9a5f 100644
--- a/hw/xquartz/xpr/xprAppleWM.c
+++ b/hw/xquartz/xpr/xprAppleWM.c
@@ -114,8 +114,8 @@ static int xprAttachTransient(WindowPtr pWinChild, WindowPtr pWinParent) {
static int xprFrameDraw(
WindowPtr pWin,
- int class,
- unsigned int attr,
+ xp_frame_class class,
+ xp_frame_attr attr,
const BoxRec *outer,
const BoxRec *inner,
unsigned int title_len,
commit 6128544fd58ced0ed738b7150865294d214fb4eb
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Mon Apr 25 12:38:07 2011 -0700
XQuartz: Bump bundle version to 2.7.0
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/bundle/Info.plist.cpp b/hw/xquartz/bundle/Info.plist.cpp
index 0e98218..99b184f 100644
--- a/hw/xquartz/bundle/Info.plist.cpp
+++ b/hw/xquartz/bundle/Info.plist.cpp
@@ -19,9 +19,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>2.6.1</string>
+ <string>2.7.0</string>
<key>CFBundleVersion</key>
- <string>2.6.1</string>
+ <string>2.7.0</string>
<key>CFBundleSignature</key>
<string>x11a</string>
<key>CSResourcesFileMapped</key>
commit 4944de24849a109c65f1b353bc12e44e90a1211d
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sat Apr 23 23:25:39 2011 -0700
rootless: Fix a typo in RootlessGlyphs which resulted in a garbage value
Found by clang static analyzer
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/miext/rootless/rootlessScreen.c b/miext/rootless/rootlessScreen.c
index df8d945..0801e72 100644
--- a/miext/rootless/rootlessScreen.c
+++ b/miext/rootless/rootlessScreen.c
@@ -325,7 +325,7 @@ RootlessGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
box.x1 = x - glyph->info.x;
box.y1 = y - glyph->info.y;
box.x2 = box.x1 + glyph->info.width;
- box.y2 = box.y2 + glyph->info.height;
+ box.y2 = box.y1 + glyph->info.height;
x += glyph->info.xOff;
y += glyph->info.yOff;
commit 2098cb03c6b64bfca7694fc2b5213edb77bc12e4
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sat Apr 23 23:27:16 2011 -0700
rootless: Dead code removal
Found by clang static analyzer
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/miext/rootless/rootlessScreen.c b/miext/rootless/rootlessScreen.c
index 510d6fd..df8d945 100644
--- a/miext/rootless/rootlessScreen.c
+++ b/miext/rootless/rootlessScreen.c
@@ -453,7 +453,6 @@ RootlessMarkOverlappedWindows(WindowPtr pWin, WindowPtr pFirst,
pChild = pChild->nextSib;
}
anyMarked = TRUE;
- pFirst = pFirst->nextSib;
}
if (anyMarked)
(* MarkWindow)(pWin->parent);
diff --git a/miext/rootless/rootlessValTree.c b/miext/rootless/rootlessValTree.c
index d242600..9aa8814 100644
--- a/miext/rootless/rootlessValTree.c
+++ b/miext/rootless/rootlessValTree.c
@@ -200,7 +200,6 @@ RootlessComputeClips (WindowPtr pParent, ScreenPtr pScreen,
RegionRec childUnion;
Bool overlap;
RegionPtr borderVisible;
- Bool resized;
/*
* Figure out the new visibility of this window.
* The extent of the universe should be the same as the extent of
@@ -340,7 +339,6 @@ RootlessComputeClips (WindowPtr pParent, ScreenPtr pScreen,
}
borderVisible = pParent->valdata->before.borderVisible;
- resized = pParent->valdata->before.resized;
RegionNull(&pParent->valdata->after.borderExposed);
RegionNull(&pParent->valdata->after.exposed);
commit bb4d145bd25e2aee988b100ecf1105ea3b6a40b8
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sat Apr 23 21:24:27 2011 -0700
glx: Silence warnings when building with clang
This replaces AX_TLS (GPL3) with XORG_TLS (MIT)
In file included from glapi.c:46:
In file included from ./glapi.h:51:
./glthread.h:237:20: error: unknown attribute 'tls_model' ignored [-Werror,-Wunknown-attributes]
__attribute__((tls_model("initial-exec")));
^
In file included from glapi.c:46:
./glapi.h:92:20: error: unknown attribute 'tls_model' ignored [-Werror,-Wunknown-attributes]
__attribute__((tls_model("initial-exec")));
^
glapi.c:82:20: error: unknown attribute 'tls_model' ignored [-Werror,-Wunknown-attributes]
__attribute__((tls_model("initial-exec"))) = NULL;
^
glapi.c:85:20: error: unknown attribute 'tls_model' ignored [-Werror,-Wunknown-attributes]
__attribute__((tls_model("initial-exec")));
^
4 errors generated.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
Tested-by: Jamey Sharp <jamey at minilop.net>
Acked-by: Alan Coopersmith <alan.coopersmith at oracle.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
diff --git a/configure.ac b/configure.ac
index 56e51a4..73bfbaf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -587,7 +587,7 @@ dnl GLX build options
AC_ARG_ENABLE(aiglx, AS_HELP_STRING([--enable-aiglx], [Build accelerated indirect GLX (default: enabled)]),
[AIGLX=$enableval],
[AIGLX=yes])
-AX_TLS
+XORG_TLS
AC_ARG_ENABLE(glx-tls, AS_HELP_STRING([--enable-glx-tls], [Build GLX with TLS support (default: auto)]),
[GLX_USE_TLS=$enableval
if test "x$GLX_USE_TLS" = "xyes" && test "${ac_cv_tls}" = "none" ; then
diff --git a/glx/glapi.c b/glx/glapi.c
index 7cb8495..9e219f6 100644
--- a/glx/glapi.c
+++ b/glx/glapi.c
@@ -78,11 +78,9 @@ static void init_glapi_relocs(void);
/*@{*/
#if defined(GLX_USE_TLS)
-PUBLIC TLS struct _glapi_table * _glapi_tls_Dispatch
- __attribute__((tls_model("initial-exec"))) = NULL;
+PUBLIC TLS struct _glapi_table * _glapi_tls_Dispatch = NULL;
-PUBLIC TLS void * _glapi_tls_Context
- __attribute__((tls_model("initial-exec")));
+PUBLIC TLS void * _glapi_tls_Context;
PUBLIC const struct _glapi_table *_glapi_Dispatch = NULL;
PUBLIC const void *_glapi_Context = NULL;
diff --git a/glx/glapi.h b/glx/glapi.h
index 6521f31..7051c1e 100644
--- a/glx/glapi.h
+++ b/glx/glapi.h
@@ -83,8 +83,7 @@ typedef void (*_glapi_warning_func)(void *ctx, const char *str, ...);
const extern void *_glapi_Context;
const extern struct _glapi_table *_glapi_Dispatch;
-extern TLS void * _glapi_tls_Context
- __attribute__((tls_model("initial-exec")));
+extern TLS void * _glapi_tls_Context;
# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_tls_Context
diff --git a/glx/glthread.h b/glx/glthread.h
index 140e2aa..532401a 100644
--- a/glx/glthread.h
+++ b/glx/glthread.h
@@ -233,8 +233,7 @@ _glthread_SetTSD(_glthread_TSD *, void *);
#if defined(GLX_USE_TLS)
-extern TLS struct _glapi_table * _glapi_tls_Dispatch
- __attribute__((tls_model("initial-exec")));
+extern TLS struct _glapi_table * _glapi_tls_Dispatch;
#define GET_DISPATCH() _glapi_tls_Dispatch
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 14229b4..e473bb7 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -447,7 +447,7 @@
/* Define to 1 if you have the `ffs' function. */
#undef HAVE_FFS
-/* If the compiler supports a TLS storage class define it to that here */
+/* The compiler supported TLS storage class, prefering initial-exec if tls_model is supported */
#undef TLS
/* Correctly set _XSERVER64 for OSX fat binaries */
diff --git a/m4/ax_tls.m4 b/m4/ax_tls.m4
deleted file mode 100644
index 481c3d0..0000000
--- a/m4/ax_tls.m4
+++ /dev/null
@@ -1,74 +0,0 @@
-# ===========================================================================
-# http://www.nongnu.org/autoconf-archive/ax_tls.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-# AX_TLS
-#
-# DESCRIPTION
-#
-# Provides a test for the compiler support of thread local storage (TLS)
-# extensions. Defines TLS if it is found. Currently only knows about GCC
-# and MSVC. I think SunPro uses the same as GCC, and Borland apparently
-# supports either.
-#
-# LICENSE
-#
-# Copyright (c) 2008 Alan Woodland <ajw05 at aber.ac.uk>
-#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation, either version 3 of the License, or (at your
-# option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-# Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# As a special exception, the respective Autoconf Macro's copyright owner
-# gives unlimited permission to copy, distribute and modify the configure
-# scripts that are the output of Autoconf when processing the Macro. You
-# need not follow the terms of the GNU General Public License when using
-# or distributing such scripts, even though portions of the text of the
-# Macro appear in them. The GNU General Public License (GPL) does govern
-# all other use of the material that constitutes the Autoconf Macro.
-#
-# This special exception to the GPL applies to versions of the Autoconf
-# Macro released by the Autoconf Archive. When you make and distribute a
-# modified version of the Autoconf Macro, you may extend this special
-# exception to the GPL to apply to your modified version as well.
-
-AC_DEFUN([AX_TLS], [
- AC_MSG_CHECKING(for thread local storage (TLS) class)
- AC_CACHE_VAL(ac_cv_tls, [
- ax_tls_keywords="__thread __declspec(thread) none"
- for ax_tls_keyword in $ax_tls_keywords; do
- case $ax_tls_keyword in
- none) ac_cv_tls=none ; break ;;
- *)
- AC_TRY_COMPILE(
- [#include <stdlib.h>
- static void
- foo(void) {
- static ] $ax_tls_keyword [ int bar;
- exit(1);
- }],
- [],
- [ac_cv_tls=$ax_tls_keyword ; break],
- ac_cv_tls=none
- )
- esac
- done
-])
-
- if test "$ac_cv_tls" != "none"; then
- dnl AC_DEFINE([TLS], [], [If the compiler supports a TLS storage class define it to that here])
- AC_DEFINE_UNQUOTED([TLS], $ac_cv_tls, [If the compiler supports a TLS storage class define it to that here])
- fi
- AC_MSG_RESULT($ac_cv_tls)
-])
diff --git a/m4/xorg-tls.m4 b/m4/xorg-tls.m4
new file mode 100644
index 0000000..5638504
--- /dev/null
+++ b/m4/xorg-tls.m4
@@ -0,0 +1,57 @@
+dnl Copyright © 2011 Apple Inc.
+dnl
+dnl Permission is hereby granted, free of charge, to any person obtaining a
+dnl copy of this software and associated documentation files (the "Software"),
+dnl to deal in the Software without restriction, including without limitation
+dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
+dnl and/or sell copies of the Software, and to permit persons to whom the
+dnl Software is furnished to do so, subject to the following conditions:
+dnl
+dnl The above copyright notice and this permission notice (including the next
+dnl paragraph) shall be included in all copies or substantial portions of the
+dnl Software.
+dnl
+dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+dnl DEALINGS IN THE SOFTWARE.
+dnl
+dnl Authors: Jeremy Huddleston <jeremyhu at apple.com>
+
+AC_DEFUN([XORG_TLS], [
+ AC_MSG_CHECKING(for thread local storage (TLS) support)
+ AC_CACHE_VAL(ac_cv_tls, [
+ ac_cv_tls=none
+ keywords="__thread __declspec(thread)"
+ for kw in $keywords ; do
+ AC_TRY_COMPILE([int $kw test;], [], ac_cv_tls=$kw)
+ done
+ ])
+ AC_MSG_RESULT($ac_cv_tls)
+
+ if test "$ac_cv_tls" != "none"; then
+ AC_MSG_CHECKING(for tls_model attribute support)
+ AC_CACHE_VAL(ac_cv_tls_model, [
+ save_CFLAGS="$CFLAGS"
+ dnl -Werror causes clang's default -Wunknown-attributes to become an error
+ dnl We can't use -Werror=unknown-attributes because gcc doesn't understand it
+ dnl -Werror=attributes is for gcc, clang seems to ignore it
+ CFLAGS="$CFLAGS -Werror -Werror=attributes"
+ AC_TRY_COMPILE([int $ac_cv_tls __attribute__((tls_model("initial-exec"))) test;], [],
+ ac_cv_tls_model=yes, ac_cv_tls_model=no)
+ CFLAGS="$save_CFLAGS"
+ ])
+ AC_MSG_RESULT($ac_cv_tls_model)
+
+ if test "x$ac_cv_tls_model" = "xyes" ; then
+ xorg_tls=$ac_cv_tls' __attribute__((tls_model("initial-exec")))'
+ else
+ xorg_tls=$ac_cv_tls
+ fi
+
+ AC_DEFINE_UNQUOTED([TLS], $xorg_tls, [The compiler supported TLS storage class, prefering initial-exec if tls_model is supported])
+ fi
+])
commit 5c9eafc8e5f8575c06591d244c2cb5ea07691cb4
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sat Apr 23 20:55:53 2011 -0700
render: Silence warnings when building with clang
picture.c:351:37: error: implicit conversion from 'unsigned int' to 'CARD16' (aka 'unsigned short') changes value from 4294967295 to 65535
[-Werror,-Wconstant-conversion]
pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format));
^~~~~~~~~~~~~~~~~~~~~~~~~~~
...
fatal error: too many errors emitted, stopping now [-ferror-limit=]
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
Suggested-by: Jamey Sharp <jamey at minilop.net>
Reviewed-by: Jamey Sharp <jamey at minilop.net>
diff --git a/render/picture.c b/render/picture.c
index e7e1f2b..1877bfc 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -158,7 +158,7 @@ addFormat (FormatInitRec formats[256],
return ++nformat;
}
-#define Mask(n) ((n) == 32 ? 0xffffffff : ((1 << (n))-1))
+#define Mask(n) ((1 << (n)) - 1)
PictFormatPtr
PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
commit c524f8bb768f886d413839bc22184098394c2559
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sat Apr 23 20:49:27 2011 -0700
os: Silence warnings when building with clang
access.c:1492:20: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses]
if ((host->family == FamilyServerInterpreted)) {
~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
access.c:1492:20: note: use '=' to turn this equality comparison into an assignment
if ((host->family == FamilyServerInterpreted)) {
^~
=
access.c:1492:20: note: remove extraneous parentheses around the comparison to silence this warning
if ((host->family == FamilyServerInterpreted)) {
~ ^ ~
In file included from xstrans.c:8:
In file included from /usr/X11/include/X11/Xtrans/transport.c:62:
/usr/X11/include/X11/Xtrans/Xtranssock.c:262:5: error: implicit declaration of function 'ErrorF' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
PRMSG (3,"SocketSelectFamily(%s)\n", family, 0, 0);
^
log.c:180:29: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
if (asprintf(&logFileName, fname, display) == -1)
^~~~~
log.c:190:26: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
if ((asprintf(&suffix, backup, display) == -1) ||
^~~~~~
log.c:382:25: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
LogVWrite(verb, tmpBuf, args);
^~~~~~
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
Reviewed-by: Jamey Sharp <jamey at minilop.net>
diff --git a/os/access.c b/os/access.c
index 3856e60..b7b1927 100644
--- a/os/access.c
+++ b/os/access.c
@@ -1489,7 +1489,7 @@ InvalidHost (
}
for (host = validhosts; host; host = host->next)
{
- if ((host->family == FamilyServerInterpreted)) {
+ if (host->family == FamilyServerInterpreted) {
if (siAddrMatch (family, addr, len, host, client)) {
return 0;
}
diff --git a/os/log.c b/os/log.c
index 65195ba..9579e58 100644
--- a/os/log.c
+++ b/os/log.c
@@ -102,6 +102,10 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include "xf86bigfontsrv.h"
#endif
+#ifdef __clang__
+#pragma clang diagnostic ignored "-Wformat-nonliteral"
+#endif
+
#ifdef DDXOSVERRORF
void (*OsVendorVErrorFProc)(const char *, va_list args) = NULL;
#endif
diff --git a/os/xstrans.c b/os/xstrans.c
index c086e22..44ff976 100644
--- a/os/xstrans.c
+++ b/os/xstrans.c
@@ -2,6 +2,11 @@
#include <dix-config.h>
#endif
+#include <X11/Xfuncproto.h>
+
+/* ErrorF is used by xtrans */
+extern _X_EXPORT void ErrorF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
+
#define TRANS_REOPEN
#define TRANS_SERVER
#define XSERV_t
commit ab81aa91404ca0fa6843ce8021cbd9de42255a8f
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sat Apr 23 20:39:25 2011 -0700
Xext: Silence warnings when building with clang
xvmain.c:1113:22: warning: equality comparison with extraneous parentheses [-Wparentheses]
if ((pf->depth == pDraw->depth)
~~~~~~~~~~^~~~~~~~~~~~~~~
xvmain.c:1113:22: note: use '=' to turn this equality comparison into an assignment
if ((pf->depth == pDraw->depth)
^~
=
xvmain.c:1113:22: note: remove extraneous parentheses around the comparison to silence this warning
if ((pf->depth == pDraw->depth)
~ ^ ~
1 warning generated.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
Reviewed-by: Jamey Sharp <jamey at minilop.net>
diff --git a/Xext/xvmain.c b/Xext/xvmain.c
index cd6f097..d21a56c 100644
--- a/Xext/xvmain.c
+++ b/Xext/xvmain.c
@@ -1110,12 +1110,7 @@ XvdiMatchPort(
while (nf--)
{
- if ((pf->depth == pDraw->depth)
-#if 0
- && ((pDraw->type == DRAWABLE_PIXMAP) ||
- (wVisual(((WindowPtr)pDraw)) == pf->visual))
-#endif
- )
+ if (pf->depth == pDraw->depth)
return Success;
pf++;
}
commit fd086f87cd1bab53c9e918cb687009e7ac8718d8
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sat Apr 23 20:36:53 2011 -0700
fb: Silence warnings when building with clang
fbpict.c:163:8: warning: implicit conversion from enumeration type 'PictFormatShort' (aka 'enum _PictFormatShort') to different enumeration
type 'pixman_format_code_t' [-Wconversion]
pict->format,
~~~~~~^~~~~~
fbbltone.c:486:2: warning: shift result (281474959933440) requires 49 bits to represent, but 'int' only has 32 bits [-Wshift-overflow]
C2_24( 0, 0), C2_24 ( 1, 0), C2_24 ( 2, 0), C2_24 ( 3, 0),
^~~~~~~~~~~~
fbbltone.c:474:6: note: instantiated from:
SelMask24(b,1,r))
^
fbbltone.c:429:46: note: instantiated from:
^
fbbltone.c:427:18: note: instantiated from:
0xffffff << Mask24Check(x,r)) : 0)
~~~~~~~~ ^
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
Reviewed-by: Jamey Sharp <jamey at minilop.net>
diff --git a/fb/fbbltone.c b/fb/fbbltone.c
index 629b13a..0a91575 100644
--- a/fb/fbbltone.c
+++ b/fb/fbbltone.c
@@ -26,6 +26,11 @@
#include "fb.h"
+#ifdef __clang__
+/* shift overflow is intentional */
+#pragma clang diagnostic ignored "-Wshift-overflow"
+#endif
+
/*
* Example: srcX = 13 dstX = 8 (FB unit 32 dstBpp 8)
*
diff --git a/fb/fbpict.c b/fb/fbpict.c
index 133f422..d1fd0cb 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -160,7 +160,7 @@ create_bits_picture (PicturePtr pict,
fbGetPixmapBitsData(pixmap, bits, stride, bpp);
image = pixman_image_create_bits (
- pict->format,
+ (pixman_format_code_t)pict->format,
pixmap->drawable.width, pixmap->drawable.height,
(uint32_t *)bits, stride * sizeof (FbStride));
commit aad7b324aefc906f28ac9d10c64650b3445c2ae0
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sun Apr 24 19:57:22 2011 -0700
os: Add missing _X_ATTRIBUTE_PRINTF to va_list variants
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/include/os.h b/include/os.h
index d747040..506dc5d 100644
--- a/include/os.h
+++ b/include/os.h
@@ -510,17 +510,17 @@ typedef enum {
extern _X_EXPORT const char *LogInit(const char *fname, const char *backup);
extern _X_EXPORT void LogClose(void);
extern _X_EXPORT Bool LogSetParameter(LogParameter param, int value);
-extern _X_EXPORT void LogVWrite(int verb, const char *f, va_list args);
+extern _X_EXPORT void LogVWrite(int verb, const char *f, va_list args) _X_ATTRIBUTE_PRINTF(2,0);
extern _X_EXPORT void LogWrite(int verb, const char *f, ...) _X_ATTRIBUTE_PRINTF(2,3);
extern _X_EXPORT void LogVMessageVerb(MessageType type, int verb, const char *format,
- va_list args);
+ va_list args) _X_ATTRIBUTE_PRINTF(3,0);
extern _X_EXPORT void LogMessageVerb(MessageType type, int verb, const char *format,
...) _X_ATTRIBUTE_PRINTF(3,4);
extern _X_EXPORT void LogMessage(MessageType type, const char *format, ...)
_X_ATTRIBUTE_PRINTF(2,3);
extern _X_EXPORT void FreeAuditTimer(void);
extern _X_EXPORT void AuditF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
-extern _X_EXPORT void VAuditF(const char *f, va_list args);
+extern _X_EXPORT void VAuditF(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1,0);
extern _X_EXPORT void FatalError(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_NORETURN;
#ifdef DEBUG
@@ -529,7 +529,7 @@ extern _X_EXPORT void FatalError(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2) _X
#define DebugF(...) /* */
#endif
-extern _X_EXPORT void VErrorF(const char *f, va_list args);
+extern _X_EXPORT void VErrorF(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1,0);
extern _X_EXPORT void ErrorF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
extern _X_EXPORT void Error(const char *str);
extern _X_EXPORT void LogPrintMarkers(void);
commit 5423da9fb2ec0dfeff866f12cf26fbba04ea673d
Author: Nicolas Kaiser <nikai at nikai.net>
Date: Sun Apr 24 12:44:15 2011 +0200
xkb: remove duplicated include
Remove duplicated include.
Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
Reviewed-by: Matthieu Herrb <matthieu.herrb at laas.fr>
diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c
index c020e5e..7f91e9a 100644
--- a/xkb/xkbEvents.c
+++ b/xkb/xkbEvents.c
@@ -38,7 +38,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "exevents.h"
#include "exglobals.h"
#include "windowstr.h"
-#include "exevents.h"
#include <xkbsrv.h>
#include "xkb.h"
commit 79b3a7f83d7cbee397eecebef1af31c048d295e8
Author: Nicolas Kaiser <nikai at nikai.net>
Date: Sun Apr 24 12:43:05 2011 +0200
test/xi2: remove duplicated include
Remove duplicated include.
Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
Reviewed-by: Matthieu Herrb <matthieu.herrb at laas.fr>
diff --git a/test/xi2/protocol-common.h b/test/xi2/protocol-common.h
index 18c61e6..b55f57c 100644
--- a/test/xi2/protocol-common.h
+++ b/test/xi2/protocol-common.h
@@ -27,7 +27,6 @@
#include "scrnintstr.h"
#include "windowstr.h"
-#include "scrnintstr.h"
#include "exevents.h"
#include <assert.h>
commit a17c30d43e0db6c65cc73cd2be5193c02f138bf5
Author: Nicolas Kaiser <nikai at nikai.net>
Date: Sun Apr 24 12:42:07 2011 +0200
hw/xwin: remove duplicated includes
Remove duplicated includes.
Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index 3f40fdb..9bee9b6 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -172,7 +172,6 @@
#include "input.h"
#include "mipointer.h"
#include "X11/keysym.h"
-#include "mibstore.h"
#include "micoord.h"
#include "dix.h"
#include "miline.h"
diff --git a/hw/xwin/winmultiwindowicons.c b/hw/xwin/winmultiwindowicons.c
index 1ca3f91..534f6fd 100644
--- a/hw/xwin/winmultiwindowicons.c
+++ b/hw/xwin/winmultiwindowicons.c
@@ -37,8 +37,6 @@
#include "winprefs.h"
#include "propertyst.h"
-
-#include "propertyst.h"
#include "windowstr.h"
diff --git a/hw/xwin/winvideo.c b/hw/xwin/winvideo.c
index 0438e5f..ed20544 100644
--- a/hw/xwin/winvideo.c
+++ b/hw/xwin/winvideo.c
@@ -69,8 +69,6 @@ winInitVideo (ScreenPtr pScreen)
#include <X11/extensions/Xv.h>
#endif
-#include "win.h"
-
#if 0
commit c270cfc30c547e28017533f490904013f73cf6f0
Author: Nicolas Kaiser <nikai at nikai.net>
Date: Sun Apr 24 12:41:11 2011 +0200
hw/xquartz: remove duplicated includes
Remove duplicated includes.
Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index 32fb12a..6da27c7 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -139,7 +139,6 @@
#include <glxcontext.h>
#include <glxext.h>
#include <glxutil.h>
-#include <glxscreens.h>
#include <GL/internal/glcore.h>
#include "x-hash.h"
#include "x-list.h"
diff --git a/hw/xquartz/GL/visualConfigs.c b/hw/xquartz/GL/visualConfigs.c
index b209b76..2c2a9a2 100644
--- a/hw/xquartz/GL/visualConfigs.c
+++ b/hw/xquartz/GL/visualConfigs.c
@@ -51,7 +51,6 @@
#include <glxcontext.h>
#include <glxext.h>
#include <glxutil.h>
-#include <glxscreens.h>
#include <GL/internal/glcore.h>
#include "capabilities.h"
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index e56bf0c..83b5601 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -41,7 +41,6 @@
#include "quartz.h"
#include "darwinEvents.h"
#include "quartzKeyboard.h"
-#include "quartz.h"
#include <X11/extensions/applewmconst.h>
#include "micmap.h"
#include "exglobals.h"
diff --git a/hw/xquartz/quartzKeyboard.h b/hw/xquartz/quartzKeyboard.h
index 1151a00..de4aed8 100644
--- a/hw/xquartz/quartzKeyboard.h
+++ b/hw/xquartz/quartzKeyboard.h
@@ -32,8 +32,6 @@
#include "X11/keysym.h"
#include "inputstr.h"
-#include <pthread.h>
-
// Each key can generate 4 glyphs. They are, in order:
// unshifted, shifted, modeswitch unshifted, modeswitch shifted
#define GLYPHS_PER_KEY 4
commit 50ced6cfa0aef472e713ffccfdba003829df68df
Author: Nicolas Kaiser <nikai at nikai.net>
Date: Sun Apr 24 12:40:11 2011 +0200
hw/xnest: remove duplicated include
Remove duplicated include.
Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
Reviewed-by: Matthieu Herrb <matthieu.herrb at laas.fr>
diff --git a/hw/xnest/Pixmap.c b/hw/xnest/Pixmap.c
index 3a92ffd..eccf569 100644
--- a/hw/xnest/Pixmap.c
+++ b/hw/xnest/Pixmap.c
@@ -21,7 +21,6 @@ is" without express or implied warranty.
#include "regionstr.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
-#include "regionstr.h"
#include "gc.h"
#include "servermd.h"
#include "privates.h"
commit 387f45a7077faadf232edc3f608c4a081a7fd290
Author: Nicolas Kaiser <nikai at nikai.net>
Date: Sun Apr 24 12:39:11 2011 +0200
hw/xfree86/modes: remove duplicated include
Remove duplicated include.
Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
Reviewed-by: Matthieu Herrb <matthieu.herrb at laas.fr>
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 2ebe0ae..cb20d1c 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -31,7 +31,6 @@
#include "xf86.h"
#include "os.h"
#include "globals.h"
-#include "xf86.h"
#include "xf86Priv.h"
#include "xf86DDC.h"
#include "mipointer.h"
commit 78a9ec125dcb1546ca7e7e18aedf2b323eebb1fc
Author: Nicolas Kaiser <nikai at nikai.net>
Date: Sun Apr 24 12:38:08 2011 +0200
hw/xfree86/fbdevhw: remove duplicated include
Remove duplicated include.
Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
Reviewed-by: Matthieu Herrb <matthieu.herrb at laas.fr>
diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c
index 17fba36..dee731b 100644
--- a/hw/xfree86/fbdevhw/fbdevhw.c
+++ b/hw/xfree86/fbdevhw/fbdevhw.c
@@ -48,7 +48,6 @@ _X_EXPORT XF86ModuleData fbdevhwModuleData = {
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <string.h>
/* -------------------------------------------------------------------- */
/* our private data, and two functions to allocate/free this */
commit 0320db25f917980621107b790c4fc5171cb0b6ac
Author: Nicolas Kaiser <nikai at nikai.net>
Date: Sun Apr 24 12:36:48 2011 +0200
hw/xfree86/dri: remove duplicated includes
Remove duplicated includes.
Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
Reviewed-by: Matthieu Herrb <matthieu.herrb at laas.fr>
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index bb5482a..1726960 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -63,8 +63,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "dri.h"
#include "sarea.h"
#include "dristruct.h"
-#include "xf86.h"
-#include "xf86drm.h"
#include "mi.h"
#include "mipointer.h"
#include "xf86_OSproc.h"
diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c
index 20baa24..e02644a 100644
--- a/hw/xfree86/dri/xf86dri.c
+++ b/hw/xfree86/dri/xf86dri.c
@@ -58,7 +58,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "dri.h"
#include "sarea.h"
#include "dristruct.h"
-#include "xf86.h"
#include "xf86drm.h"
#include "protocol-versions.h"
commit b56271b954d6ab8eeb320f314925b77403458b9c
Author: Nicolas Kaiser <nikai at nikai.net>
Date: Sun Apr 24 12:35:45 2011 +0200
hw/xfree86/ddc: remove duplicated include
Remove duplicated include.
Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
Reviewed-by: Matthieu Herrb <matthieu.herrb at laas.fr>
diff --git a/hw/xfree86/ddc/ddcProperty.c b/hw/xfree86/ddc/ddcProperty.c
index d2d90ba..5d6eec9 100644
--- a/hw/xfree86/ddc/ddcProperty.c
+++ b/hw/xfree86/ddc/ddcProperty.c
@@ -30,7 +30,6 @@
#include <X11/Xatom.h>
#include "property.h"
#include "propertyst.h"
-#include "xf86DDC.h"
#include <string.h>
#define EDID1_ATOM_NAME "XFree86_DDC_EDID1_RAWDATA"
commit 86c0c8b9c567f57fe7477d5302fa22dc7557ce90
Author: Nicolas Kaiser <nikai at nikai.net>
Date: Sun Apr 24 12:34:46 2011 +0200
dix: remove duplicated includes
Remove duplicated includes.
Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
Reviewed-by: Matthieu Herrb <matthieu.herrb at laas.fr>
diff --git a/dix/events.c b/dix/events.c
index 8835c5e..d70d62f 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -138,7 +138,6 @@ typedef const char *string;
#include <X11/extensions/XI2.h>
#include "exglobals.h"
#include "exevents.h"
-#include "exglobals.h"
#include "extnsionst.h"
#include "dixevents.h"
diff --git a/dix/getevents.c b/dix/getevents.c
index 0fa8046..4267b61 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -61,7 +61,6 @@
#include <pixman.h>
#include "exglobals.h"
#include "exevents.h"
-#include "exglobals.h"
#include "extnsionst.h"
#include "listdev.h" /* for sizing up DeviceClassesChangedEvent */
commit 9b5046d2130aead79956019faf7103b5c676fd02
Author: Nicolas Kaiser <nikai at nikai.net>
Date: Sun Apr 24 12:33:32 2011 +0200
Xi: remove duplicated includes
Remove duplicated includes.
Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
Reviewed-by: Matthieu Herrb <matthieu.herrb at laas.fr>
diff --git a/Xi/extinit.c b/Xi/extinit.c
index 51e0078..0905e18 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -84,7 +84,6 @@ SOFTWARE.
#include "closedev.h"
#include "devbell.h"
#include "getbmap.h"
-#include "getbmap.h"
#include "getdctl.h"
#include "getfctl.h"
#include "getfocus.h"
@@ -93,7 +92,6 @@ SOFTWARE.
#include "getprop.h"
#include "getselev.h"
#include "getvers.h"
-#include "getvers.h"
#include "grabdev.h"
#include "grabdevb.h"
#include "grabdevk.h"
commit c6cb70be1ed7cf73bd3411b8d66ec05a9efcfeb9
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date: Mon Mar 28 13:30:52 2011 -0400
Fix trapezoid and triangle rendering to windows
For fbAdd{Traps,Triangles}() and fbRasterizeTrapezoid() this is just a
matter of adding the image offsets to the trap offsets.
For fbShapes, the story is more complicated:
The recently added pixman API did not allow offsetting
trapezoids. Instead, it would use x_dst and y_dst in such a way that
the effect was to only offset the source image.
In pixman 0.21.8, this API has changed such that all the traps are
conceptually rendered to an infinitely big image, and the source and
destination coordinates are then aligned with (0, 0) of that
image. This means offsetting dst_x and dst_y will now offset the
entire drawing, which is similar to how other composite functions
work.
This patch then changes fbComposite{Triangles,Traps} such that the
source image is aligned with the shapes, and the destination
coordinates offset according to drawable->{x, y}.
Reviewed-by: Keith Packard <keithp at keithp.com>
Signed-off-by: Soren Sandmann <ssp at redhat.com>
diff --git a/configure.ac b/configure.ac
index 56e51a4..e2b3fa6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -797,7 +797,7 @@ LIBPCIACCESS="pciaccess >= 0.8.0"
LIBUDEV="libudev >= 143"
LIBSELINUX="libselinux >= 2.0.86"
LIBDBUS="dbus-1 >= 1.0"
-LIBPIXMAN="pixman-1 >= 0.21.6"
+LIBPIXMAN="pixman-1 >= 0.21.8"
dnl Pixman is always required, but we separate it out so we can link
dnl specific modules against it
diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index b5c5a61..0b5a638 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -38,13 +38,14 @@ fbAddTraps (PicturePtr pPicture,
int ntrap,
xTrap *traps)
{
- int image_xoff, image_yoff;
- pixman_image_t *image = image_from_pict (pPicture, FALSE, &image_xoff, &image_yoff);
+ pixman_image_t *image;
+ int dst_xoff, dst_yoff;
- if (!image)
+ if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
return;
- pixman_add_traps (image, x_off, y_off, ntrap, (pixman_trap_t *)traps);
+ pixman_add_traps (image, x_off + dst_xoff, y_off + dst_yoff,
+ ntrap, (pixman_trap_t *)traps);
free_pixman_pict (pPicture, image);
}
@@ -55,13 +56,15 @@ fbRasterizeTrapezoid (PicturePtr pPicture,
int x_off,
int y_off)
{
- int mask_xoff, mask_yoff;
- pixman_image_t *image = image_from_pict (pPicture, FALSE, &mask_xoff, &mask_yoff);
+ pixman_image_t *image;
+ int dst_xoff, dst_yoff;
- if (!image)
+ if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
return;
- pixman_rasterize_trapezoid (image, (pixman_trapezoid_t *)trap, x_off, y_off);
+ pixman_rasterize_trapezoid (image, (pixman_trapezoid_t *)trap,
+ x_off + dst_xoff,
+ y_off + dst_yoff);
free_pixman_pict (pPicture, image);
}
@@ -73,14 +76,15 @@ fbAddTriangles (PicturePtr pPicture,
int ntri,
xTriangle *tris)
{
- int image_xoff, image_yoff;
- pixman_image_t *image =
- image_from_pict (pPicture, FALSE, &image_xoff, &image_yoff);
+ pixman_image_t *image;
+ int dst_xoff, dst_yoff;
- if (!image)
+ if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
return;
- pixman_add_triangles (image, x_off, y_off, ntri, (pixman_triangle_t *)tris);
+ pixman_add_triangles (image,
+ dst_xoff + x_off, dst_yoff + y_off,
+ ntri, (pixman_triangle_t *)tris);
free_pixman_pict (pPicture, image);
}
@@ -101,8 +105,6 @@ fbShapes (CompositeShapesFunc composite,
PictFormatPtr maskFormat,
int16_t xSrc,
int16_t ySrc,
- int16_t xDst,
- int16_t yDst,
int nshapes,
int shape_size,
const uint8_t * shapes)
@@ -136,8 +138,8 @@ fbShapes (CompositeShapesFunc composite,
composite (op, src, dst, format,
xSrc + src_xoff,
ySrc + src_yoff,
- xDst + dst_xoff,
- yDst + dst_yoff,
+ dst_xoff,
+ dst_yoff,
1, shapes + i * shape_size);
}
}
@@ -162,8 +164,8 @@ fbShapes (CompositeShapesFunc composite,
composite (op, src, dst, format,
xSrc + src_xoff,
ySrc + src_yoff,
- xDst + dst_xoff,
- yDst + dst_yoff,
+ dst_xoff,
+ dst_yoff,
nshapes, shapes);
}
@@ -184,14 +186,12 @@ fbTrapezoids (CARD8 op,
int ntrap,
xTrapezoid *traps)
{
- int xDst, yDst;
-
- xDst = traps[0].left.p1.x >> 16;
- yDst = traps[0].left.p1.y >> 16;
+ xSrc -= (traps[0].left.p1.x >> 16);
+ ySrc -= (traps[0].left.p1.y >> 16);
fbShapes ((CompositeShapesFunc)pixman_composite_trapezoids,
op, pSrc, pDst, maskFormat,
- xSrc, ySrc, xDst, yDst,
+ xSrc, ySrc,
ntrap, sizeof (xTrapezoid), (const uint8_t *)traps);
}
@@ -205,13 +205,11 @@ fbTriangles (CARD8 op,
int ntris,
xTriangle *tris)
{
- int xDst, yDst;
-
- xDst = tris[0].p1.x >> 16;
- yDst = tris[0].p1.y >> 16;
+ xSrc -= (tris[0].p1.x >> 16);
+ ySrc -= (tris[0].p1.y >> 16);
fbShapes ((CompositeShapesFunc)pixman_composite_triangles,
op, pSrc, pDst, maskFormat,
- xSrc, ySrc, xDst, yDst,
+ xSrc, ySrc,
ntris, sizeof (xTriangle), (const uint8_t *)tris);
}
commit 1b96a99d8edd9016bc4a35348f9d5ddb45832f14
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date: Thu Mar 10 08:52:41 2011 -0500
fb: Call miCompositeSourceValidate() on the source in fbShapes()
Reviewed-by: Keith Packard <keithp at keithp.com>
Signed-off-by: Soren Sandmann <ssp at redhat.com>
diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index 612fae7..b5c5a61 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -111,6 +111,8 @@ fbShapes (CompositeShapesFunc composite,
int src_xoff, src_yoff;
int dst_xoff, dst_yoff;
+ miCompositeSourceValidate (pSrc);
+
src = image_from_pict (pSrc, FALSE, &src_xoff, &src_yoff);
dst = image_from_pict (pDst, TRUE, &dst_xoff, &dst_yoff);
commit 04635069554859ec67003b89f56965421cba7f52
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date: Tue Mar 29 00:11:00 2011 -0400
render: Remove unused TriStrip and TriFan typedefs
Reviewed-by: Keith Packard <keithp at keithp.com>
Signed-off-by: Soren Sandmann <ssp at redhat.com>
diff --git a/render/picturestr.h b/render/picturestr.h
index c536c38..7b7f911 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -260,24 +260,6 @@ typedef void (*TrianglesProcPtr) (CARD8 op,
int ntri,
xTriangle *tris);
-typedef void (*TriStripProcPtr) (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoint,
- xPointFixed *points);
-
-typedef void (*TriFanProcPtr) (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoint,
- xPointFixed *points);
-
typedef Bool (*InitIndexedProcPtr) (ScreenPtr pScreen,
PictFormatPtr pFormat);
commit 2b0cabec620f3a2a5e431052441b092ef979bf94
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date: Tue Mar 29 00:07:44 2011 -0400
render: Remove unused fields in the source picture structs
The fields class, stopRange, colorTable and colorTableSize are not
used by any current code.
Reviewed-by: Keith Packard <keithp at keithp.com>
Signed-off-by: Soren Sandmann <ssp at redhat.com>
diff --git a/render/picture.c b/render/picture.c
index 058db2b..49e83ed 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -843,11 +843,6 @@ static void initGradient(SourcePictPtr pGradient, int stopCount,
pGradient->gradient.stops[i].x = stopPoints[i];
pGradient->gradient.stops[i].color = stopColors[i];
}
-
- pGradient->gradient.class = SourcePictClassUnknown;
- pGradient->gradient.stopRange = 0xffff;
- pGradient->gradient.colorTable = NULL;
- pGradient->gradient.colorTableSize = 0;
}
static PicturePtr createSourcePicture(void)
@@ -922,8 +917,6 @@ CreateLinearGradientPicture (Picture pid, xPointFixed *p1, xPointFixed *p2,
return pPicture;
}
-#define FixedToDouble(x) ((x)/65536.)
-
PicturePtr
CreateRadialGradientPicture (Picture pid, xPointFixed *inner, xPointFixed *outer,
xFixed innerRadius, xFixed outerRadius,
@@ -959,12 +952,6 @@ CreateRadialGradientPicture (Picture pid, xPointFixed *inner, xPointFixed *outer
radial->c2.x = outer->x;
radial->c2.y = outer->y;
radial->c2.radius = outerRadius;
- radial->cdx = (radial->c2.x - radial->c1.x) / 65536.;
- radial->cdy = (radial->c2.y - radial->c1.y) / 65536.;
- radial->dr = (radial->c2.radius - radial->c1.radius) / 65536.;
- radial->A = ( radial->cdx * radial->cdx
- + radial->cdy * radial->cdy
- - radial->dr * radial->dr);
initGradient(pPicture->pSourcePict, nStops, stops, colors, error);
if (*error) {
diff --git a/render/picturestr.h b/render/picturestr.h
index 8b387f7..c536c38 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -65,13 +65,8 @@ typedef struct pixman_transform PictTransform, *PictTransformPtr;
#define SourcePictTypeRadial 2
#define SourcePictTypeConical 3
-#define SourcePictClassUnknown 0
-#define SourcePictClassHorizontal 1
-#define SourcePictClassVertical 2
-
typedef struct _PictSolidFill {
unsigned int type;
- unsigned int class;
CARD32 color;
} PictSolidFill, *PictSolidFillPtr;
@@ -82,22 +77,14 @@ typedef struct _PictGradientStop {
typedef struct _PictGradient {
unsigned int type;
- unsigned int class;
int nstops;
PictGradientStopPtr stops;
- int stopRange;
- CARD32 *colorTable;
- int colorTableSize;
} PictGradient, *PictGradientPtr;
typedef struct _PictLinearGradient {
unsigned int type;
- unsigned int class;
int nstops;
PictGradientStopPtr stops;
- int stopRange;
- CARD32 *colorTable;
- int colorTableSize;
xPointFixed p1;
xPointFixed p2;
} PictLinearGradient, *PictLinearGradientPtr;
@@ -110,28 +97,16 @@ typedef struct _PictCircle {
typedef struct _PictRadialGradient {
unsigned int type;
- unsigned int class;
int nstops;
PictGradientStopPtr stops;
- int stopRange;
- CARD32 *colorTable;
- int colorTableSize;
PictCircle c1;
PictCircle c2;
- double cdx;
- double cdy;
- double dr;
- double A;
} PictRadialGradient, *PictRadialGradientPtr;
typedef struct _PictConicalGradient {
unsigned int type;
- unsigned int class;
int nstops;
PictGradientStopPtr stops;
- int stopRange;
- CARD32 *colorTable;
- int colorTableSize;
xPointFixed center;
xFixed angle;
} PictConicalGradient, *PictConicalGradientPtr;
commit b0d84f94393edab395d65d2b2cb983fc9fec3d36
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date: Mon Mar 28 20:59:34 2011 -0400
render: Delete PictureGradientColor()
PictureGradientColor(), INTERPOLATE_PIXEL_256() and premultiply() are
not used by anything.
Reviewed-by: Keith Packard <keithp at keithp.com>
Signed-off-by: Soren Sandmann <ssp at redhat.com>
diff --git a/render/picture.c b/render/picture.c
index e7e1f2b..058db2b 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -811,51 +811,6 @@ static CARD32 xRenderColorToCard32(xRenderColor c)
(c.blue >> 8);
}
-static unsigned int premultiply(unsigned int x)
-{
- unsigned int a = x >> 24;
- unsigned int t = (x & 0xff00ff) * a + 0x800080;
- t = (t + ((t >> 8) & 0xff00ff)) >> 8;
- t &= 0xff00ff;
-
- x = ((x >> 8) & 0xff) * a + 0x80;
- x = (x + ((x >> 8) & 0xff));
- x &= 0xff00;
- x |= t | (a << 24);
- return x;
-}
-
-static unsigned int INTERPOLATE_PIXEL_256(unsigned int x, unsigned int a,
- unsigned int y, unsigned int b)
-{
- CARD32 t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
- t >>= 8;
- t &= 0xff00ff;
-
- x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b;
- x &= 0xff00ff00;
- x |= t;
- return x;
-}
-
-CARD32
-PictureGradientColor (PictGradientStopPtr stop1,
- PictGradientStopPtr stop2,
- CARD32 x)
-{
- CARD32 current_color, next_color;
- int dist, idist;
-
- current_color = xRenderColorToCard32 (stop1->color);
- next_color = xRenderColorToCard32 (stop2->color);
-
- dist = (int) (256 * (x - stop1->x) / (stop2->x - stop1->x));
- idist = 256 - dist;
-
- return premultiply (INTERPOLATE_PIXEL_256 (current_color, idist,
- next_color, dist));
-}
-
static void initGradient(SourcePictPtr pGradient, int stopCount,
xFixed *stopPoints, xRenderColor *stopColors, int *error)
{
diff --git a/render/picturestr.h b/render/picturestr.h
index 7c7edb1..8b387f7 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -614,11 +614,6 @@ CompositeTriFan (CARD8 op,
int npoints,
xPointFixed *points);
-extern _X_EXPORT CARD32
-PictureGradientColor (PictGradientStopPtr stop1,
- PictGradientStopPtr stop2,
- CARD32 x);
-
extern _X_EXPORT void RenderExtensionInit (void);
Bool
commit 61a92a78cd49969f74a046fa26c3199e06365814
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date: Tue Mar 29 13:06:36 2011 -0400
Add RegionInitBoxes(), and fix some buggy callers of RegionInit().
The interface to RegionInit():
RegionInit (RegionPtr pReg, BoxPtr rect, int size);
is very confusing because it doesn't take a list of boxes, it takes
*one* box, but if that box is NULL, it initializes an empty region
with 'size' rectangles preallocated.
Most callers of this function were correctly passing either NULL or
just one box, but there were three confused cases, where the code
seems to expect a region to be created from a list of boxes.
This patch adds a new function RegionInitBoxes() and fixes those
instances to call that instead.
And yes, the pixman function to initialize a region from a list of
boxes is called init_rects() because pixman is also awesome.
V2: Make RegionInitBoxes() return a Bool indicating whether the call
succeeded, and fix the callers to check this return value.
Reviewed-by: Keith Packard <keithp at keithp.com>
Signed-off-by: Søren Sandmann <ssp at redhat.com>
diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c
index bd533c4..078b91c 100644
--- a/exa/exa_unaccel.c
+++ b/exa/exa_unaccel.c
@@ -127,11 +127,10 @@ ExaCheckCopyNtoN (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
EXA_FALLBACK(("from %p to %p (%c,%c)\n", pSrc, pDst,
exaDrawableLocation(pSrc), exaDrawableLocation(pDst)));
- if (pExaScr->prepare_access_reg) {
+ if (pExaScr->prepare_access_reg && RegionInitBoxes(®, pbox, nbox)) {
PixmapPtr pPixmap = exaGetDrawablePixmap(pSrc);
exaGetDrawableDeltas(pSrc, pPixmap, &xoff, &yoff);
- RegionInit(®, pbox, nbox);
RegionTranslate(®, xoff + dx, yoff + dy);
pExaScr->prepare_access_reg(pPixmap, EXA_PREPARE_SRC, ®);
RegionUninit(®);
@@ -140,11 +139,11 @@ ExaCheckCopyNtoN (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
if (pExaScr->prepare_access_reg &&
!exaGCReadsDestination(pDst, pGC->planemask, pGC->fillStyle,
- pGC->alu, pGC->clientClipType)) {
+ pGC->alu, pGC->clientClipType) &&
+ RegionInitBoxes (®, pbox, nbox)) {
PixmapPtr pPixmap = exaGetDrawablePixmap(pDst);
exaGetDrawableDeltas(pSrc, pPixmap, &xoff, &yoff);
- RegionInit(®, pbox, nbox);
RegionTranslate(®, xoff, yoff);
pExaScr->prepare_access_reg(pPixmap, EXA_PREPARE_DEST, ®);
RegionUninit(®);
diff --git a/glx/glxdri.c b/glx/glxdri.c
index c87ac9a..244eac6 100644
--- a/glx/glxdri.c
+++ b/glx/glxdri.c
@@ -817,10 +817,19 @@ static void __glXReportDamage(__DRIdrawable *driDraw,
__glXenterServer(GL_FALSE);
- RegionInit(®ion, (BoxPtr) rects, num_rects);
- RegionTranslate(®ion, pDraw->x, pDraw->y);
- DamageDamageRegion(pDraw, ®ion);
- RegionUninit(®ion);
+ if (RegionInitBoxes(®ion, (BoxPtr) rects, num_rects)) {
+ RegionTranslate(®ion, pDraw->x, pDraw->y);
+ DamageDamageRegion(pDraw, ®ion);
+ RegionUninit(®ion);
+ }
+ else {
+ while (num_rects--) {
+ RegionInit (®ion, (BoxPtr) rects++, 1);
+ RegionTranslate(®ion, pDraw->x, pDraw->y);
+ DamageDamageRegion(pDraw, ®ion);
+ RegionUninit(®ion);
+ }
+ }
__glXleaveServer(GL_FALSE);
}
diff --git a/include/regionstr.h b/include/regionstr.h
index 3759fe1..3dfef5c 100644
--- a/include/regionstr.h
+++ b/include/regionstr.h
@@ -132,6 +132,11 @@ static inline void RegionInit(RegionPtr _pReg, BoxPtr _rect, int _size)
}
}
+static inline Bool RegionInitBoxes(RegionPtr pReg, BoxPtr boxes, int nBoxes)
+{
+ return pixman_region_init_rects (pReg, boxes, nBoxes);
+}
+
static inline void RegionUninit(RegionPtr _pReg)
{
if ((_pReg)->data && (_pReg)->data->size) {
commit c7bce22b58530239e583d91ae56312bad1630da4
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date: Mon Mar 28 11:38:11 2011 -0400
Track damage for fbTrapezoids() and fbTriangles().
These calls no longer go through the CompositePicture() hook, so
damage was no longer generated for them. This patch simply damages the
entire destination clip region.
It would be possible to generate tighter damage for certain operators
such as Over and Add, where blank source pixels have no effect on the
destination, but given that virtually all trapezoid rendering takes
place on pixmaps, it's unlikely that anybody would actually benefit
from this optimization, and the miTrapezoidBounds function did
sometimes show up on profiles, probably because it does several
divisions per trapezoid.
V2: Call DamageRegionProcessPending() - pointed out by Michel Dänzer.
V3: Call DamageRegionProcessPending() *after* rendering -
pointed out by Maarten Maathuis
Reviewed-by: Michel Dänzer <daenzer at vmware.com>
Signed-off-by: Søren Sandmann <ssp at redhat.com>
diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index 2554fcc..612fae7 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -29,6 +29,7 @@
#include "picturestr.h"
#include "mipict.h"
#include "fbpict.h"
+#include "damage.h"
void
fbAddTraps (PicturePtr pPicture,
@@ -117,6 +118,8 @@ fbShapes (CompositeShapesFunc composite,
{
pixman_format_code_t format;
+ DamageRegionAppend (pDst->pDrawable, pDst->pCompositeClip);
+
if (!maskFormat)
{
int i;
@@ -161,6 +164,8 @@ fbShapes (CompositeShapesFunc composite,
yDst + dst_yoff,
nshapes, shapes);
}
+
+ DamageRegionProcessPending (pDst->pDrawable);
}
free_pixman_pict (pSrc, src);
More information about the Xquartz-changes
mailing list