+#if TARGET_HOST_MS_WINDOWS
+
+#if(WINVER >= 0x500)
+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);
+ }
+}
+#else
+#pragma message( "-display parameter only works if compiled with WINVER >= 0x0500")
+
+static void get_display_origin(int *xp,int *yp)
+{
+ if( fgDisplay.DisplayName )
+ {
+ fgWarning( "for working -display support FreeGLUT must be compiled with WINVER >= 0x0500");
+ }
+}
+#endif
+#endif
+
+
+#if TARGET_HOST_POSIX_X11
+static Bool fghWindowIsVisible( Display *display, XEvent *event, XPointer arg)
+{
+ Window window = arg;
+ return (event->type == MapNotify) && (event->xmap.window == window);
+}
+#endif