wine-staging/patches/winex11-MONITORENUMPROC/0001-winex11.drv-Use-assembler-wrapper-to-call-MONITORENU.patch

66 lines
2.6 KiB
Diff

From c02ba27cd7b2a59b3ad636184602077048dce128 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 12 Feb 2016 00:08:32 +0100
Subject: winex11.drv: Use assembler wrapper to call MONITORENUMPROC callback.
---
dlls/winex11.drv/xinerama.c | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/dlls/winex11.drv/xinerama.c b/dlls/winex11.drv/xinerama.c
index 7e28726..93fb9be 100644
--- a/dlls/winex11.drv/xinerama.c
+++ b/dlls/winex11.drv/xinerama.c
@@ -243,6 +243,30 @@ BOOL CDECL X11DRV_GetMonitorInfo( HMONITOR handle, LPMONITORINFO info )
return TRUE;
}
+#ifdef __i386__
+/* MJ's Help Diagnostic expects that %ecx contains the address to rect,
+ * so we need a small assembly wrapper to call the proc. */
+extern BOOL enum_monitor_wrapper( void *callback, HMONITOR monitor, HDC hdc, RECT *rect, LPARAM data );
+__ASM_GLOBAL_FUNC( enum_monitor_wrapper,
+ "pushl %ebp\n\t"
+ __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
+ __ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
+ "movl %esp,%ebp\n\t"
+ __ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
+ "subl $8,%esp\n\t"
+ "pushl 24(%ebp)\n\t"
+ "pushl 20(%ebp)\n\t"
+ "pushl 16(%ebp)\n\t"
+ "pushl 12(%ebp)\n\t"
+ "movl 20(%ebp),%ecx\n\t"
+ "call *8(%ebp)\n\t"
+ "leave\n\t"
+ __ASM_CFI(".cfi_def_cfa %esp,4\n\t")
+ __ASM_CFI(".cfi_same_value %ebp\n\t")
+ "ret" )
+#else
+#define enum_monitor_wrapper( callback, monitor, hdc, rect, data ) (callback)( (monitor), (hdc), (rect), (data) )
+#endif
/***********************************************************************
* X11DRV_EnumDisplayMonitors (X11DRV.@)
@@ -266,7 +290,7 @@ BOOL CDECL X11DRV_EnumDisplayMonitors( HDC hdc, LPRECT rect, MONITORENUMPROC pro
RECT monrect = monitors[i].rcMonitor;
OffsetRect( &monrect, -origin.x, -origin.y );
if (IntersectRect( &monrect, &monrect, &limit ))
- if (!proc( index_to_monitor(i), hdc, &monrect, lp ))
+ if (!enum_monitor_wrapper( proc, index_to_monitor(i), hdc, &monrect, lp ))
return FALSE;
}
}
@@ -276,7 +300,7 @@ BOOL CDECL X11DRV_EnumDisplayMonitors( HDC hdc, LPRECT rect, MONITORENUMPROC pro
{
RECT unused;
if (!rect || IntersectRect( &unused, &monitors[i].rcMonitor, rect ))
- if (!proc( index_to_monitor(i), 0, &monitors[i].rcMonitor, lp ))
+ if (!enum_monitor_wrapper( proc, index_to_monitor(i), 0, &monitors[i].rcMonitor, lp ))
return FALSE;
}
}
--
2.7.1