+#if TARGET_HOST_MS_WINDOWS
+
+typedef struct {
+ int *x;
+ int *y;
+ const char *name;
+}m_proc_t ;
+
+static BOOL CALLBACK m_proc(HMONITOR mon,
+ HDC hdc,
+ LPRECT rect,
+ LPARAM data)
+{
+ m_proc_t *dp=(m_proc_t *)data;
+ MONITORINFOEX info;
+ BOOL res;
+ info.cbSize=sizeof(info);
+ res=GetMonitorInfo(mon,(LPMONITORINFO)&info);
+ if( res )
+ {
+ if( !strcmp(dp->name,info.szDevice) )
+ {
+ *(dp->x)=info.rcMonitor.left;
+ *(dp->y)=info.rcMonitor.top;
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+/*
+ * this function is only used in fgOpenWindow. Currently it only sets
+ * its output parameters, if the DisplayName is set in fgDisplay
+ * (and if it is able to recognize the display)
+*/
+
+static void get_display_origin(int *xp,int *yp)
+{
+ if( fgDisplay.DisplayName )
+ {
+ m_proc_t st;
+ st.x=xp;
+ st.y=yp;
+ st.name=fgDisplay.DisplayName;
+ EnumDisplayMonitors(0,0,m_proc,(LPARAM)&st);
+ }
+}
+#endif
+