summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-11-02 21:35:31 -0700
committerKeith Packard <keithp@keithp.com>2011-11-02 21:35:31 -0700
commit548c6fe044068ffba9b5306dc6b11f2ba22782a4 (patch)
tree353fbee7acb28058026e7aeaad83a6a9a5b70452
parent3881b0bf1ce11a62473650bdf6ee01a1762f6f91 (diff)
parentffe8ec86db2655b2c83e5ae61521898140c855ac (diff)
Merge remote-tracking branch 'jturney/master'
-rw-r--r--hw/xwin/InitOutput.c66
-rwxr-xr-xhw/xwin/XWin.exe.manifest5
-rw-r--r--hw/xwin/ddraw.h2
-rw-r--r--hw/xwin/win.h3
-rw-r--r--hw/xwin/winclipboardwndproc.c48
-rw-r--r--hw/xwin/winglobals.c7
-rw-r--r--hw/xwin/winmonitors.c28
-rw-r--r--hw/xwin/winmultiwindowwndproc.c4
-rw-r--r--hw/xwin/winprocarg.c32
-rw-r--r--hw/xwin/winwin32rootlesswndproc.c4
-rw-r--r--hw/xwin/winwndproc.c4
-rw-r--r--xkb/ddxList.c8
-rw-r--r--xkb/ddxLoad.c3
13 files changed, 54 insertions, 160 deletions
diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index 4fe5053b3..770439258 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -70,12 +70,6 @@ extern HWND g_hwndClipboard;
extern Bool g_fClipboard;
#endif
-
-/*
- module handle for dynamically loaded comctl32 library
-*/
-static HMODULE g_hmodCommonControls = NULL;
-
/*
* Function prototypes
*/
@@ -235,14 +229,6 @@ ddxGiveUp (enum ExitCode error)
* we are guaranteed to not need the DirectDraw functions.
*/
winReleaseDDProcAddresses();
-
- /* Unload our TrackMouseEvent function pointer */
- if (g_hmodCommonControls != NULL)
- {
- FreeLibrary (g_hmodCommonControls);
- g_hmodCommonControls = NULL;
- g_fpTrackMouseEvent = (FARPROC) (void (*)(void))NoopDDA;
- }
/* Free concatenated command line */
free(g_pszCommandLine);
@@ -602,34 +588,17 @@ winFixupPaths (void)
}
if (getenv("HOME") == NULL)
{
- HMODULE shfolder;
- SHGETFOLDERPATHPROC shgetfolderpath = NULL;
char buffer[MAX_PATH + 5];
strncpy(buffer, "HOME=", 5);
- /* Try to load SHGetFolderPath from shfolder.dll and shell32.dll */
-
- shfolder = LoadLibrary("shfolder.dll");
- /* fallback to shell32.dll */
- if (shfolder == NULL)
- shfolder = LoadLibrary("shell32.dll");
-
- /* resolve SHGetFolderPath */
- if (shfolder != NULL)
- shgetfolderpath = (SHGETFOLDERPATHPROC)GetProcAddress(shfolder, "SHGetFolderPathA");
-
/* query appdata directory */
- if (shgetfolderpath &&
- shgetfolderpath(NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE, NULL, 0,
- buffer + 5) == 0)
- {
+ if (SHGetFolderPathA(NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE, NULL, 0, buffer + 5) == 0)
+ {
putenv(buffer);
} else
{
winMsg (X_ERROR, "Can not determine HOME directory\n");
- }
- if (shfolder != NULL)
- FreeLibrary(shfolder);
+ }
}
if (!g_fLogFileChanged) {
static char buffer[MAX_PATH];
@@ -839,10 +808,10 @@ winUseMsg (void)
"\theight and initial position for that screen. Additionally\n"
"\ta monitor number can be specified to start the server on,\n"
"\tat which point, all coordinates become relative to that\n"
- "\tmonitor (Not for Windows NT4 and 95). Examples:\n"
- "\t -screen 0 800x600+100+100@2 ; 2nd monitor offset 100,100 size 800x600\n"
- "\t -screen 0 1024x768@3 ; 3rd monitor size 1024x768\n"
- "\t -screen 0 @1 ; on 1st monitor using its full resolution (the default)\n");
+ "\tmonitor. Examples:\n"
+ "\t -screen 0 800x600+100+100@2 ; 2nd monitor offset 100,100 size 800x600\n"
+ "\t -screen 0 1024x768@3 ; 3rd monitor size 1024x768\n"
+ "\t -screen 0 @1 ; on 1st monitor using its full resolution (the default)\n");
ErrorF ("-silent-dup-error\n"
"\tIf another instance of " EXECUTABLE_NAME " with the same display number is running\n"
@@ -979,27 +948,6 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[])
/* Detect supported engines */
winDetectSupportedEngines ();
- /* Load common controls library */
- g_hmodCommonControls = LoadLibraryEx ("comctl32.dll", NULL, 0);
-
- /* Load TrackMouseEvent function pointer */
- g_fpTrackMouseEvent = GetProcAddress (g_hmodCommonControls,
- "_TrackMouseEvent");
- if (g_fpTrackMouseEvent == NULL)
- {
- winErrorFVerb (1, "InitOutput - Could not get pointer to function\n"
- "\t_TrackMouseEvent in comctl32.dll. Try installing\n"
- "\tInternet Explorer 3.0 or greater if you have not\n"
- "\talready.\n");
-
- /* Free the library since we won't need it */
- FreeLibrary (g_hmodCommonControls);
- g_hmodCommonControls = NULL;
-
- /* Set function pointer to point to no operation function */
- g_fpTrackMouseEvent = (FARPROC) (void (*)(void))NoopDDA;
- }
-
/* Store the instance handle */
g_hInstance = GetModuleHandle (NULL);
diff --git a/hw/xwin/XWin.exe.manifest b/hw/xwin/XWin.exe.manifest
index 221150d52..a0d4d7dae 100755
--- a/hw/xwin/XWin.exe.manifest
+++ b/hw/xwin/XWin.exe.manifest
@@ -13,4 +13,9 @@
/>
</dependentAssembly>
</dependency>
+ <asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
+ <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
+ <dpiAware>true</dpiAware>
+ </asmv3:windowsSettings>
+ </asmv3:application>
</assembly>
diff --git a/hw/xwin/ddraw.h b/hw/xwin/ddraw.h
index 2eb7c2674..9d87b2b95 100644
--- a/hw/xwin/ddraw.h
+++ b/hw/xwin/ddraw.h
@@ -1449,7 +1449,7 @@ DECLARE_INTERFACE_(IDirectDraw4,IUnknown)
#define IDirectDraw4_GetAvailableVidMem(p,a,b,c) ICOM_CALL_(GetAvailableVidMem,p,(p,a,b,c))
/*** IDirectDraw4 methods ***/
#define IDirectDraw4_GetSurfaceFromDC(p,a,b) ICOM_CALL_(GetSurfaceFromDC,p,(p,a,b))
-#define IDirectDraw4_RestoreAllSurfaces(pc) ICOM_CALL_(RestoreAllSurfaces,p,(p))
+#define IDirectDraw4_RestoreAllSurfaces(p) ICOM_CALL_(RestoreAllSurfaces,p,(p))
#define IDirectDraw4_TestCooperativeLevel(p) ICOM_CALL_(TestCooperativeLevel,p,(p))
#define IDirectDraw4_GetDeviceIdentifier(p,a,b) ICOM_CALL_(GetDeviceIdentifier,p,(p,a,b))
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index 9bee9b64f..e2e946fb5 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -64,7 +64,7 @@
#define WIN_DEFAULT_BLACKPIXEL 0
#define WIN_DEFAULT_LINEBIAS 0
#define WIN_DEFAULT_E3B_TIME 50 /* milliseconds */
-#define WIN_DEFAULT_DPI 75
+#define WIN_DEFAULT_DPI 96
#define WIN_DEFAULT_REFRESH 0
#define WIN_DEFAULT_WIN_KILL TRUE
#define WIN_DEFAULT_UNIX_KILL FALSE
@@ -673,7 +673,6 @@ extern DeviceIntPtr g_pwinKeyboard;
extern FARPROC g_fpDirectDrawCreate;
extern FARPROC g_fpDirectDrawCreateClipper;
-extern FARPROC g_fpTrackMouseEvent;
/*
diff --git a/hw/xwin/winclipboardwndproc.c b/hw/xwin/winclipboardwndproc.c
index 9394b04db..03da7f41c 100644
--- a/hw/xwin/winclipboardwndproc.c
+++ b/hw/xwin/winclipboardwndproc.c
@@ -56,8 +56,6 @@ extern void *g_pClipboardDisplay;
extern Window g_iClipboardWindow;
extern Atom g_atomLastOwnedSelection;
-/* BPS - g_hwndClipboard needed for X app->Windows paste fix */
-extern HWND g_hwndClipboard;
/*
* Local function prototypes
@@ -143,12 +141,6 @@ winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay,
* 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
winClipboardWindowProc (HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
@@ -343,6 +335,8 @@ winClipboardWindowProc (HWND hwnd, UINT message,
* previous XSetSelectionOwner messages.
*/
XSync (pDisplay, FALSE);
+
+ winDebug("winClipboardWindowProc - XSync done.\n");
/* Release PRIMARY selection if owned */
iReturn = XGetSelectionOwner (pDisplay, XA_PRIMARY);
@@ -540,13 +534,6 @@ winClipboardWindowProc (HWND hwnd, UINT message,
ErrorF("winClipboardWindowProc - timed out waiting for WIN_XEVENTS_NOTIFY\n");
}
- /* 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 */
if (message == WM_RENDERALLFORMATS)
{
@@ -564,37 +551,6 @@ winClipboardWindowProc (HWND hwnd, UINT message,
winDebug ("winClipboardWindowProc - WM_RENDER*FORMAT - Returning.\n");
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 */
diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c
index 2909f371b..631f12e21 100644
--- a/hw/xwin/winglobals.c
+++ b/hw/xwin/winglobals.c
@@ -78,13 +78,6 @@ Bool g_fSoftwareCursor = FALSE;
Bool g_fSilentDupError = FALSE;
Bool g_fNativeGl = FALSE;
-/*
- * Global variables for dynamically loaded libraries and
- * their function pointers
- */
-
-FARPROC g_fpTrackMouseEvent = (FARPROC) (void (*)(void))NoopDDA;
-
#ifdef XWIN_CLIPBOARD
/*
diff --git a/hw/xwin/winmonitors.c b/hw/xwin/winmonitors.c
index a9d46f90e..967ae6d35 100644
--- a/hw/xwin/winmonitors.c
+++ b/hw/xwin/winmonitors.c
@@ -53,30 +53,8 @@ wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _d
return TRUE;
}
-typedef WINAPI wBOOL (*ENUMDISPLAYMONITORSPROC)(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
-ENUMDISPLAYMONITORSPROC _EnumDisplayMonitors;
-
-wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data);
-
Bool QueryMonitor(int index, struct GetMonitorInfoData *data)
{
- /* Load EnumDisplayMonitors from DLL */
- HMODULE user32;
- FARPROC func;
- user32 = LoadLibrary("user32.dll");
- if (user32 == NULL)
- {
- winW32Error(2, "Could not open user32.dll");
- return FALSE;
- }
- func = GetProcAddress(user32, "EnumDisplayMonitors");
- if (func == NULL)
- {
- winW32Error(2, "Could not resolve EnumDisplayMonitors: ");
- return FALSE;
- }
- _EnumDisplayMonitors = (ENUMDISPLAYMONITORSPROC)func;
-
/* prepare data */
if (data == NULL)
return FALSE;
@@ -84,9 +62,5 @@ Bool QueryMonitor(int index, struct GetMonitorInfoData *data)
data->requestedMonitor = index;
/* query information */
- _EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data);
-
- /* cleanup */
- FreeLibrary(user32);
- return TRUE;
+ return EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data);
}
diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c
index fb1938b3a..3d23e9746 100644
--- a/hw/xwin/winmultiwindowwndproc.c
+++ b/hw/xwin/winmultiwindowwndproc.c
@@ -549,8 +549,8 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
tme.hwndTrack = hwnd;
/* Call the tracking function */
- if (!(*g_fpTrackMouseEvent) (&tme))
- ErrorF ("winTopLevelWindowProc - _TrackMouseEvent failed\n");
+ if (!TrackMouseEvent(&tme))
+ ErrorF ("winTopLevelWindowProc - TrackMouseEvent failed\n");
/* Flag that we are tracking now */
s_fTracking = TRUE;
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index ddfe1f5b7..2b6949ed1 100644
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -88,12 +88,27 @@ winInitializeScreenDefaults(void)
dwWidth = GetSystemMetrics (SM_CXSCREEN);
dwHeight = GetSystemMetrics (SM_CYSCREEN);
- winErrorFVerb (2, "winInitializeScreenDefaults - w %d h %d\n",
- (int) dwWidth, (int) dwHeight);
+ winErrorFVerb(2, "winInitializeScreenDefaults - primary monitor w %d h %d\n", (int) dwWidth, (int) dwHeight);
- /* Set a default DPI, if no parameter was passed */
+ /* Set a default DPI, if no '-dpi' option was used */
if (monitorResolution == 0)
- monitorResolution = WIN_DEFAULT_DPI;
+ {
+ HDC hdc = GetDC(NULL);
+ if (hdc)
+ {
+ int dpiX = GetDeviceCaps(hdc, LOGPIXELSX);
+ int dpiY = GetDeviceCaps(hdc, LOGPIXELSY);
+
+ winErrorFVerb(2, "winInitializeDefaultScreens - native DPI x %d y %d\n", dpiX, dpiY);
+ monitorResolution = dpiY;
+ ReleaseDC(NULL, hdc);
+ }
+ else
+ {
+ winErrorFVerb(1, "winInitializeDefaultScreens - Failed to retrieve native DPI, falling back to default of %d DPI\n", WIN_DEFAULT_DPI);
+ monitorResolution = WIN_DEFAULT_DPI;
+ }
+ }
defaultScreenInfo.iMonitor = 1;
defaultScreenInfo.dwWidth = dwWidth;
@@ -311,8 +326,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
struct GetMonitorInfoData data;
if (!QueryMonitor(iMonitor, &data))
{
- ErrorF ("ddxProcessArgument - screen - "
- "Querying monitors is not supported on NT4 and Win95\n");
+ ErrorF ("ddxProcessArgument - screen - Querying monitors failed\n");
} else if (data.bMonitorSpecifiedExists == TRUE)
{
winErrorFVerb(2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor);
@@ -368,8 +382,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
struct GetMonitorInfoData data;
if (!QueryMonitor(iMonitor, &data))
{
- ErrorF ("ddxProcessArgument - screen - "
- "Querying monitors is not supported on NT4 and Win95\n");
+ ErrorF ("ddxProcessArgument - screen - Querying monitors failed\n");
} else if (data.bMonitorSpecifiedExists == TRUE)
{
g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
@@ -396,8 +409,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
struct GetMonitorInfoData data;
if (!QueryMonitor(iMonitor, &data))
{
- ErrorF ("ddxProcessArgument - screen - "
- "Querying monitors is not supported on NT4 and Win95\n");
+ ErrorF ("ddxProcessArgument - screen - Querying monitors failed\n");
} else if (data.bMonitorSpecifiedExists == TRUE)
{
winErrorFVerb (2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor);
diff --git a/hw/xwin/winwin32rootlesswndproc.c b/hw/xwin/winwin32rootlesswndproc.c
index 21506df15..c60a76cba 100644
--- a/hw/xwin/winwin32rootlesswndproc.c
+++ b/hw/xwin/winwin32rootlesswndproc.c
@@ -547,8 +547,8 @@ winMWExtWMWindowProc (HWND hwnd, UINT message,
tme.hwndTrack = hwnd;
/* Call the tracking function */
- if (!(*g_fpTrackMouseEvent) (&tme))
- ErrorF ("winMWExtWMWindowProc - _TrackMouseEvent failed\n");
+ if (!TrackMouseEvent(&tme))
+ ErrorF ("winMWExtWMWindowProc - TrackMouseEvent failed\n");
/* Flag that we are tracking now */
s_fTracking = TRUE;
diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c
index bccd6f9f2..a89857a14 100644
--- a/hw/xwin/winwndproc.c
+++ b/hw/xwin/winwndproc.c
@@ -776,8 +776,8 @@ winWindowProc (HWND hwnd, UINT message,
tme.hwndTrack = hwnd;
/* Call the tracking function */
- if (!(*g_fpTrackMouseEvent) (&tme))
- ErrorF ("winWindowProc - _TrackMouseEvent failed\n");
+ if (!TrackMouseEvent(&tme))
+ ErrorF ("winWindowProc - TrackMouseEvent failed\n");
/* Flag that we are tracking now */
s_fTracking = TRUE;
diff --git a/xkb/ddxList.c b/xkb/ddxList.c
index 7de8efc15..e599f9169 100644
--- a/xkb/ddxList.c
+++ b/xkb/ddxList.c
@@ -44,7 +44,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifdef WIN32
/* from ddxLoad.c */
-extern const char* Win32TempDir();
+extern const char* Win32TempDir(void);
extern int Win32System(const char *cmdline);
#undef System
#define System Win32System
@@ -126,10 +126,11 @@ XkbDDXListComponent( DeviceIntPtr dev,
char *file,*map,*tmp,*buf=NULL;
FILE *in;
Status status;
-int rval;
Bool haveDir;
#ifdef WIN32
char tmpname[PATH_MAX];
+#else
+int rval;
#endif
if ((list->pattern[what]==NULL)||(list->pattern[what][0]=='\0'))
@@ -223,6 +224,9 @@ char tmpname[PATH_MAX];
buf = malloc(PATH_MAX * sizeof(char));
if (!buf) {
fclose(in);
+#ifdef WIN32
+ unlink(tmpname);
+#endif
return BadAlloc;
}
while ((status==Success)&&((tmp=fgets(buf,PATH_MAX,in))!=NULL)) {
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index e1020358a..219d39c9a 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -267,6 +267,9 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
nameRtrn[nameRtrnLen-1]= '\0';
}
free(buf);
+#ifdef WIN32
+ unlink(tmpname);
+#endif
return TRUE;
}
else