Notify OpenGL HGCM host service about HiDPI monitor scaling policy change.

        in f_unscaled_hi_dpi of type bool
541511
def notify_hi_dpi_output_policy_change(self, f_unscaled_hi_dpi):
        
        if not isinstance(f_unscaled_hi_dpi, bool):
            raise TypeError("f_unscaled_hi_dpi can only be an instance of type bool")
        self._call("notifyHiDPIOutputPolicyChange",
                     in_p=[f_unscaled_hi_dpi])
1244040
public void setDisplay(int display) {
    if (!Platform.getCurrent().is(LINUX)) {
      throw new UnsupportedOperationException("Unsupported platform: " + Platform.getCurrent());
    }

    options.get(DISPLAY).setValue(display);
  }
354113
def disable_host_check(self, host):
        
        if host.active_checks_enabled:
            host.modified_attributes |= DICT_MODATTR["MODATTR_ACTIVE_CHECKS_ENABLED"].value
            host.disable_active_checks(self.daemon.checks)
            self.send_an_element(host.get_update_status_brok())
1134630
def core_profile_check(self) -> None:
        '''
            
        '''

        profile_mask = self.info['GL_CONTEXT_PROFILE_MASK']
        if profile_mask != 1:
            warnings.warn('The window should request a CORE OpenGL profile')

        version_code = self.version_code
        if not version_code:
            major, minor = map(int, self.info['GL_VERSION'].split('.', 2)[:2])
            version_code = major * 100 + minor * 10

        if version_code < 330:
            warnings.warn('The window should support OpenGL 3.3+ (version_code=%d)' % version_code)
323314
def _check_device(self, requested_device, map_device):
        
        type_1 = torch.device(requested_device)
        type_2 = torch.device(map_device)
        if type_1 != type_2:
            warnings.warn(
                'Setting self.device = {} since the requested device ({}) '
                'is not available.'.format(map_device, requested_device),
                DeviceWarning)
            return map_device
        # return requested_device instead of map_device even though we
        # checked for *type* equality as we might have 'cuda:0' vs. 'cuda:1'.
        return requested_device
1156537
def hosting_devices_unassigned_from_cfg_agent(self, context, ids, host):
        
        self._host_notification(context,
                                'hosting_devices_unassigned_from_cfg_agent',
                                {'hosting_device_ids': ids}, host)
544103
def visibility_changed(self, enable):
        """"""
        SpyderPluginWidget.visibility_changed(self, enable)
        if self.dockwidget is None:
            return
        if self.dockwidget.isWindow():
            self.dock_toolbar.show()
        else:
            self.dock_toolbar.hide()
        if enable:
            self.refresh_plugin()
        self.sig_update_plugin_title.emit()
290490
def adjust_monitor(self, handle, action, devices, events):
        

        events = list(events)
        devices = list(devices)

        for event in events:
            if event not in self.SUPPORTED_EVENTS:
                raise ArgumentError("Unknown event type {} specified".format(event), events=events)

        if action not in self.SUPPORTED_ADJUSTMENTS:
            raise ArgumentError("Unknown adjustment {} specified".format(action))

        action = (handle, action, devices, events)
        if self._currently_notifying:
            self._deferred_adjustments.append(action)
        else:
            self._adjust_monitor_internal(*action)
555768
def get_monitored_hosting_devices_info(self, hd_state_filter=None):
        
        wait_time = datetime.timedelta(
            seconds=cfg.CONF.cfg_agent.hosting_device_dead_timeout)
        resp = []
        for hd_id in self.hosting_devices_backlog:
            hd = self.hosting_devices_backlog[hd_id]['hd']

            display_hd = True

            if hd_state_filter is not None:
                if hd['hd_state'] == hd_state_filter:
                    display_hd = True
                else:
                    display_hd = False

            if display_hd:
                created_time = hd['created_at']
                boottime = datetime.timedelta(seconds=hd['booting_time'])
                backlogged_at = hd['backlog_insertion_ts']
                booted_at = created_time + boottime
                dead_at = backlogged_at + wait_time
                resp.append({'host id': hd['id'],
                             'hd_state': hd['hd_state'],
                             'created at': str(created_time),
                             'backlogged at': str(backlogged_at),
                             'estimate booted at': str(booted_at),
                             'considered dead at': str(dead_at)})
            else:
                continue
        return resp
