Merge branch 'origin' into input-hotplug

This commit is contained in:
Daniel Stone 2006-08-18 17:05:50 +03:00 committed by Daniel Stone
commit 1c2cb30cd8
5 changed files with 113 additions and 85 deletions

View File

@ -87,6 +87,9 @@ static char *DFLT_MOUSE_DEV = "/dev/devi/mouse0";
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
static char *DFLT_MOUSE_DEV = "/dev/sysmouse"; static char *DFLT_MOUSE_DEV = "/dev/sysmouse";
static char *DFLT_MOUSE_PROTO = "auto"; static char *DFLT_MOUSE_PROTO = "auto";
#elif defined(linux)
static char DFLT_MOUSE_DEV[] = "/dev/input/mice";
static char DFLT_MOUSE_PROTO[] = "auto";
#else #else
static char *DFLT_MOUSE_DEV = "/dev/mouse"; static char *DFLT_MOUSE_DEV = "/dev/mouse";
static char *DFLT_MOUSE_PROTO = "auto"; static char *DFLT_MOUSE_PROTO = "auto";

View File

@ -47,6 +47,22 @@
#include "xf86Priv.h" #include "xf86Priv.h"
#include "xf86DDC.h" #include "xf86DDC.h"
static void
printModeRejectMessage(int index, DisplayModePtr p, int status)
{
char *type;
if (p->type & M_T_BUILTIN)
type = "built-in ";
else if (p->type & M_T_DEFAULT)
type = "default ";
else
type = "";
xf86DrvMsg(index, X_INFO, "Not using %smode \"%s\" (%s)\n", type, p->name,
xf86ModeStatusToString(status));
}
/* /*
* xf86GetNearestClock -- * xf86GetNearestClock --
* Find closest clock to given frequency (in kHz). This assumes the * Find closest clock to given frequency (in kHz). This assumes the
@ -1644,18 +1660,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
q->name = xnfstrdup(p->name); q->name = xnfstrdup(p->name);
q->status = MODE_OK; q->status = MODE_OK;
} else { } else {
if (p->type & M_T_BUILTIN) printModeRejectMessage(scrp->scrnIndex, p, status);
xf86DrvMsg(scrp->scrnIndex, X_INFO,
"Not using built-in mode \"%s\" (%s)\n",
p->name, xf86ModeStatusToString(status));
else if (p->type & M_T_DEFAULT)
xf86DrvMsg(scrp->scrnIndex, X_INFO,
"Not using default mode \"%s\" (%s)\n", p->name,
xf86ModeStatusToString(status));
else
xf86DrvMsg(scrp->scrnIndex, X_INFO,
"Not using mode \"%s\" (%s)\n", p->name,
xf86ModeStatusToString(status));
} }
} }
@ -1796,39 +1801,14 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
repeat = FALSE; repeat = FALSE;
lookupNext: lookupNext:
if (repeat && ((status = p->status) != MODE_OK)) { if (repeat && ((status = p->status) != MODE_OK))
if (p->type & M_T_BUILTIN) printModeRejectMessage(scrp->scrnIndex, p, status);
xf86DrvMsg(scrp->scrnIndex, X_INFO,
"Not using built-in mode \"%s\" (%s)\n",
p->name, xf86ModeStatusToString(status));
else if (p->type & M_T_DEFAULT)
xf86DrvMsg(scrp->scrnIndex, X_INFO,
"Not using default mode \"%s\" (%s)\n", p->name,
xf86ModeStatusToString(status));
else
xf86DrvMsg(scrp->scrnIndex, X_INFO,
"Not using mode \"%s\" (%s)\n", p->name,
xf86ModeStatusToString(status));
}
saveType = p->type; saveType = p->type;
status = xf86LookupMode(scrp, p, clockRanges, strategy); status = xf86LookupMode(scrp, p, clockRanges, strategy);
if (repeat && status == MODE_NOMODE) { if (repeat && status == MODE_NOMODE)
continue; continue;
} if (status != MODE_OK)
if (status != MODE_OK) { printModeRejectMessage(scrp->scrnIndex, p, status);
if (p->type & M_T_BUILTIN)
xf86DrvMsg(scrp->scrnIndex, X_INFO,
"Not using built-in mode \"%s\" (%s)\n",
p->name, xf86ModeStatusToString(status));
else if (p->type & M_T_DEFAULT)
xf86DrvMsg(scrp->scrnIndex, X_INFO,
"Not using default mode \"%s\" (%s)\n", p->name,
xf86ModeStatusToString(status));
else
xf86DrvMsg(scrp->scrnIndex, X_INFO,
"Not using mode \"%s\" (%s)\n", p->name,
xf86ModeStatusToString(status));
}
if (status == MODE_ERROR) { if (status == MODE_ERROR) {
ErrorF("xf86ValidateModes: " ErrorF("xf86ValidateModes: "
"unexpected result from xf86LookupMode()\n"); "unexpected result from xf86LookupMode()\n");
@ -2023,20 +2003,6 @@ xf86PruneDriverModes(ScrnInfoPtr scrp)
return; return;
n = p->next; n = p->next;
if (p->status != MODE_OK) { if (p->status != MODE_OK) {
#if 0
if (p->type & M_T_BUILTIN)
xf86DrvMsg(scrp->scrnIndex, X_INFO,
"Not using built-in mode \"%s\" (%s)\n", p->name,
xf86ModeStatusToString(p->status));
else if (p->type & M_T_DEFAULT)
xf86DrvMsg(scrp->scrnIndex, X_INFO,
"Not using default mode \"%s\" (%s)\n", p->name,
xf86ModeStatusToString(p->status));
else
xf86DrvMsg(scrp->scrnIndex, X_INFO,
"Not using mode \"%s\" (%s)\n", p->name,
xf86ModeStatusToString(p->status));
#endif
xf86DeleteMode(&(scrp->modes), p); xf86DeleteMode(&(scrp->modes), p);
} }
p = n; p = n;

View File

@ -56,6 +56,8 @@ extern void *g_pClipboardDisplay;
extern Window g_iClipboardWindow; extern Window g_iClipboardWindow;
extern Atom g_atomLastOwnedSelection; extern Atom g_atomLastOwnedSelection;
/* BPS - g_hwndClipboard needed for X app->Windows paste fix */
extern HWND g_hwndClipboard;
/* /*
* Local function prototypes * Local function prototypes
@ -141,6 +143,12 @@ winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay,
* Process a given Windows message * Process a given Windows message
*/ */
/* BPS - Define our own message, which we'll post to ourselves to facilitate
* resetting the delayed rendering mechanism after each paste from X app to
* Windows app. TODO - Perhaps move to win.h with the other WM_USER messages.
*/
#define WM_USER_PASTE_COMPLETE (WM_USER + 1003)
LRESULT CALLBACK LRESULT CALLBACK
winClipboardWindowProc (HWND hwnd, UINT message, winClipboardWindowProc (HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam) WPARAM wParam, LPARAM lParam)
@ -167,16 +175,19 @@ winClipboardWindowProc (HWND hwnd, UINT message,
case WM_CREATE: case WM_CREATE:
{ {
HWND first, next;
DWORD error_code = 0;
winDebug ("winClipboardWindowProc - WM_CREATE\n"); winDebug ("winClipboardWindowProc - WM_CREATE\n");
first = GetClipboardViewer(); /* Get handle to first viewer in chain. */
if (first == hwnd) return 0; /* Make sure it's not us! */
/* Add ourselves to the clipboard viewer chain */ /* Add ourselves to the clipboard viewer chain */
s_hwndNextViewer = SetClipboardViewer (hwnd); next = SetClipboardViewer (hwnd);
if (s_hwndNextViewer == hwnd) error_code = GetLastError();
{ if (SUCCEEDED(error_code) && (next == first)) /* SetClipboardViewer must have succeeded, and the handle */
s_hwndNextViewer = NULL; s_hwndNextViewer = next; /* it returned must have been the first window in the chain */
winErrorFVerb (1, "winClipboardWindowProc - WM_CREATE: " else
"attempted to set next window to ourselves."); s_fCBCInitialized = FALSE;
}
} }
return 0; return 0;
@ -220,28 +231,27 @@ winClipboardWindowProc (HWND hwnd, UINT message,
* expensive than just putting ourselves back into the chain. * expensive than just putting ourselves back into the chain.
*/ */
HWND first, next;
DWORD error_code = 0;
winDebug ("winClipboardWindowProc - WM_WM_REINIT: Enter\n"); winDebug ("winClipboardWindowProc - WM_WM_REINIT: Enter\n");
if (hwnd != GetClipboardViewer ())
{ first = GetClipboardViewer(); /* Get handle to first viewer in chain. */
winDebug (" WM_WM_REINIT: Replacing us(%x) with %x at head " if (first == hwnd) return 0; /* Make sure it's not us! */
"of chain\n", hwnd, s_hwndNextViewer); winDebug (" WM_WM_REINIT: Replacing us(%x) with %x at head "
s_fCBCInitialized = FALSE; "of chain\n", hwnd, s_hwndNextViewer);
ChangeClipboardChain (hwnd, s_hwndNextViewer); s_fCBCInitialized = FALSE;
s_hwndNextViewer = NULL; ChangeClipboardChain (hwnd, s_hwndNextViewer);
s_fCBCInitialized = FALSE; s_hwndNextViewer = NULL;
winDebug (" WM_WM_REINIT: Putting us back at head of chain.\n"); s_fCBCInitialized = FALSE;
s_hwndNextViewer = SetClipboardViewer (hwnd); winDebug (" WM_WM_REINIT: Putting us back at head of chain.\n");
if (s_hwndNextViewer == hwnd) first = GetClipboardViewer(); /* Get handle to first viewer in chain. */
{ if (first == hwnd) return 0; /* Make sure it's not us! */
s_hwndNextViewer = NULL; next = SetClipboardViewer (hwnd);
winErrorFVerb (1, "winClipboardWindowProc - WM_WM_REINIT: " error_code = GetLastError();
"attempted to set next window to ourselves.\n"); if (SUCCEEDED(error_code) && (next == first)) /* SetClipboardViewer must have succeeded, and the handle */
} s_hwndNextViewer = next; /* it returned must have been the first window in the chain */
}
else else
{ s_fCBCInitialized = FALSE;
winDebug (" WM_WM_REINIT: already at head of viewer chain.\n");
}
} }
winDebug ("winClipboardWindowProc - WM_WM_REINIT: Exit\n"); winDebug ("winClipboardWindowProc - WM_WM_REINIT: Exit\n");
return 0; return 0;
@ -325,8 +335,6 @@ winClipboardWindowProc (HWND hwnd, UINT message,
* previous XSetSelectionOwner messages. * previous XSetSelectionOwner messages.
*/ */
XSync (pDisplay, FALSE); XSync (pDisplay, FALSE);
winDebug("winClipboardWindowProc - XSync done.\n");
/* Release PRIMARY selection if owned */ /* Release PRIMARY selection if owned */
iReturn = XGetSelectionOwner (pDisplay, XA_PRIMARY); iReturn = XGetSelectionOwner (pDisplay, XA_PRIMARY);
@ -525,6 +533,13 @@ winClipboardWindowProc (HWND hwnd, UINT message,
SetClipboardData (CF_TEXT, NULL); SetClipboardData (CF_TEXT, NULL);
} }
/* BPS - Post ourselves a user message whose handler will reset the
* delayed rendering mechanism after the paste is complete. This is
* necessary because calling SetClipboardData() with a NULL argument
* here will cause the data we just put on the clipboard to be lost!
*/
PostMessage(g_hwndClipboard, WM_USER_PASTE_COMPLETE, 0, 0);
/* Special handling for WM_RENDERALLFORMATS */ /* Special handling for WM_RENDERALLFORMATS */
if (message == WM_RENDERALLFORMATS) if (message == WM_RENDERALLFORMATS)
{ {
@ -542,6 +557,37 @@ winClipboardWindowProc (HWND hwnd, UINT message,
winDebug ("winClipboardWindowProc - WM_RENDER*FORMAT - Returning.\n"); winDebug ("winClipboardWindowProc - WM_RENDER*FORMAT - Returning.\n");
return 0; return 0;
} }
/* BPS - This WM_USER message is posted by us. It gives us the opportunity
* to reset the delayed rendering mechanism after each and every paste
* from an X app to a Windows app. Without such a mechanism, subsequent
* changes of selection in the X app owning the selection are not
* reflected in pastes into Windows apps, since Windows won't send us the
* WM_RENDERFORMAT message unless someone has set changed data (or NULL)
* on the clipboard. */
case WM_USER_PASTE_COMPLETE:
{
if (hwnd != GetClipboardOwner ())
/* In case we've lost the selection since posting the message */
return 0;
winDebug ("winClipboardWindowProc - WM_USER_PASTE_COMPLETE\n");
/* Set up for another delayed rendering callback */
OpenClipboard (g_hwndClipboard);
/* Take ownership of the Windows clipboard */
EmptyClipboard ();
/* Advertise Unicode if we support it */
if (g_fUnicodeSupport)
SetClipboardData (CF_UNICODETEXT, NULL);
/* Always advertise regular text */
SetClipboardData (CF_TEXT, NULL);
/* Release the clipboard */
CloseClipboard ();
}
return 0;
} }
/* Let Windows perform default processing for unhandled messages */ /* Let Windows perform default processing for unhandled messages */

