Beispiel #1
0
void
_gdk_monitor_init (void)
{
#ifdef HAVE_MONITOR_INFO
  gint i, index;

  _gdk_num_monitors = 0;

  EnumDisplayMonitors (NULL, NULL, count_monitor, (LPARAM) &_gdk_num_monitors);

  _gdk_monitors = g_renew (GdkWin32Monitor, _gdk_monitors, _gdk_num_monitors);

  index = 0;
  EnumDisplayMonitors (NULL, NULL, enum_monitor, (LPARAM) &index);

  _gdk_offset_x = G_MININT;
  _gdk_offset_y = G_MININT;

  /* Calculate offset */
  for (i = 0; i < _gdk_num_monitors; i++)
    {
      _gdk_offset_x = MAX (_gdk_offset_x, -_gdk_monitors[i].rect.x);
      _gdk_offset_y = MAX (_gdk_offset_y, -_gdk_monitors[i].rect.y);
    }
  GDK_NOTE (MISC, g_print ("Multi-monitor offset: (%d,%d)\n",
			   _gdk_offset_x, _gdk_offset_y));

  /* Translate monitor coords into GDK coordinate space */
  for (i = 0; i < _gdk_num_monitors; i++)
    {
      _gdk_monitors[i].rect.x += _gdk_offset_x;
      _gdk_monitors[i].rect.y += _gdk_offset_y;
      GDK_NOTE (MISC, g_print ("Monitor %d: %dx%d@%+d%+d\n",
			       i, _gdk_monitors[i].rect.width,
			       _gdk_monitors[i].rect.height,
			       _gdk_monitors[i].rect.x,
			       _gdk_monitors[i].rect.y));
    }
#else
  HDC hDC;

  _gdk_num_monitors = 1;
  _gdk_monitors = g_renew (GdkWin32Monitor, _gdk_monitors, 1);

  _gdk_monitors[0].name = g_strdup ("DISPLAY");
  hDC = GetDC (NULL);
  _gdk_monitors[0].width_mm = GetDeviceCaps (hDC, HORZSIZE);
  _gdk_monitors[0].height_mm = GetDeviceCaps (hDC, VERTSIZE);
  ReleaseDC (NULL, hDC);
  _gdk_monitors[0].rect.x = 0;
  _gdk_monitors[0].rect.y = 0;
  _gdk_monitors[0].rect.width = GetSystemMetrics (SM_CXSCREEN);
  _gdk_monitors[0].rect.height = GetSystemMetrics (SM_CYSCREEN);
  _gdk_offset_x = 0;
  _gdk_offset_y = 0;
#endif
}
Beispiel #2
0
RECT GetDCRect( HDC hdc)
{
	
	RECT rc = {0};
	EnumDisplayMonitors(hdc, NULL, MyDCDisplayMonitorsEnumProc, (LPARAM)&rc);
	return rc;
}
Beispiel #3
0
//---------------------------------------------------------------------------//
// SaveData
//
//---------------------------------------------------------------------------//  
void CLauncher::SaveData()
{
  m_EnumeratingMonitors = true;
  m_Monitor             = m_D3D->GetAdapterMonitor(m_Device);
  EnumDisplayMonitors(NULL, NULL, MyEnumMonitors, 0);
  m_EnumeratingMonitors = false;
  IAppOptions::GetInstance()->Set("Device",      m_Device);
  IAppOptions::GetInstance()->Set("Width",       m_Fullscreen ? m_Modes[m_Mode].Width  : m_Width);
  IAppOptions::GetInstance()->Set("Height",      m_Fullscreen ? m_Modes[m_Mode].Height : m_Height);
  IAppOptions::GetInstance()->Set("RLeft",       m_MonitorRect.left);
  IAppOptions::GetInstance()->Set("RTop",        m_MonitorRect.top);
  IAppOptions::GetInstance()->Set("RWidth",      m_Expand ? m_MonitorRect.right - m_MonitorRect.left : m_Width);
  IAppOptions::GetInstance()->Set("RHeight",     m_Expand ? m_MonitorRect.bottom - m_MonitorRect.top : m_Height);
  IAppOptions::GetInstance()->Set("Mode",        m_Mode);
  IAppOptions::GetInstance()->Set("Fullscreen",  m_Fullscreen  ? 1 : 0);
  IAppOptions::GetInstance()->Set("Expand",      m_Expand      ? 1 : 0);
  IAppOptions::GetInstance()->Set("AutoCustTex", m_AutoCustTex ? 1 : 0);
  if (m_AutoCustTex)
  {
    int w = IAppOptions::GetInstance()->Get("Width",  0);
    int h = IAppOptions::GetInstance()->Get("Height", 0);
    IAppOptions::GetInstance()->Set("CustTex1W", w>>1);
    IAppOptions::GetInstance()->Set("CustTex1H", h>>1);
    IAppOptions::GetInstance()->Set("CustTex2W", w>>2);
    IAppOptions::GetInstance()->Set("CustTex2H", h>>2);
  }
  else
  {
static int  DIB_IsWinVisible(_THIS, int  recenter)
{
    VisibilityData  data;
    data.result = 0;
    data.first  = 1;
    
    GetWindowRect(SDL_Window, &data.wrect);

    EnumDisplayMonitors(NULL, NULL, visibility_cb, (LPARAM)&data);
    
    if ( !data.result && recenter ) {
        int  new_x = 10;
        int  new_y = 10;

        if ( !data.first ) {
            int  primary_w = data.primary.right  - data.primary.left;
            int  primary_h = data.primary.bottom - data.primary.top;

            new_x = data.primary.left + (primary_w - this->screen->w)/2;
            new_y = data.primary.top  + (primary_h - this->screen->h)/2;
        }
        DIB_SetWinPos(this, new_x, new_y);
    }
    return  data.result;
}
Beispiel #5
0
/***********************************************************************
 *		MonitorFromRect (USER32.@)
 */
HMONITOR WINAPI MonitorFromRect( LPRECT rect, DWORD flags )
{
    struct monitor_enum_info info;

    info.rect         = *rect;
    info.max_area     = 0;
    info.min_distance = ~0u;
    info.primary      = 0;
    info.nearest      = 0;
    info.ret          = 0;

    if (IsRectEmpty(&info.rect))
    {
        info.rect.right = info.rect.left + 1;
        info.rect.bottom = info.rect.top + 1;
    }

    if (!EnumDisplayMonitors( 0, NULL, monitor_enum, (LPARAM)&info )) return 0;
    if (!info.ret)
    {
        if (flags & MONITOR_DEFAULTTOPRIMARY) info.ret = info.primary;
        else if (flags & MONITOR_DEFAULTTONEAREST) info.ret = info.nearest;
    }

    TRACE( "%s flags %x returning %p\n", wine_dbgstr_rect(rect), flags, info.ret );
    return info.ret;
}
Beispiel #6
0
BOOL wf_info_peer_register(wfInfo* wfi, wfPeerContext* context)
{
	int i;
	int peerId;

	if (!wfi || !context)
		return FALSE;

	if (!wf_info_lock(wfi))
		return FALSE;

	if (wfi->peerCount == WF_INFO_MAXPEERS)
		goto fail_peer_count;

	context->info = wfi;
	if (!(context->updateEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
		goto fail_update_event;

	//get the offset of the top left corner of selected screen
	EnumDisplayMonitors(NULL, NULL, wf_info_monEnumCB, 0);
	_IDcount = 0;

#ifdef WITH_DXGI_1_2
	if (wfi->peerCount == 0)
		if (wf_dxgi_init(wfi) != 0)
			goto fail_driver_init;
#else
	if (!wf_mirror_driver_activate(wfi))
		goto fail_driver_init;
#endif
	//look through the array of peers until an empty slot
	for (i = 0; i < WF_INFO_MAXPEERS; ++i)
	{
		//empty index will be our peer id
		if (wfi->peers[i] == NULL)
		{
			peerId = i;
			break;
		}
	}

	wfi->peers[peerId] = ((rdpContext*) context)->peer;
	wfi->peers[peerId]->pId = peerId;
	wfi->peerCount++;

	WLog_INFO(TAG, "Registering Peer: id=%d #=%d", peerId, wfi->peerCount);
	wf_info_unlock(wfi);
	wfreerdp_server_peer_callback_event(peerId, WF_SRV_CALLBACK_EVENT_CONNECT);

	return TRUE;

fail_driver_init:
	CloseHandle(context->updateEvent);
	context->updateEvent = NULL;
fail_update_event:
fail_peer_count:
	context->socketClose = TRUE;
	wf_info_unlock(wfi);
	return FALSE;
}
Beispiel #7
0
static bool gfx_ctx_init(void)
{
   if (g_inited)
      return false;

   g_quit = false;
   g_restore_desktop = false;

   g_num_mons = 0;
   EnumDisplayMonitors(NULL, NULL, monitor_enum_proc, 0);

   WNDCLASSEX wndclass = {0};
   wndclass.cbSize = sizeof(wndclass);
   wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
   wndclass.lpfnWndProc = WndProc;
   wndclass.hInstance = GetModuleHandle(NULL);
   wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
   wndclass.lpszClassName = "RetroArch";
   wndclass.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON));
   wndclass.hIconSm = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 16, 16, 0);

   if (!RegisterClassEx(&wndclass))
      return false;

   return true;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// Fills specified SHELLEXECUTEINFO structure with the information read from registry
VOID CConfigReader::PopulateExecuteInformation ( SHELLEXECUTEINFO* pExecInfo )
{
    pExecInfo->cbSize = sizeof ( SHELLEXECUTEINFO ) ;
    pExecInfo->fMask = 
        SEE_MASK_FLAG_DDEWAIT | SEE_MASK_HMONITOR | SEE_MASK_NOASYNC | SEE_MASK_UNICODE ;
    pExecInfo->hwnd = NULL ;
    pExecInfo->lpVerb = g_szShellExecuteVerb ;
    pExecInfo->lpFile = m_lpszPath ;
    pExecInfo->lpParameters = m_lpszParams ;
    pExecInfo->lpDirectory = NULL ;
    pExecInfo->nShow = m_dwWindowState ;

    // Set monitor handle. 0 means primary monitor, if index is greater then zero we will enumerate
    // through all monitors and find the required one using index. 
    if ( 0 < m_dwMonitorIndex )
    {
        FINDMONITOR FindMonitor ;
        FindMonitor.dwCurrentIndex = 0 ;
        FindMonitor.dwRequiredIndex = m_dwMonitorIndex ;
        FindMonitor.hMonitor = NULL ;
        EnumDisplayMonitors ( NULL , NULL , EnumMonitorsCallBack , ( LPARAM ) &FindMonitor ) ;
        if ( NULL != FindMonitor.hMonitor )
        {
            pExecInfo->hMonitor = FindMonitor.hMonitor ;
            return ;
        }
    } // If index is invalid or is 0 we will default to primary monitor
    else
    {
        POINT ptZero = { 0 } ;
        pExecInfo->hMonitor = MonitorFromPoint ( ptZero , MONITOR_DEFAULTTOPRIMARY ) ;
    }
}
Beispiel #9
0
// Multi-monitor support.
RECT d3d_monitor_rect(void *data)
{
   d3d_video_t *d3d = (d3d_video_t*)data;
   Monitor::num_mons = 0;
   EnumDisplayMonitors(NULL, NULL, monitor_enum_proc, 0);

   if (!Monitor::last_hm)
      Monitor::last_hm = MonitorFromWindow(GetDesktopWindow(), MONITOR_DEFAULTTONEAREST);
   HMONITOR hm_to_use = Monitor::last_hm;

   unsigned fs_monitor = g_settings.video.monitor_index;
   if (fs_monitor && fs_monitor <= Monitor::num_mons && Monitor::all_hms[fs_monitor - 1])
   {
      hm_to_use = Monitor::all_hms[fs_monitor - 1];
      d3d->cur_mon_id = fs_monitor - 1;
   }
   else
   {
      for (unsigned i = 0; i < Monitor::num_mons; i++)
      {
         if (Monitor::all_hms[i] == hm_to_use)
         {
            d3d->cur_mon_id = i;
            break;
         }
      }
   }

   MONITORINFOEX current_mon;
   memset(&current_mon, 0, sizeof(current_mon));
   current_mon.cbSize = sizeof(MONITORINFOEX);
   GetMonitorInfo(hm_to_use, (MONITORINFO*)&current_mon);

   return current_mon.rcMonitor;
}
Beispiel #10
0
/* static */
int32_t
WinUtils::GetMonitorCount()
{
  int32_t monitorCount = 0;
  EnumDisplayMonitors(nullptr, nullptr, AddMonitor, (LPARAM)&monitorCount);
  return monitorCount;
}
Beispiel #11
0
BOOL CScreenCapture::CaptureScreenRect(
                                       std::vector<CRect> arcCapture,  
                                       CString sSaveDirName,   
                                       int nIdStartFrom, 
                                       SCREENSHOT_IMAGE_FORMAT fmt,
                                       int nJpegQuality,
                                       BOOL bGrayscale,
                                       std::vector<MonitorInfo>& monitor_list)
{	
    // Init output variables
    monitor_list.clear();
    
    // Set internal variables
    m_nIdStartFrom = nIdStartFrom;
    m_sSaveDirName = sSaveDirName;
    m_fmt = fmt;
    m_nJpegQuality = nJpegQuality;
    m_bGrayscale = bGrayscale;
    m_arcCapture = arcCapture;
    m_monitor_list.clear();

    // Get cursor information
    GetCursorPos(&m_ptCursorPos);
    m_CursorInfo.cbSize = sizeof(CURSORINFO);
    GetCursorInfo(&m_CursorInfo);

    // Perform actual capture task inside of EnumMonitorsProc
    EnumDisplayMonitors(NULL, NULL, EnumMonitorsProc, (LPARAM)this);	

    // Return
    monitor_list = m_monitor_list;
    return TRUE;
}
Beispiel #12
0
/**
 * \brief Update screen information.
 *
 * This function should be called in libvo's "control" callback
 * with parameter VOCTRL_UPDATE_SCREENINFO.
 * Note that this also enables the new API where geometry and aspect
 * calculations are done in video_out.c:config_video_out
 *
 * Global libvo variables changed:
 * xinerama_x
 * xinerama_y
 * vo_screenwidth
 * vo_screenheight
 */
void w32_update_xinerama_info(struct vo *vo)
{
    struct vo_w32_state *w32 = vo->w32;
    struct mp_vo_opts *opts = vo->opts;
    int screen = opts->fs ? opts->fsscreen_id : opts->screen_id;
    vo->xinerama_x = vo->xinerama_y = 0;
    if (opts->fs && screen == -2) {
        int tmp;
        vo->xinerama_x = GetSystemMetrics(SM_XVIRTUALSCREEN);
        vo->xinerama_y = GetSystemMetrics(SM_YVIRTUALSCREEN);
        tmp = GetSystemMetrics(SM_CXVIRTUALSCREEN);
        if (tmp) vo->opts->screenwidth = tmp;
        tmp = GetSystemMetrics(SM_CYVIRTUALSCREEN);
        if (tmp) vo->opts->screenheight = tmp;
    } else if (screen == -1) {
        MONITORINFO mi;
        HMONITOR m = MonitorFromWindow(w32->window, MONITOR_DEFAULTTOPRIMARY);
        mi.cbSize = sizeof(mi);
        GetMonitorInfoW(m, &mi);
        vo->xinerama_x = mi.rcMonitor.left;
        vo->xinerama_y = mi.rcMonitor.top;
        vo->opts->screenwidth = mi.rcMonitor.right - mi.rcMonitor.left;
        vo->opts->screenheight = mi.rcMonitor.bottom - mi.rcMonitor.top;
    } else if (screen >= 0) {
        w32->mon_cnt = 0;
        w32->mon_id = screen;
        EnumDisplayMonitors(NULL, NULL, mon_enum, (LONG_PTR)vo);
    }
    aspect_save_screenres(vo, vo->opts->screenwidth,
                          vo->opts->screenheight);
}
  void winDisplayDeviceManager::scanDisplays()
  {
    // TODO mutex for this variable ???
    descMap.clear();
    EnumDisplayMonitors(0,0,winDisplayDeviceManager::EnumDispProc,(LPARAM)this);

    // Add new descriptors
    set<DisplayDeviceDescriptor> tempSet, resultSet;
    for (descMap_t::iterator it = descMap.begin(); it != descMap.end(); it++)
    {
      addDevice(it->second);
      tempSet.insert(it->second);
    }

    // We could just copy the new descriptors, however, we need to call callback functions
    // for old displays, that's why we do this:
    std::set_difference(descriptors.begin(), descriptors.end(), tempSet.begin(), tempSet.end(),
                        std::inserter(resultSet, resultSet.end()));

    set<DisplayDeviceDescriptor>::iterator it = resultSet.begin();
    for (; it != resultSet.end(); it++)
    {
      DisplayDeviceDescriptor desc = *it;
      removeDevice(desc);
    }
  }
Beispiel #14
0
void DrawFrame(OpenGLDrawData &oglData)
{
	//OutputDebugString("Drawing frame ...\n");

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	EnumDisplayMonitors(oglData.oglDC, NULL, MonitorEnumProc, (LPARAM)&oglData);

#if 0
	//glScalef(oglData.width, oglData.height, 1.0f);
	glPushMatrix();
	glTranslatef(oglData.width / 2.0f, oglData.height / 2.0f, 0.0f);
	glScalef(oglData.width, oglData.height, 0.0f);

	glBegin(GL_QUADS);
		glColor3ub(255, 0, 0);
		glVertex2f(-0.5f, -0.5f);

		glColor3ub(0, 255, 0);
		glVertex2f(-0.5f, 0.5f);

		glColor3ub(0, 0, 255);
		glVertex2f(0.5f, 0.5f);

		glColor3ub(255, 255, 255);
		glVertex2f(0.5f, -0.5f);
	glEnd();
	glPopMatrix();
#endif
#if 1
	glEnable(GL_BLEND);
	//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // non-premultiplied alpha
	glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); // premultiplied alpha
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, oglData.iconsTexture);
	glColor3ub(255, 255, 255);
	glScalef(oglData.width, oglData.height, 0.0f);

	glBegin(GL_QUADS);
		glTexCoord2f(0.0f, 0.0f);
		glVertex2f(0.0f, 0.0f);

		glTexCoord2f(0.0f, 1.0f);
		glVertex2f(0.0f, 1.0f);

		glTexCoord2f(1.0f, 1.0f);
		glVertex2f(1.0f, 1.0f);

		glTexCoord2f(1.0f, 0.0f);
		glVertex2f(1.0f, 0.0f);
	glEnd();
	glDisable(GL_TEXTURE_2D);
	glDisable(GL_BLEND);
#endif

	//OutputDebugString("Drew frame.\n");
}
Beispiel #15
0
		void enumerate() {
			if (initialized) {
				return;
			}

			initialized = true;
			EnumDisplayMonitors(NULL, NULL, enumerationCallback, NULL);
		}
