Exemple #1
0
bool X11Helper::OpenXConnection()
{
	DEBUG_ASSERT( Dpy == nullptr && Win == None );
	Dpy = XOpenDisplay(0);
	if( Dpy == nullptr )
		return false;

	XSetIOErrorHandler( FatalCallback );
	XSetErrorHandler( ErrorCallback );
	int event_base, error_base;
	display_supports_dpms_extension= DPMSQueryExtension(Dpy, &event_base, &error_base);
	if(display_supports_dpms_extension)
	{
		LOG->Trace("DPMSQueryExtension returned true.  Stepmania will disable power management, and restore the original state on exit.");
		CARD16 power_level;
		BOOL state;
		if(DPMSInfo(Dpy, &power_level, &state))
		{
			dpms_state_at_startup= state;
			DPMSDisable(Dpy);
		}
		else
		{
			LOG->Trace("DPMSInfo returned false.  Stepmania will not be able to disable power management.");
		}
	}
	else
	{
		LOG->Trace("DPMSQueryExtension returned false, which means this display does not support the DPMS extension.  Stepmania will not be able to disable power management.");
	}
	return true;
}
Exemple #2
0
void wsScreenSaverOff(Display *mDisplay)
{
    int interval, prefer_blank, allow_exp, nothing;

#ifdef CONFIG_XDPMS

    if (DPMSQueryExtension(mDisplay, &nothing, &nothing)) {
        BOOL onoff;
        CARD16 state;
        DPMSInfo(mDisplay, &state, &onoff);

        if (onoff) {
            Status stat;
            mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "Disabling DPMS.\n");
            dpms_disabled = 1;
            stat = DPMSDisable(mDisplay); // monitor powersave off
            mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "stat: %d.\n", stat);
        }
    }

#endif
    XGetScreenSaver(mDisplay, &timeout_save, &interval, &prefer_blank, &allow_exp);

    if (timeout_save)
        XSetScreenSaver(mDisplay, 0, interval, prefer_blank, allow_exp);              // turning off screensaver
}
Exemple #3
0
 void DisableDPMS()
 {
     if (IsDPMSEnabled())
     {
         m_dpmsdeactivated = true;
         DPMSDisable(qt_xdisplay());
         VERBOSE(VB_GENERAL, "DPMS Deactivated ");
     }
 }
Exemple #4
0
void set_dpms_mode(char *mode) {
#if NO_X11
	return;
#else
	RAWFB_RET_VOID
#if LIBVNCSERVER_HAVE_DPMS
	if (dpy && DPMSCapable(dpy)) {
		CARD16 level;
		CARD16 want;
		BOOL enabled;
		if (!strcmp(mode, "off")) {
			want = DPMSModeOff;
		} else if (!strcmp(mode, "on")) {
			want = DPMSModeOn;
		} else if (!strcmp(mode, "standby")) {
			want = DPMSModeStandby;
		} else if (!strcmp(mode, "suspend")) {
			want = DPMSModeSuspend;
		} else if (!strcmp(mode, "enable")) {
			DPMSEnable(dpy);
			return;
		} else if (!strcmp(mode, "disable")) {
			DPMSDisable(dpy);
			return;
		} else {
			return;
		}
		if (DPMSInfo(dpy, &level, &enabled)) {
			char *from = "unk";
			if (enabled && level != want) {
				XErrorHandler old_handler = XSetErrorHandler(trap_xerror);
				trapped_xerror = 0;

				rfbLog("DPMSInfo level: %d enabled: %d\n", level, enabled);
				if (level == DPMSModeStandby) {
					from = "DPMSModeStandby";
				} else if (level == DPMSModeSuspend) {
					from = "DPMSModeSuspend";
				} else if (level == DPMSModeOff) {
					from = "DPMSModeOff";
				} else if (level == DPMSModeOn) {
					from = "DPMSModeOn";
				}

				rfbLog("switching DPMS state from %s to %s\n", from, mode);
				
				DPMSForceLevel(dpy, want);
			
				XSetErrorHandler(old_handler);
				trapped_xerror = 0;
			}
		}
	}
#endif
#endif
}
 void DisableDPMS(void)
 {
     if (IsDPMSEnabled() && m_display)
     {
         m_dpmsdeactivated = true;
         Status status = DPMSDisable(m_display->GetDisplay());
         m_display->Sync();
         LOG(VB_GENERAL, LOG_INFO, LOC +
             QString("DPMS Deactivated %1").arg(status));
     }
 }
Exemple #6
0
/**
 * Sets the DPMS state of the display.
 * @param enabled @c 0 to disable DPMS characteristics of the server, enable it otherwise.
 * @ingroup Ecore_X_DPMS_Group
 */
EAPI void
ecore_x_dpms_enabled_set(int enabled)
{
#ifdef ECORE_XDPMS
   LOGFN(__FILE__, __LINE__, __FUNCTION__);
   if (enabled)
     DPMSEnable(_ecore_x_disp);
   else
     DPMSDisable(_ecore_x_disp);

#endif /* ifdef ECORE_XDPMS */
}
Exemple #7
0
bool DPMSSupport::PlatformSpecificDisablePowerSaving()
{
  Display* dpy = g_Windowing.GetDisplay();
  if (dpy == NULL) return false;

  DPMSForceLevel(dpy, DPMSModeOn);
  DPMSDisable(dpy);
  XFlush(dpy);

  g_Windowing.RecreateWindow();

  return true;
}
void
CXWindowsScreenSaver::enableDPMS(bool enable)
{
#if HAVE_X11_EXTENSIONS_DPMS_H
	if (m_dpms) {
		if (enable) {
			DPMSEnable(m_display);
		}
		else {
			DPMSDisable(m_display);
		}
	}
#endif
}
Exemple #9
0
bool DPMSSupport::PlatformSpecificDisablePowerSaving()
{
  CWinSystemX11 *winSystem = dynamic_cast<CWinSystemX11*>(CServiceBroker::GetWinSystem());
  Display* dpy = winSystem->GetDisplay();
  if (dpy == NULL)
    return false;

  DPMSForceLevel(dpy, DPMSModeOn);
  DPMSDisable(dpy);
  XFlush(dpy);

  winSystem->RecreateWindow();

  return true;
}
Exemple #10
0
bool DPMSSupport::PlatformSpecificDisablePowerSaving()
{
  Display* dpy = g_Windowing.GetDisplay();
  if (dpy == NULL) return false;

  DPMSForceLevel(dpy, DPMSModeOn);
  DPMSDisable(dpy);
  XFlush(dpy);
  // On my ATI, the full-screen window stays blank after waking up from
  // DPMS, presumably due to being OpenGL. There is something magical about
  // window expose events (involving the window manager) that solves this
  // without fail.
  XUnmapWindow(dpy, g_Windowing.GetWindow());
  XFlush(dpy);
  XMapWindow(dpy, g_Windowing.GetWindow());
  XFlush(dpy);

  return true;
}
Exemple #11
0
void X11Helper::CloseXConnection()
{
	if(display_supports_dpms_extension)
	{
		if(dpms_state_at_startup)
		{
			DPMSEnable(Dpy);
		}
		else
		{
			DPMSDisable(Dpy);
		}
	}
	// The window should have been shut down
	DEBUG_ASSERT( Dpy != nullptr );
	DEBUG_ASSERT( Win == None );
	XCloseDisplay( Dpy );
	Dpy = nullptr;
}
void XDisplay::disableDPMS()
{
    DPMSDisable(this->connection);
}