518336
def screen(self):
        """"""
        # opengl windows cannot get from it's hwnd, so we use the screen
        hwnd = win32gui.GetDesktopWindow()

        # get window size and offset
        left, top, right, bottom = self.rect
        width, height = right-left, bottom-top

        # the device context of the window 
        hdcwin = win32gui.GetWindowDC(hwnd)
        # make a temporary dc
        hdcmem = win32gui.CreateCompatibleDC(hdcwin)
        # make a temporary bitmap in memory, this is a PyHANDLE object
        hbmp = win32gui.CreateCompatibleBitmap(hdcwin, width, height)
        # select bitmap for temporary dc
        win32gui.SelectObject(hdcmem, hbmp)
        # copy bits to temporary dc
        win32gui.BitBlt(hdcmem, 0, 0, width, height, 
                        hdcwin, left, top, win32con.SRCCOPY)
        # check the bitmap object infomation
        bmp = win32gui.GetObject(hbmp)

        bi = BITMAPINFOHEADER()
        bi.biSize = ctypes.sizeof(BITMAPINFOHEADER)
        bi.biWidth = bmp.bmWidth
        bi.biHeight = bmp.bmHeight
        bi.biPlanes = bmp.bmPlanes
        bi.biBitCount = bmp.bmBitsPixel
        bi.biCompression = 0 # BI_RGB
        bi.biSizeImage = 0
        bi.biXPelsPerMeter = 0
        bi.biYPelsPerMeter = 0
        bi.biClrUsed = 0
        bi.biClrImportant = 0

        # calculate total size for bits
        pixel = bmp.bmBitsPixel
        size = ((bmp.bmWidth * pixel + pixel - 1)/pixel) * 4 * bmp.bmHeight
        buf = (ctypes.c_char * size)()

        # read bits into buffer
        windll.gdi32.GetDIBits(hdcmem, hbmp.handle, 0, bmp.bmHeight, buf, ctypes.byref(bi), win32con.DIB_RGB_COLORS)

        # make a PIL Image
        img = Image.frombuffer('RGB', (bmp.bmWidth, bmp.bmHeight), buf, 'raw', 'BGRX', 0, 1)
        img = img.transpose(Image.FLIP_TOP_BOTTOM)

        # cleanup
        win32gui.DeleteObject(hbmp)
        win32gui.DeleteObject(hdcmem)
        win32gui.ReleaseDC(hwnd, hdcwin)

        return img
599702
def setOverlayRenderingPid(self, ulOverlayHandle, unPID):
        

        fn = self.function_table.setOverlayRenderingPid
        result = fn(ulOverlayHandle, unPID)
        return result
623711
public void notifyModified(int flags) {
		if (flags == DirtyFlags.DirtyAll) {
			m_reservedPointCount = -1;// forget the reserved point number
			_notifyModifiedAllImpl();
		}
		m_flagsMask |= flags;

		_clearAccelerators();
		_touch();
	}
1340113
public void setSize (int width, int height) {
    rootElement.getStyle().setWidth(width, Unit.PX);
    rootElement.getStyle().setHeight(height, Unit.PX);
    // the frame buffer may be larger (or smaller) than the logical size, depending on whether
    // we're on a HiDPI display, or how the game has configured things (maybe they're scaling down
    // from native resolution to improve performance)
    Scale fbScale = new Scale(frameBufferPixelRatio);
    canvas.setWidth(fbScale.scaledCeil(width));
    canvas.setHeight(fbScale.scaledCeil(height));
    // set the canvas's CSS size to the logical size; the browser works in logical pixels
    canvas.getStyle().setWidth(width, Style.Unit.PX);
    canvas.getStyle().setHeight(height, Style.Unit.PX);
    viewportChanged(canvas.getWidth(), canvas.getHeight());
  }