Beispiel #16
0
void Kinc_Windows_InitDisplays() {
	HMODULE shcore = LoadLibraryA("Shcore.dll");
	if (shcore != NULL) {
		MyGetDpiForMonitor = (GetDpiForMonitorType)GetProcAddress(shcore, "GetDpiForMonitor");
	}
	memset(displays, 0, sizeof(DisplayData) * MAXIMUM_DISPLAYS);
	EnumDisplayMonitors(NULL, NULL, EnumerationCallback, 0);
}
Beispiel #17
0
        system::system()
        {
            QueryPerformanceFrequency(&freq_);
            QueryPerformanceCounter(&start_);

            if(!impl::windows::monitors.count())
                EnumDisplayMonitors(NULL, NULL, impl::windows::monitor_enum_proc, 0);
        }
void Win32WindowManager::buildMonitorsList()
{
   // Clear the list
   mMonitors.clear();

   // Enumerate all monitors
   EnumDisplayMonitors(NULL, NULL, MonitorEnumProc, (U32)(void*)&mMonitors);
}
Beispiel #19
0
status
ws_init_monitors_display(DisplayObj d)
{ assign(d, monitors, newObject(ClassChain, EAV));

  EnumDisplayMonitors(NULL, NULL, next_monitor, (LPARAM)d);

  succeed;
}
Beispiel #20
0
BOOL LSEnumDisplayMonitors(
    HDC hdc,
    LPCRECT lprcClip,
    MONITORENUMPROC lpfnEnum,
    LPARAM dwData)
{
    return EnumDisplayMonitors(hdc, lprcClip, lpfnEnum, dwData);
}
Beispiel #21
0
unsigned int win32_window_get_screen_count()
{
	// http://stackoverflow.com/questions/7767036/how-do-i-get-the-number-of-displays-in-windows
	unsigned int screen_count = 0;
	EnumDisplayMonitors(0, 0, monitor_enum_proc, (LPARAM)&screen_count);

	return screen_count;
} // win32_window_get_screen_count
Beispiel #22
0
void win32_monitor_init(void)
{
#ifndef _XBOX
   win32_monitor_count = 0;
   EnumDisplayMonitors(NULL, NULL, win32_monitor_enum_proc, 0);
#endif

   g_quit              = false;
}
Beispiel #23
0
int Monitor_Setup(void)
{
	EnumDisplayMonitors(NULL, NULL, MonitorEnumProc, 0);

	if (monitor_count == 0)
		return 1;
	
	return 0;
}
ofRectangle ScreenTopology::getScreenRect(int index) {
	int numMonitors = GetSystemMetrics (SM_CMONITORS);
    printf("we have %d monitors\n", numMonitors);
    vector<ofRectangle> monitors;
    if(EnumDisplayMonitors(NULL, NULL, monitorEnumFunc, (LPARAM)&monitors)) {
		return monitors[index];
    }
	return ofRectangle();
}
Beispiel #25
0
VOID GetHardwareInfo()
{
    int i = 0;
    int monitorCount;
    HANDLE gdi32;
    int cores = 0;

    //use 64 bits to force allmul() on 32 bit builds
    UINT64 physicalPages;
    UINT64 pageSize;

    InitGpuHardware();
    GPU_Initialize(PushSharedMemory->HarwareInformation.DisplayDevice.pciAddress);

    PushSharedMemory->HarwareInformation.DisplayDevice.FrameBuffer.Total = GPU_GetTotalMemory();
    PushSharedMemory->HarwareInformation.DisplayDevice.EngineClockMax = GPU_GetMaximumEngineClock();
    PushSharedMemory->HarwareInformation.DisplayDevice.MemoryClockMax = GPU_GetMaximumMemoryClock();
    PushSharedMemory->HarwareInformation.DisplayDevice.VoltageMax = GPU_GetMaximumVoltage();

    if (Ini_ReadBoolean(L"Settings", L"GpuUsageD3DKMT", FALSE, L".\\" PUSH_SETTINGS_FILE))
        PushGpuLoadD3DKMT = TRUE;

    // Get the number of processors in the system
    NtQuerySystemInformation(SystemBasicInformation, &HwInfoSystemBasicInformation, sizeof(SYSTEM_BASIC_INFORMATION), 0);

    PushSharedMemory->HarwareInformation.Processor.NumberOfThreads = HwInfoSystemBasicInformation.NumberOfProcessors;

    physicalPages = HwInfoSystemBasicInformation.NumberOfPhysicalPages;
    pageSize = HwInfoSystemBasicInformation.PageSize;

    //byte => megabytes
    PushSharedMemory->HarwareInformation.Memory.Total = (physicalPages * pageSize) / 1048576;

    cores = CPU_Intialize();

    PushSharedMemory->HarwareInformation.Processor.NumberOfCores = cores;
    PushSharedMemory->HarwareInformation.Processor.TjMax = CPU_GetTemperatureMaximal();
    PushSharedMemory->HarwareInformation.Processor.MhzBase = CPU_GetBaseSpeed();

    // Monitors
    gdi32 = Module_Load(L"gdi32.dll");

    GetNumberOfPhysicalMonitors = Module_GetProcedureAddress(gdi32, "GetNumberOfPhysicalMonitors");
    GetPhysicalMonitors = Module_GetProcedureAddress(gdi32, "GetPhysicalMonitors");
    DDCCIGetTimingReport = Module_GetProcedureAddress(gdi32, "DDCCIGetTimingReport");
    DDCCIGetVCPFeature = Module_GetProcedureAddress(gdi32, "DDCCIGetVCPFeature");
    DDCCISetVCPFeature = Module_GetProcedureAddress(gdi32, "DDCCISetVCPFeature");

    monitorCount = GetSystemMetrics(SM_CMONITORS);
    MonitorWidth = GetSystemMetrics(SM_CXSCREEN);
    MonitorHeight = GetSystemMetrics(SM_CYSCREEN);

    MonitorHandles = Memory_Allocate(sizeof(HANDLE) * monitorCount);

    EnumDisplayMonitors(NULL, NULL, MonitorEnumProc, NULL);
}
Beispiel #26
0
MonitorManager *monitor_mgr_create()
{
    MonitorManager *mgr = malloc(sizeof(MonitorManager*));
    mgr->monitor_count = 0;
    mgr->monitors = NULL;

    EnumDisplayMonitors(0, NULL, callback, (LPARAM)mgr);

    return mgr;
}
Beispiel #27
0
/*
 * FUNCTION FindMonitor
 *
 * find a specific monitor given by index. Index -1 is the
 * primary display.
 *
 * returns the DC of the selected monitor
 */