View File

@ -394,6 +394,15 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
* currently being created. * currently being created.
*/ */
winReorderWindowsMultiWindow (); winReorderWindowsMultiWindow ();
/* Fix a 'round title bar corner background should be transparent not black' problem when first painted */
RECT rWindow;
HRGN hRgnWindow;
GetWindowRect(hwnd, &rWindow);
hRgnWindow = CreateRectRgnIndirect(&rWindow);
SetWindowRgn (hwnd, hRgnWindow, TRUE);
DeleteObject(hRgnWindow);
return 0; return 0;
case WM_INIT_SYS_MENU: case WM_INIT_SYS_MENU:

View File

@ -1188,7 +1188,11 @@ ResetHosts (char *display)
FreeHost (host); FreeHost (host);
} }
#if defined WIN32 && defined __MINGW32__
#define ETC_HOST_PREFIX "X"
#else
#define ETC_HOST_PREFIX "/etc/X" #define ETC_HOST_PREFIX "/etc/X"
#endif
#define ETC_HOST_SUFFIX ".hosts" #define ETC_HOST_SUFFIX ".hosts"
fnamelen = strlen(ETC_HOST_PREFIX) + strlen(ETC_HOST_SUFFIX) + fnamelen = strlen(ETC_HOST_PREFIX) + strlen(ETC_HOST_SUFFIX) +
strlen(display) + 1; strlen(display) + 1;