162044
public void updateUsableScales() {
		Bbox bgBounds = backgroundPart.getBounds();
		/*
		 * First move background a little bit to right based on difference in width with the sliderUnit.
		 */
		int internalHorMargin = (int) (sliderUnit.getBounds().getWidth() - backgroundPart.getBounds().getWidth()) / 2;
		bgBounds.setX(internalHorMargin);
		
		int backgroundPartHeight = (int) bgBounds.getHeight();
		int sliderAreaHeight = 0;
		/*
		 * Needed for aligning the sliderUnit's y with currentScale's y.
		 */
		int currentUnitY = sliderAreaHeight;
		double currentScale = mapWidget.getMapModel().getMapView().getCurrentScale();
		
		List<Bbox> partBounds = new ArrayList<Bbox>();
		List<ScaleInfo> zoomLevels = mapWidget.getMapModel().getMapInfo().getScaleConfiguration().getZoomLevels();
		int size = zoomLevels.size();
		currentScaleList.clear();
		boolean scaleFound = false;
		for (int i = size - 1 ; i >= 0 ; i--) {
			double scale = zoomLevels.get(i).getPixelPerUnit();
			if (mapWidget.getMapModel().getMapView().isResolutionAvailable(1.0 / scale)) {
				Bbox bounds = (Bbox) bgBounds.clone();
				bounds.setY(sliderAreaHeight);
				partBounds.add(bounds);
				currentScaleList.add(scale);
				if (scale <= currentScale && !scaleFound) {
					scaleFound = true;
					currentUnitY = sliderAreaHeight;
				}
				sliderAreaHeight += backgroundPartHeight;
			}
		}
		/*
		 * Align zoom slider unit with current zoom
		 */
		Bbox bounds = sliderUnit.getBounds();
		bounds.setY(currentUnitY);

		/*
		 * Zoom slider area 
		 */
		sliderArea = new SliderArea(SLIDER_AREA, (int) sliderUnit.getBounds().getWidth(), 
				sliderAreaHeight, sliderUnit, backgroundPart, partBounds,
				mapWidget, new ZoomSliderController(this));
		sliderArea.setHorizontalMargin((int) -bgBounds.getX());
		sliderArea.setVerticalMargin((int) backgroundPart.getBounds().getWidth());
		
		/*
		 * Zoom out button internal margin.
		 */
		zoomOut.getBackground().getBounds().setY(sliderArea.getVerticalMargin() + sliderAreaHeight);
		zoomOut.getIcon().getBounds().setY(sliderArea.getVerticalMargin() + sliderAreaHeight);
	}
298955
def set_gamma_ramp(monitor, ramp):
    
    gammaramp = _GLFWgammaramp()
    gammaramp.wrap(ramp)
    _glfw.glfwSetGammaRamp(monitor, ctypes.pointer(gammaramp))
221375
def show_hc(kwargs=None, call=None):
    '''
    
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The show_hc function must be called with -f or --function.'
        )
    if not kwargs or 'name' not in kwargs:
        log.error(
            'Must specify name of health check.'
        )
        return False

    conn = get_conn()
    return _expand_item(conn.ex_get_healthcheck(kwargs['name']))
906139
def get_dpi(raise_error=True):
    
    # If we are running without an X server (e.g. OSMesa), use a fixed DPI
    if 'DISPLAY' not in os.environ:
        return 96.

    from_xdpyinfo = _get_dpi_from(
        'xdpyinfo', r'(\d+)x(\d+) dots per inch',
        lambda x_dpi, y_dpi: (x_dpi + y_dpi) / 2)
    if from_xdpyinfo is not None:
        return from_xdpyinfo

    from_xrandr = _get_dpi_from(
        'xrandr', r'(\d+)x(\d+).*?(\d+)mm x (\d+)mm',
        lambda x_px, y_px, x_mm, y_mm: 25.4 * (x_px / x_mm + y_px / y_mm) / 2)
    if from_xrandr is not None:
        return from_xrandr
    if raise_error:
        raise RuntimeError('could not determine DPI')
    else:
        logger.warning('could not determine DPI')
    return 96