HDC FindMonitor(int index)
{
  if(index == -1)
    return GetDC(NULL); /* return primary display context */

  monitorSearchIndex = 0;
  monitorDC = 0;
  EnumDisplayMonitors(NULL, NULL, MonitorEnumProc, index);
  return monitorDC;
}
Beispiel #28
0
// Startup monitor ay be specified from command line
// Example: ConEmu.exe -Monitor <1 | x10001 | "\\.\DISPLAY1">
HMONITOR MonitorFromParam(LPCWSTR asMonitor)
{
	if (!asMonitor || !*asMonitor)
		return NULL;

	wchar_t* pszEnd;
	HMONITOR hMon = NULL;
	MONITORINFO mi = {sizeof(mi)};

	if (asMonitor[0] == L'x' || asMonitor[0] == L'X')
		hMon = (HMONITOR)(DWORD_PTR)wcstoul(asMonitor+1, &pszEnd, 16);
	else if (asMonitor[0] == L'0' && (asMonitor[1] == L'x' || asMonitor[1] == L'X'))
		hMon = (HMONITOR)(DWORD_PTR)wcstoul(asMonitor+2, &pszEnd, 16);
	// HMONITOR was already specified?
	if (GetMonitorInfo(hMon, &mi))
		return hMon;

	// Monitor name or index?
	struct impl {
		HMONITOR hMon;
		LPCWSTR pszName;
		LONG nIndex;

		static BOOL CALLBACK FindMonitor(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData)
		{
			impl* p = (impl*)dwData;
			MONITORINFOEX mi; ZeroStruct(mi); mi.cbSize = sizeof(mi);
			if (GetMonitorInfo(hMonitor, &mi))
			{
				// Get monitor by name?
				if (p->pszName && (0 == lstrcmpi(p->pszName, mi.szDevice)))
				{
					p->hMon = hMonitor;
					return FALSE; // Stop
				}
				// Get monitor by index
				if ((--p->nIndex) <= 0)
				{
					p->hMon = hMonitor;
					return FALSE; // Stop
				}
			}
			return TRUE; // Continue enum
		};
	} Impl = {};

	if (isDigit(asMonitor[0]))
		Impl.nIndex = wcstoul(asMonitor, &pszEnd, 10);
	else
		Impl.pszName = asMonitor;
	EnumDisplayMonitors(NULL, NULL, impl::FindMonitor, (LPARAM)&Impl);

	// Return what found or not
	return Impl.hMon;
}
Beispiel #29
0
Bool QueryMonitor(int index, struct GetMonitorInfoData *data)
{
    /* prepare data */
    if (data == NULL)
        return FALSE;
    memset(data, 0, sizeof(*data));
    data->requestedMonitor = index;

    /* query information */
    return EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data);
}
// this is the static initialize phase is called via constructor
// Has to occur BEFORE init()
// manages to detect Multimonitorsystems, and ScreensaverMode..
void ScreensaverApp::initialize()
{
	iScreensaverMode=InterpreteCommandLine();

	BOOL	blnCloneMode=CRegistry::MatrixShow[REGISTRY_CLONE];

	EnumDisplayMonitors(GetDC(NULL),NULL,(MONITORENUMPROC) MonitorEnum, (long)&blnCloneMode);

	SetCursor(NULL);

}